Hi All,
I'm having this weird issue in rawhide / f24 where I get the following error:
ldd -r /usr/lib64/libsfml-graphics.so
<snip>
undefined symbol: __cpu_model (/usr/lib64/libsfml-graphics.so)
I've found this out by build failures like this one:
/usr/bin/ld: conftest: hidden symbol `__cpu_model' in /usr/lib/gcc/x86_64-redhat-linux/6.0.0/libgcc.a(cpuinfo.o) is referenced by DSO /usr/bin/ld: final link failed: Bad value
I've gone closely over the CFLAGS and LDFLAGS for SFML and the full rpm config flags are used, including passing -fPIC when building the object files and passing both -fPIC and -shared when linking the .so file.
I've tracked the root cause of this down to a call to __builtin_cpu_supports("sse2") in the SFML code, if I remove that call, all is well.
Any hints on what is going on here appreciated.
Note I already have a fix, SFML only calls __builtin_cpu_supports("sse2") when building with -msse2, so the whole call can simply be replaced by "1", but I still would like to know what is going on here.
Regards,
Hans
On Sat, Feb 27, 2016 at 11:03:57PM +0100, Hans de Goede wrote:
I'm having this weird issue in rawhide / f24 where I get the following error:
ldd -r /usr/lib64/libsfml-graphics.so
<snip>
undefined symbol: __cpu_model (/usr/lib64/libsfml-graphics.so)
How do you link the shared library? Do you use the gcc or g++ driver to link that, without -nostdlib? If you say link directly with ld -shared or something similar, then this would be caused by libgcc.a not being linked into the shared library.
Jakub
Hi,
On 27-02-16 23:08, Jakub Jelinek wrote:
On Sat, Feb 27, 2016 at 11:03:57PM +0100, Hans de Goede wrote:
I'm having this weird issue in rawhide / f24 where I get the following error:
ldd -r /usr/lib64/libsfml-graphics.so
<snip>
undefined symbol: __cpu_model (/usr/lib64/libsfml-graphics.so)
How do you link the shared library? Do you use the gcc or g++ driver to link that, without -nostdlib? If you say link directly with ld -shared or something similar, then this would be caused by libgcc.a not being linked into the shared library.
/usr/lib64/ccache/c++ -fPIC \ -O2 -g -pipe -Wall -Werror=format-sec... -mtune=generic \ -DNDEBUG \ -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld \ -shared -Wl,-soname,libsfml-graphics.so.2.3 -o libsfml-system.so.2.3.2 \ -lfoo -lbar -l... \ -Wl,-rpath,/home/hans/projects/fedora/SFML/master/SFML-2.3.2/lib:
Which AFAICT should be fine.
Regards,
Hans
On Sat, Feb 27, 2016 at 11:18:35PM +0100, Hans de Goede wrote:
On 27-02-16 23:08, Jakub Jelinek wrote:
On Sat, Feb 27, 2016 at 11:03:57PM +0100, Hans de Goede wrote:
I'm having this weird issue in rawhide / f24 where I get the following error:
ldd -r /usr/lib64/libsfml-graphics.so
<snip>
undefined symbol: __cpu_model (/usr/lib64/libsfml-graphics.so)
How do you link the shared library? Do you use the gcc or g++ driver to link that, without -nostdlib? If you say link directly with ld -shared or something similar, then this would be caused by libgcc.a not being linked into the shared library.
/usr/lib64/ccache/c++ -fPIC \ -O2 -g -pipe -Wall -Werror=format-sec... -mtune=generic \ -DNDEBUG \ -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld \ -shared -Wl,-soname,libsfml-graphics.so.2.3 -o libsfml-system.so.2.3.2 \ -lfoo -lbar -l... \ -Wl,-rpath,/home/hans/projects/fedora/SFML/master/SFML-2.3.2/lib:
Which AFAICT should be fine.
If you want a quick workaround, just link with -lgcc_s -lgcc last (or don't link with c++, but gcc). The rules for when exactly is -lgcc_s linked in, when -lgcc, when -lgcc_eh, and in what order are quite complex (depending on g++ vs. gcc driver, -shared-libgcc/-static-libgcc, -shared vs. executable etc.); on ppc32 I remember libgcc_s.so is a linker script which links in -lgcc_s -lgcc, perhaps we need it on x86_64/i686 too.
Jakub
Hi,
On 27-02-16 23:29, Jakub Jelinek wrote:
On Sat, Feb 27, 2016 at 11:18:35PM +0100, Hans de Goede wrote:
On 27-02-16 23:08, Jakub Jelinek wrote:
On Sat, Feb 27, 2016 at 11:03:57PM +0100, Hans de Goede wrote:
I'm having this weird issue in rawhide / f24 where I get the following error:
ldd -r /usr/lib64/libsfml-graphics.so
<snip>
undefined symbol: __cpu_model (/usr/lib64/libsfml-graphics.so)
How do you link the shared library? Do you use the gcc or g++ driver to link that, without -nostdlib? If you say link directly with ld -shared or something similar, then this would be caused by libgcc.a not being linked into the shared library.
/usr/lib64/ccache/c++ -fPIC \ -O2 -g -pipe -Wall -Werror=format-sec... -mtune=generic \ -DNDEBUG \ -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld \ -shared -Wl,-soname,libsfml-graphics.so.2.3 -o libsfml-system.so.2.3.2 \ -lfoo -lbar -l... \ -Wl,-rpath,/home/hans/projects/fedora/SFML/master/SFML-2.3.2/lib:
Which AFAICT should be fine.
If you want a quick workaround, just link with -lgcc_s -lgcc last (or don't link with c++, but gcc). The rules for when exactly is -lgcc_s linked in, when -lgcc, when -lgcc_eh, and in what order are quite complex (depending on g++ vs. gcc driver, -shared-libgcc/-static-libgcc, -shared vs. executable etc.); on ppc32 I remember libgcc_s.so is a linker script which links in -lgcc_s -lgcc, perhaps we need it on x86_64/i686 too.
I've tried both adding -lgcc_s -lgcc (near the end of the list of libs / -l options, but not at the end because cmake) and simply building and linking everything with "gcc" as compile / link command (also cutting out ccache), neither one helped I'm afraid.
As said I've a workaround, but still it would be good to figure out what is going on. Should I take this to bugzilla ? And if so which bugzilla ?
Regards,
Hans