Larry Evans
2014-Jul-30 15:26 UTC
[LLVMdev] [3.5 Release] Release Candidate 1 Sources and Binaries Available
On 07/30/2014 10:06 AM, Larry Evans wrote:> On 07/30/2014 12:35 AM, Ben Pope wrote: >> On Wednesday, July 30, 2014 01:31 PM, Ben Pope wrote: >> >>> ldd your_built_clang | grep libstdc++ >>> chrpath -l your_built_clang >> >> Hmm, where "your_built_clang" should be the actual failing executable: >> /home/evansl/dwnlds/llvm/3.5rc1/build/Release+Asserts/bin/llvm-tblgen >> >> Ben > Here's the result: > > -*- mode: compilation; default-directory: > "~/dwnlds/llvm/3.5rc1/build-variants/" -*- > Compilation started at Wed Jul 30 10:03:38 > > make -f my.mk chrpath > cat hello_world.cpp > #include <iostream> > int main() > { > std::cout<<"Hello World!\n"; > return 0; > } > g++ --version > g++ (GCC) 4.9.0 > Copyright (C) 2014 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There is NO > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > > g++ hello_world.cpp > ./a.out > Hello World! > ldd a.out | grep libstdc++ > libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 > (0x00002b30fdb04000) > chrpath -l a.out > a.out: no rpath or runpath tag found. > make: [chrpath] Error 2 (ignored) > ldd ./with_LD_LIBRARY_PATH/Release+Asserts/bin/llvm-tblgen | grep libstdc++ > ./with_LD_LIBRARY_PATH/Release+Asserts/bin/llvm-tblgen: > /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not > found (required by ./with_LD_LIBRARY_PATH/Release+Asserts/bin/llvm-tblgen) > libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 > (0x00002aee42a0f000) > chrpath -l ./with_LD_LIBRARY_PATH/Release+Asserts/bin/llvm-tblgen > ./with_LD_LIBRARY_PATH/Release+Asserts/bin/llvm-tblgen: RPATH=$ORIGIN/../lib > > Compilation finished at Wed Jul 30 10:03:38 >OTHO, when LD_LIBRARY_PATH is set to /usr/local/..., there's no "not found" error message: -*- mode: compilation; default-directory: "~/dwnlds/llvm/3.5rc1/build-variants/" -*- Compilation started at Wed Jul 30 10:22:38 make -f my.mk libpath.chrpath LD_LIBRARY_PATH=/usr/local/lib64 make -f my.mk chrpath make[1]: Entering directory `/home/evansl/dwnlds/llvm/3.5rc1/build-variants' cat hello_world.cpp #include <iostream> int main() { std::cout<<"Hello World!\n"; return 0; } g++ --version g++ (GCC) 4.9.0 Copyright (C) 2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. g++ hello_world.cpp ./a.out Hello World! ldd a.out | grep libstdc++ libstdc++.so.6 => /usr/local/lib64/libstdc++.so.6 (0x00002ac7aded9000) chrpath -l a.out a.out: no rpath or runpath tag found. make[1]: [chrpath] Error 2 (ignored) ldd ./with_LD_LIBRARY_PATH/Release+Asserts/bin/llvm-tblgen | grep libstdc++ libstdc++.so.6 => /usr/local/lib64/libstdc++.so.6 (0x00002b0112130000) chrpath -l ./with_LD_LIBRARY_PATH/Release+Asserts/bin/llvm-tblgen ./with_LD_LIBRARY_PATH/Release+Asserts/bin/llvm-tblgen: RPATH=$ORIGIN/../lib make[1]: Leaving directory `/home/evansl/dwnlds/llvm/3.5rc1/build-variants' Compilation finished at Wed Jul 30 10:22:38
Ben Pope
2014-Jul-31 02:53 UTC
[LLVMdev] [3.5 Release] Release Candidate 1 Sources and Binaries Available
On Wednesday, July 30, 2014 11:26 PM, Larry Evans wrote:> On 07/30/2014 10:06 AM, Larry Evans wrote: >> On 07/30/2014 12:35 AM, Ben Pope wrote: >>> On Wednesday, July 30, 2014 01:31 PM, Ben Pope wrote: >>> >>>> ldd your_built_clang | grep libstdc++ >>>> chrpath -l your_built_clang >>> >>> Hmm, where "your_built_clang" should be the actual failing executable: >>> /home/evansl/dwnlds/llvm/3.5rc1/build/Release+Asserts/bin/llvm-tblgen >>> >>> Ben >> Here's the result: >> >> -*- mode: compilation; default-directory: >> "~/dwnlds/llvm/3.5rc1/build-variants/" -*- >> Compilation started at Wed Jul 30 10:03:38 >> >> make -f my.mk chrpath >> cat hello_world.cpp >> #include <iostream> >> int main() >> { >> std::cout<<"Hello World!\n"; >> return 0; >> } >> g++ --version >> g++ (GCC) 4.9.0 >> Copyright (C) 2014 Free Software Foundation, Inc. >> This is free software; see the source for copying conditions. There is NO >> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. >> >> g++ hello_world.cpp >> ./a.out >> Hello World! >> ldd a.out | grep libstdc++ >> libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 >> (0x00002b30fdb04000) >> chrpath -l a.out >> a.out: no rpath or runpath tag found. >> make: [chrpath] Error 2 (ignored) >> ldd ./with_LD_LIBRARY_PATH/Release+Asserts/bin/llvm-tblgen | grep libstdc++ >> ./with_LD_LIBRARY_PATH/Release+Asserts/bin/llvm-tblgen: >> /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not >> found (required by ./with_LD_LIBRARY_PATH/Release+Asserts/bin/llvm-tblgen) >> libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 >> (0x00002aee42a0f000) >> chrpath -l ./with_LD_LIBRARY_PATH/Release+Asserts/bin/llvm-tblgen >> ./with_LD_LIBRARY_PATH/Release+Asserts/bin/llvm-tblgen: RPATH=$ORIGIN/../lib >> >> Compilation finished at Wed Jul 30 10:03:38 >> > OTHO, when LD_LIBRARY_PATH is set to /usr/local/..., > there's no "not found" error message:Is the test above without LD_LIBRARY_PATH set?> -*- mode: compilation; default-directory: > "~/dwnlds/llvm/3.5rc1/build-variants/" -*- > Compilation started at Wed Jul 30 10:22:38 > > make -f my.mk libpath.chrpath > LD_LIBRARY_PATH=/usr/local/lib64 make -f my.mk chrpath > make[1]: Entering directory `/home/evansl/dwnlds/llvm/3.5rc1/build-variants' > cat hello_world.cpp > #include <iostream> > int main() > { > std::cout<<"Hello World!\n"; > return 0; > } > g++ --version > g++ (GCC) 4.9.0 > Copyright (C) 2014 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There is NO > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > > g++ hello_world.cpp > ./a.out > Hello World! > ldd a.out | grep libstdc++ > libstdc++.so.6 => /usr/local/lib64/libstdc++.so.6 (0x00002ac7aded9000) > chrpath -l a.out > a.out: no rpath or runpath tag found. > make[1]: [chrpath] Error 2 (ignored) > ldd ./with_LD_LIBRARY_PATH/Release+Asserts/bin/llvm-tblgen | grep libstdc++ > libstdc++.so.6 => /usr/local/lib64/libstdc++.so.6 (0x00002b0112130000) > chrpath -l ./with_LD_LIBRARY_PATH/Release+Asserts/bin/llvm-tblgen > ./with_LD_LIBRARY_PATH/Release+Asserts/bin/llvm-tblgen: RPATH=$ORIGIN/../lib > make[1]: Leaving directory `/home/evansl/dwnlds/llvm/3.5rc1/build-variants' > > Compilation finished at Wed Jul 30 10:22:38I'm not 100% sure on this, but you seem to be configured to build executables with g++, but not run them, a cross-compiler of sorts. I'm not sure under what conditions executables built with g++-4.9 require GLIBCXX_3.4.20, perhaps try compiling something new like hello_regex.cpp. I think you have a few of options: * Install g++-4.9 to /usr * Add /usr/local/lib64 to /etc/ld.so.conf The above two options means you're installing updated libstdc++ system-wide. * Set the rpath of the binaries at build time: g++-4.9 -Wl,-rpath=/usr/local/lib64 You may want to set that into the compiler options and recompile g++. * Copy /usr/local/lib64/libstdc++.so.6 to ./with_LD_LIBRARY_PATH/Release+Asserts/lib I'm out of ideas. Ben
Larry Evans
2014-Jul-31 17:20 UTC
[LLVMdev] [3.5 Release] Release Candidate 1 Sources and Binaries Available
On 07/30/2014 09:53 PM, Ben Pope wrote:> On Wednesday, July 30, 2014 11:26 PM, Larry Evans wrote:>> On 07/30/2014 10:06 AM, Larry Evans wrote: >>> On 07/30/2014 12:35 AM, Ben Pope wrote: >>>> On Wednesday, July 30, 2014 01:31 PM, Ben Pope wrote: >>>> >>>>> ldd your_built_clang | grep libstdc++ >>>>> chrpath -l your_built_clang >>>> >>>> Hmm, where "your_built_clang" should be the actual failing executable: >>>> /home/evansl/dwnlds/llvm/3.5rc1/build/Release+Asserts/bin/llvm-tblgen >>>> >>>> Ben >>> Here's the result: >>> >>> -*- mode: compilation; default-directory: >>> "~/dwnlds/llvm/3.5rc1/build-variants/" -*- >>> Compilation started at Wed Jul 30 10:03:38 >>> >>> make -f my.mk chrpath >>> cat hello_world.cpp >>> #include <iostream> >>> int main() >>> { >>> std::cout<<"Hello World!\n"; >>> return 0; >>> } >>> g++ --version >>> g++ (GCC) 4.9.0 >>> Copyright (C) 2014 Free Software Foundation, Inc. >>> This is free software; see the source for copying conditions. There >>> is NO >>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR >>> PURPOSE. >>> >>> g++ hello_world.cpp >>> ./a.out >>> Hello World! >>> ldd a.out | grep libstdc++ >>> libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 >>> (0x00002b30fdb04000) >>> chrpath -l a.out >>> a.out: no rpath or runpath tag found. >>> make: [chrpath] Error 2 (ignored) >>> ldd ./with_LD_LIBRARY_PATH/Release+Asserts/bin/llvm-tblgen | grep >>> libstdc++ >>> ./with_LD_LIBRARY_PATH/Release+Asserts/bin/llvm-tblgen: >>> /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not >>> found (required by >>> ./with_LD_LIBRARY_PATH/Release+Asserts/bin/llvm-tblgen) >>> libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 >>> (0x00002aee42a0f000) >>> chrpath -l ./with_LD_LIBRARY_PATH/Release+Asserts/bin/llvm-tblgen >>> ./with_LD_LIBRARY_PATH/Release+Asserts/bin/llvm-tblgen: >>> RPATH=$ORIGIN/../lib >>> >>> Compilation finished at Wed Jul 30 10:03:38 >>> >> OTHO, when LD_LIBRARY_PATH is set to /usr/local/..., >> there's no "not found" error message: > > Is the test above without LD_LIBRARY_PATH set? > >> -*- mode: compilation; default-directory: >> "~/dwnlds/llvm/3.5rc1/build-variants/" -*- >> Compilation started at Wed Jul 30 10:22:38 >> >> make -f my.mk libpath.chrpath >> LD_LIBRARY_PATH=/usr/local/lib64 make -f my.mk chrpath >> make[1]: Entering directory >> `/home/evansl/dwnlds/llvm/3.5rc1/build-variants' >> cat hello_world.cpp >> #include <iostream> >> int main() >> { >> std::cout<<"Hello World!\n"; >> return 0; >> } >> g++ --version >> g++ (GCC) 4.9.0 >> Copyright (C) 2014 Free Software Foundation, Inc. >> This is free software; see the source for copying conditions. There >> is NO >> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR >> PURPOSE. >> >> g++ hello_world.cpp >> ./a.out >> Hello World! >> ldd a.out | grep libstdc++ >> libstdc++.so.6 => /usr/local/lib64/libstdc++.so.6 >> (0x00002ac7aded9000) >> chrpath -l a.out >> a.out: no rpath or runpath tag found. >> make[1]: [chrpath] Error 2 (ignored) >> ldd ./with_LD_LIBRARY_PATH/Release+Asserts/bin/llvm-tblgen | grep >> libstdc++ >> libstdc++.so.6 => /usr/local/lib64/libstdc++.so.6 >> (0x00002b0112130000) >> chrpath -l ./with_LD_LIBRARY_PATH/Release+Asserts/bin/llvm-tblgen >> ./with_LD_LIBRARY_PATH/Release+Asserts/bin/llvm-tblgen: >> RPATH=$ORIGIN/../lib >> make[1]: Leaving directory >> `/home/evansl/dwnlds/llvm/3.5rc1/build-variants' >> >> Compilation finished at Wed Jul 30 10:22:38 > > I'm not 100% sure on this, but you seem to be configured to build > executables with g++, but not run them, a cross-compiler of sorts. I'm > not sure under what conditions executables built with g++-4.9 require > GLIBCXX_3.4.20, perhaps try compiling something new like hello_regex.cpp.When I installed g++-4.9, I used: bash ../../../src/configure --disable-multilib from directory: /home/evansl/dwnlds/gcc/4.9.0/build/default/object where /home/evansl/dwnlds/gcc/4.9.0 contained the bunzip and untar of: http://gcc.petsads.us/releases/gcc-4.9.0/gcc-4.9.0.tar.bz2 The manpage for --enable-multilib: https://gcc.gnu.org/onlinedocs/libstdc++/manual/configure.html says: This is part of the generic multilib support for building cross compilers. So, using --disable-multilib, I think, would disable cross-compiling; hence, your guess that the configuration was to build a "cross-compiler of sorts" seems unlikely.> > I think you have a few of options: > > * Install g++-4.9 to /usr > * Add /usr/local/lib64 to /etc/ld.so.conf > > The above two options means you're installing updated libstdc++ > system-wide. > > * Set the rpath of the binaries at build time: g++-4.9 > -Wl,-rpath=/usr/local/lib64While installing g++-4.9, the messages output to the terminal included something like that: {{{---cut here--- . . . ---------------------------------------------------------------------- Libraries have been installed in: /usr/local/lib/../lib64 If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution - add LIBDIR to the `LD_RUN_PATH' environment variable during linking - use the `-Wl,-rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to `/etc/ld.so.conf' See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- make[4]: Nothing to be done for `install-data-am'. make[4]: Leaving directory `/home/evansl/dwnlds/gcc/4.9.0/build/default/object/x86_64-unknown-linux-gnu/libatomic' make[3]: Leaving directory `/home/evansl/dwnlds/gcc/4.9.0/build/default/object/x86_64-unknown-linux-gnu/libatomic' make[2]: Leaving directory `/home/evansl/dwnlds/gcc/4.9.0/build/default/object/x86_64-unknown-linux-gnu/libatomic' make[1]: Leaving directory `/home/evansl/dwnlds/gcc/4.9.0/build/default/object' evansl at lje-OptiPlex-9020:~/dwnlds/gcc/4.9.0/build/default/object$ }}}---cut here---> > You may want to set that into the compiler options and recompile g++. > > * Copy /usr/local/lib64/libstdc++.so.6 to > ./with_LD_LIBRARY_PATH/Release+Asserts/lib > > I'm out of ideas.Thanks for the help, Ben.> > BenUnfortunately, this problem was caused by my using the default configure for g++-4.9, which installed the library in user/local/lib64 instead of the "standard" places: /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu (the above copied from /etc/ld.so.conf.d/ x86_64-linux-gnu.conf). Unfortunately, there's no mention of this gotcha here: http://clang.llvm.org/get_started.html but there is if you follow the link, "Getting Started with the LLVM System - Requirements", on that page to here: http://llvm.org/docs/GettingStarted.html#requirements which mentions the "pass lib flags to linker" solution: You may need to pass a special linker flag, -Wl,-rpath,$HOME/toolchains/lib or some variant thereof to get things to find the libstdc++ DSO in this toolchain. Now, when our hello_world problem is compiled with this addition, the ldd and chrpath commands show it has the proper library. Since tblgen was not recompiled with the options *and* LD_LIBRARY_PATH was not set to the proper library, the ldd and chrpath commands show it still has the library specified int the /etc/ld.so.conf.d files: Compilation started at Thu Jul 31 12:04:48 make -f my.mk echo chrpath echo "LLVM.src=/home/evansl/dwnlds/llvm/3.5rc1" LLVM.src=/home/evansl/dwnlds/llvm/3.5rc1 echo "CXX.cmd=/usr/local/bin/g++ -L/usr/local/lib64 -Wl,-rpath -Wl,/usr/local/lib64." CXX.cmd=/usr/local/bin/g++ -L/usr/local/lib64 -Wl,-rpath -Wl,/usr/local/lib64. cat hello_world.cpp #include <iostream> int main() { std::cout<<"Hello World!\n"; return 0; } /usr/local/bin/g++ -L/usr/local/lib64 -Wl,-rpath -Wl,/usr/local/lib64 --version g++ (GCC) 4.9.0 Copyright (C) 2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. /usr/local/bin/g++ -L/usr/local/lib64 -Wl,-rpath -Wl,/usr/local/lib64 hello_world.cpp ./a.out Hello World! ldd a.out | grep libstdc++ libstdc++.so.6 => /usr/local/lib64/libstdc++.so.6 (0x00002ba9722e8000) chrpath -l a.out a.out: RPATH=/usr/local/lib64 ldd ./with_LD_LIBRARY_PATH/Release+Asserts/bin/llvm-tblgen | grep libstdc++ ./with_LD_LIBRARY_PATH/Release+Asserts/bin/llvm-tblgen: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./with_LD_LIBRARY_PATH/Release+Asserts/bin/llvm-tblgen) libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00002b315a15e000) chrpath -l ./with_LD_LIBRARY_PATH/Release+Asserts/bin/llvm-tblgen ./with_LD_LIBRARY_PATH/Release+Asserts/bin/llvm-tblgen: RPATH=$ORIGIN/../lib Compilation finished at Thu Jul 31 12:04:49 Is there someway for the clang configure or make to figure this out and automatically add the flags: -L$(CXX.lib) -Wl,-rpath -Wl,$(CXX.lib) to the compile command? That might save someone like me from making the same mistake. -regards, Larry