Gentoo Archives: gentoo-user

From: David Haller <gentoo@×××××××.de>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: undefined symbol "...[abi:cxx11]" (was: Do we have any Blender build experts in the house?)
Date: Sun, 29 May 2016 07:03:57
Message-Id: 20160529070250.4kc7xqp7qndjdu73@grusum.endjinn.de
In Reply to: Re: [gentoo-user] Do we have any Blender build experts in the house? by "J."
1 Hello,
2
3 First of all, this has nothing to do with blender "per se" ...
4
5 On Sat, 28 May 2016, J. García wrote:
6 >El sáb, 28-05-2016 a las 17:26 -0600, J. García escribió:
7 >> BTW, eix won't help you here, I tried it, so the next step is to find
8 >> what provides the symbol 'Imf_2_1::Header::view', after some searches
9 >> with find and then google, I arrived at opencv(though not 100% sure),
10 >> so you might need to rebuild that and make sure(read the log) g++ is
11 >> being called with std=c++11. tracking this sort of stuff might be
12 >> tricky.
13 >I was left with the doubt if opencv was the package causing trouble,
14 >and it is not, so I searched a bit more in depth, and I have found the
15 >library you need to rebuild, it is libIlmImf.so, and this time I'm
16 >sure.
17 >
18 >Looking for the package:
19 >
20 >$ qfile /usr/lib64/libIlmImf.so 
21 >media-libs/openexr (/usr/lib64/libIlmImf.so)
22
23 *Hah* Learned something new, I've overlooked qfile so far :)
24
25 >Looking for the symbol: 
26 >
27 >$ readelf -s /usr/lib64/libIlmImf.so  | grep   '.*Header.*view.*'
28 >  1617: 000000000004a350    25 FUNC    GLOBAL DEFAULT   10
29 >_ZNK7Imf_2_16Header4viewB
30 >  2248: 0000000000049e60    25 FUNC    GLOBAL DEFAULT   10
31 >_ZN7Imf_2_16Header4viewB5
32 >
33 >So you need to: emerge --oneshot media-libs/openexr
34
35 Yes, BUT...
36
37 a) use c++filt / nm -C (see below)
38
39 b) Won't help unless you actually recompile/emerge openexr with
40 -std=c++11 or -std=gnu++11 (or -std={c,gnu}++14 or greater).
41 reemerging as per default with -std=c++98 or less (what's the
42 default std for c++ in g++?) won't help.
43
44 Generally: for any symbol containing '[abi:cxxNN]' you need that lib
45 compiled with the CXX flag '-std=c++NN'. As far as I can see, the
46 symbol 'foo[abi:cxxNN]' also provides the plain symbol 'foo', so it's
47 downwards compatible.
48
49 Ok, you got a symbol + [abi:cxxNN]. Usually, the first part of the
50 symbol gives you a hint as to what lib could be involved. In this case
51 some lib with *Imf* (Symbols Q* are usually Qt stuff ;). Searching
52 online usually helps if you've no idea, but use c++filt too if the
53 symbol seems weird (see below). But in this case with "Imf" ...:
54
55 $ ls /usr/lib64/*Imf*
56 /usr/lib64/libIlmImf-Imf_2_1.so.21 /usr/lib64/libIlmImf.so
57 /usr/lib64/libIlmImf-Imf_2_1.so.21.0.0
58
59 $ equery belongs /usr/lib64/libIlmImf.so
60 * Searching for /usr/lib64/libIlmImf.so ...
61 media-libs/openexr-2.1.0 (/usr/lib64/libIlmImf.so -> libIlmImf-Imf_2_1.so.21.0.0)
62 media-libs/openexr-2.1.0 (/usr/lib64/libIlmImf-Imf_2_1.so.21.0.0)
63
64 $ nm /usr/lib64/libIlmImf.so | grep 'Imf_2_1.*Header.*view'
65 0000000000049a40 T _ZN7Imf_2_16Header12previewImageEv
66 000000000003d5dc t _ZN7Imf_2_16Header14typedAttributeINS_14TypedAttributeINS_12PreviewImageEEEEERT_PKc.part.46
67 0000000000049980 T _ZN7Imf_2_16Header15setPreviewImageERKNS_12PreviewImageE
68 00000000000492c0 T _ZN7Imf_2_16Header4viewB5cxx11Ev
69 0000000000049a80 T _ZNK7Imf_2_16Header12previewImageEv
70 000000000003d5dc t _ZNK7Imf_2_16Header14typedAttributeINS_14TypedAttributeINS_12PreviewImageEEEEERKT_PKc.part.51
71 0000000000049ac0 T _ZNK7Imf_2_16Header15hasPreviewImageEv
72 0000000000049300 T _ZNK7Imf_2_16Header4viewB5cxx11Ev
73 $ nm -C /usr/lib64/libIlmImf.so | grep 'Imf_2_1::Header::view'
74 00000000000492c0 T Imf_2_1::Header::view[abi:cxx11]()
75 0000000000049300 T Imf_2_1::Header::view[abi:cxx11]() const
76 $ nm /usr/lib64/libIlmImf.so | c++filt | grep 'Imf_2_1::Header::view'
77 00000000000492c0 T Imf_2_1::Header::view[abi:cxx11]()
78 0000000000049300 T Imf_2_1::Header::view[abi:cxx11]() const
79
80 Ok, nm does not work on stripped stuff. But strings does:
81
82 $ strip /usr/lib64/libIlmImf.so
83 $ nm /usr/lib64/libIlmImf.so
84 nm: /usr/lib64/libIlmImf.so: no symbols
85 $ strings /usr/lib64/libIlmImf.so | c++filt | grep 'Imf_2_1::Header::view'
86 Imf_2_1::Header::view[abi:cxx11]()
87 Imf_2_1::Header::view[abi:cxx11]() const
88
89 And so does readelf[4]:
90
91 $ readelf -sW /usr/lib64/libIlmImf.so | c++filt | grep 'Imf_2_1::Header::view'
92 1565: 0000000000049300 64 FUNC GLOBAL DEFAULT 10 Imf_2_1::Header::view[abi:cxx11]() const
93 2178: 00000000000492c0 64 FUNC GLOBAL DEFAULT 10 Imf_2_1::Header::view[abi:cxx11]()
94
95 (so, I already _DO_ have libIlmImf compiled with -std=c++11 or
96 -std=gnu++11, so I'm fine, but you're missing the '[abi:cxx11]', so
97 you need to recompile with -std=c++11/-std=gnu++11).
98
99 That's because I "default" by now to c++11 (and the extra CXXSTD var
100 is due to me starting to switch that (back and forth) before realising
101 the below).
102
103 $ grep CXX /etc/portage/make.conf
104 CXXSTD=" -std=c++11"
105 CXXFLAGS="$CFLAGS ${CXXSTD} "
106
107 BUT!
108
109 Some packages do not compile (yet) with c++11, and still need
110 c++98/gnu++98.
111
112 And some even seem to already need c++14 (mkvtoolnix). *Woah* After
113 realizing this and finding the stuff about the env-files (I love
114 gentoo for stuff like this!), I thought a moment... And ...
115
116 So, I've got a couple of env-files and use them for the packages that
117 need it.
118
119 First of all: I set the CPU-dependend stuff (-march, -O* etc. _AND
120 ONLY THAT_ (see below)) in CFLAGS in make.conf, then combine CFLAGS +
121 CXXSTD + whatever to my CXXFLAGS in make.conf (see above). And for
122 packages needing special handling I have this (use c++NN instead of
123 gnu++NN if you don't want to cater for GNU stuff, e.g. if you're
124 cross-compiling (too)).
125
126 ==== /etc/portage/env/cxx98-flags ====
127 CXXFLAGS="$CFLAGS -std=gnu++98"
128 ====
129
130 ==== /etc/portage/env/cxx11-flags ====
131 CXXFLAGS="$CFLAGS -std=gnu++11"
132 ====
133
134 ==== /etc/portage/env/cxx14-flags ====
135 CXXFLAGS="$CFLAGS -std=gnu++14"
136 ====
137
138 This is (of course) assuming you have "$CFLAGS" only specifying
139 machine stuff, not C-language specific stuff[0].
140
141 And then I just add stuff to /etc/portage/package.env as needed, e.g.
142
143 ==== /etc/portage/package.env ====
144 [..]
145 media-libs/avidemux-core cxx98-flags
146 media-video/avidemux cxx98-flags
147 media-libs/avidemux-plugins cxx98-flags
148 [..]
149 media-video/mkvtoolnix cxx14-flags
150 [..]
151 ====
152
153 As I default to c++11, I do not need openexr in there[3], but for you it
154 should be:
155
156 ==== /etc/portage/package.env ====
157 media-libs/openexr cxx11-flags
158 ====
159
160 That whole scheme gives me at least a clean build (for e.g. avidemux
161 as well as mkvmerge/mkvtoolnix).
162
163 $ gcc-config -l
164 [1] x86_64-pc-linux-gnu-4.9.3
165 [2] x86_64-pc-linux-gnu-5.3.0 *
166
167 Once you've got that set up, it's basically like any package.use or
168 package.mask stuff, just add a
169
170 foo/bar cxxNN-flags
171
172 line to package.env, and get going ;)
173
174 I have to admit though, that I've no idea if you can state more than
175 one env-file on a line in package.env nor if you can somehow
176 include/source other env-files from others (say foo-flags sources
177 cxxNN-flags). I've just not have needed that yet, so I haven't tested
178 it.
179
180 HTH,
181 -dnh, still a noob to portage/ebuilds, but quite firm in building stuff
182
183 [0] If you need real C-specific flags, I'd suggest a variable in
184 make.conf (-> c.f. CXXSTD in mine), say "OPT_FLAGS" (or ARCH_FLAGS
185 for more specifics) for flags like "-O2 -march=.. ..." etc. and
186 then e.g.
187
188 CFLAGS="${OPT_FLAGS} -fsome_c_specific_gcc_flag_i_dont_know ..."
189 CXXFLAGS="${OPT_FLAGS} ... -std=c++..."
190
191 in make.conf and in the /etc/portage/env/cxx*-flags files use
192
193 CXXFLAGS="${OPT_FLAGS} ... -std=c++..."
194
195 as appropriate for each std you need in each "C++ std flags env
196 file" ;) And use a similar approach for specific C-flags as well.
197
198 [3] which reminds me to prune any cxx11-flags
199
200 [4]
201 ==== ~/bin/symgrep ====
202 #!/bin/sh
203 exec readelf -sW "$2" | c++filt | grep "$1"
204 ====
205
206 --
207 MCSE: "Microsoft Certified Stupidity enclosed" -- A. Spengler

Replies