Hello, On Sun, 14 Oct 2018, L A Walsh wrote:
On 10/14/2018 2:16 AM, Simon Lees wrote:
If it existed it would be in a static-devel package generally in openSUSE we don't ship files for static linking, with a few exceptions That's part of the problem -- I don't know which have exceptions nor why.
That's not the point. The .la file is _NOT_ needed[1]. You just need the static lib (in /usr/lib{,32,64}/gcc/${host-triplet}/${version}/libstdc++.a, which will be picked up by the linker when you use '-static -lstdc++'. Not even a need for -L. Your project searching for the .la file in /usr/lib64/ is broken. I should neither explicitly look for the .la file nor explicitly in /usr/lib64 (or /usr/lib64/foo/../lib64). Sample host: $ locate libstdc++.la $ locate libstdc++.a /usr/lib64/gcc/x86_64-pc-linux-gnu/6.4.0/32/libstdc++.a /usr/lib64/gcc/x86_64-pc-linux-gnu/6.4.0/libstdc++.a /usr/lib64/gcc/x86_64-pc-linux-gnu/7.3.0/32/libstdc++.a /usr/lib64/gcc/x86_64-pc-linux-gnu/7.3.0/libstdc++.a It's been this way for many many years (at least since oS 12.1 in 2011/11). Using .la files has been strongly discouraged even before that, and I think it's policy now for years, though I can't find that online. JFTR: on a 12.1: $ ls /usr/lib64/*.la | wc -l 72 $ ls /usr/lib64/*.a | wc -l 201 $ ls /usr/lib64/*.so | wc -l 1111 $ rpm -qf /usr/lib64/*.la | sort -u | wc -l 28 Different host (current): $ ls /usr/lib64/*.la | wc -l 111 $ ls /usr/lib64/*.a | wc -l 203 $ ls /usr/lib64/*.so | wc -l 1739 $ [analog to rpm -qf /usr/lib64/*.la | sort -u | wc -l] 73 And in both ISTR it's considered a bug that those .la files are there. Oh, and: $ cat t.cc #include <iostream> int main(void) { std::cout << "Hello World!" << std::endl; return 0; } $ g++ -Wl,-t t.cc -o t.out [..] /tmp/ccall71V.o -lstdc++ (/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/libstdc++.so) [..] $ ./t.out Hello World! $ g++ -c -o t.o t.cc $ clang++ -Wl,-t -o t.out t.o [..] t.o -lstdc++ (/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/libstdc++.so) $ clang++ -Wl,-t -o t.out t.cc [..] /tmp/t-bf16f5.o -lstdc++ (/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/libstdc++.so) Go figure! Actually, explicitly linking against libstdc++ (or libc) is broken anyway, unless you have very good reasons to directly use ld instead of g++ or clang++ etc. as a linker call. And if you'd do, you'd not need to ask. So, as you're not even telling what "project" that is, and how the call to the linker is and from where ... -dnh [1] there might be some corner cases, but I know of none. -- The documentation is in Japanese. Good luck. -- Rich $alz -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org