http://bugzilla.opensuse.org/show_bug.cgi?id=1051881
Bug ID: 1051881 Summary: clang can't find libc.so with -m32 Classification: openSUSE Product: openSUSE Tumbleweed Version: Current Hardware: Other OS: Other Status: NEW Severity: Normal Priority: P5 - None Component: Basesystem Assignee: bnc-team-screening@forge.provo.novell.com Reporter: martin.liska@suse.com QA Contact: qa-bugs@suse.de Found By: --- Blocker: ---
Running:
$ clang --version clang version 4.0.1 (tags/RELEASE_401/final 305264)
$ cat a.c int main() {}
$ clang -m32 a.c /usr/bin/ld: skipping incompatible /usr/bin/../lib64/gcc/x86_64-suse-linux/7/../../../libc.so when searching for -lc /lib/libc.so.6: error adding symbols: File format not recognized clang-4.0.1: error: linker command failed with exit code 1 (use -v to see invocation)
I've noticed we have openSUSE specific patches: https://build.opensuse.org/package/view_file/openSUSE:Factory/llvm4/clang-re... https://build.opensuse.org/package/view_file/openSUSE:Factory/llvm4/assume-o...
But it does not work properly with -m32. Note the code in DetectDistro.cpp checks for /etc/SuSE-release, which is legacy. One should use /etc/os-release. I can fix that after we resolve this issue.
Thanks, Martin
http://bugzilla.opensuse.org/show_bug.cgi?id=1051881
Martin Liška martin.liska@suse.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |idonmez@suse.com, | |msrb@suse.com
http://bugzilla.opensuse.org/show_bug.cgi?id=1051881
Ismail Donmez idonmez@suse.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC|msrb@suse.com | Assignee|bnc-team-screening@forge.pr |msrb@suse.com |ovo.novell.com |
http://bugzilla.opensuse.org/show_bug.cgi?id=1051881 http://bugzilla.opensuse.org/show_bug.cgi?id=1051881#c1
--- Comment #1 from Martin Liška martin.liska@suse.com --- Note that I've got installed glibc-32bit package. I also tested Fedora 25 and one needs to install their glibc-devel.x86_64 to have it working.
http://bugzilla.opensuse.org/show_bug.cgi?id=1051881 http://bugzilla.opensuse.org/show_bug.cgi?id=1051881#c2
--- Comment #2 from Martin Liška martin.liska@suse.com --- Last observation is that gcc -m32 uses following 2 packages to get crt*.o and libm.so:
# rpm -qf /usr/lib/crtn.o glibc-devel-32bit-2.25-2.5.x86_64 # rpm -qf /lib/libm-2.25.so glibc-32bit-2.25-2.5.x86_64
http://bugzilla.opensuse.org/show_bug.cgi?id=1051881 http://bugzilla.opensuse.org/show_bug.cgi?id=1051881#c3
--- Comment #3 from Martin Liška martin.liska@suse.com --- Ping.
http://bugzilla.opensuse.org/show_bug.cgi?id=1051881 http://bugzilla.opensuse.org/show_bug.cgi?id=1051881#c4
Michal Srb msrb@suse.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |IN_PROGRESS
--- Comment #4 from Michal Srb msrb@suse.com --- Sorry, I was busy with other llvm issues, now I finally have time to dig into this one.
(In reply to Martin Liška from comment #0)
But it does not work properly with -m32. Note the code in DetectDistro.cpp checks for /etc/SuSE-release, which is legacy. One should use /etc/os-release. I can fix that after we resolve this issue.
So far I don't think the issue comes from here. The whole DetectDistro function is removed and Distro::OpenSUSE is returned unconditionally. The "/etc/SuSE-release" file is not even read.
It seems that clang correctly discovers that the 32bit gcc is in "/usr/lib64/gcc/x86_64-suse-linux/7/32". It links with some files from that directory (for example crtcend.o or libgcc_s.so), which is correct.
However, it fails to detect the right place for glibc files. It discovers them in "/usr/bin/../lib64/gcc/x86_64-suse-linux/7/../../.." = "/usr/lib64" directory. It seems that clang does not expect the 32bit gcc to be under the /usr/lib64 directory. We will probably need special case for finding the glibc.
http://bugzilla.opensuse.org/show_bug.cgi?id=1051881 http://bugzilla.opensuse.org/show_bug.cgi?id=1051881#c6
Martin Li��ka martin.liska@suse.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|IN_PROGRESS |RESOLVED Resolution|--- |FIXED
--- Comment #6 from Martin Li��ka martin.liska@suse.com --- It seems it works fine now.