Hi, I'm getting issue using sys-devel/llvm-3.8.1-r2 while building the following piece of code: #include <fcntl.h> #include <stdio.h> #include <unistd.h> #include <poppler-global.h> #include <poppler-rectangle.h> #include <poppler-document.h> #include <poppler-page.h> #include <poppler-page-renderer.h> using namespace poppler; int main (int argc, char** argv) { const char* file = "/tmp/test.pdf"; document *doc; doc = document::load_from_file(file); return (0); } Result using sys-devel/llvm-3.8.1-r2 with USE="default-compiler-rt default-libcxx" $ clang++ -std=gnu++11 -I/usr/include/poppler/cpp -I/usr/include/poppler -lpoppler-cpp -o /tmp/poppler.clang++.out /tmp/poppler.cpp /tmp/poppler-c67502.o: In function `main': /tmp/poppler.cpp:(.text+0x204): undefined reference to `poppler::document::load_from_file(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)' x86_64-pc-linux-gnu-clang-3.8: error: linker command failed with exit code 1 (use -v to see invocation) Result using sys-devel/llvm-3.8.1-r2 with USE="default-compiler-rt -default-libcxx" $ clang++ -std=gnu++11 -I/usr/include/poppler/cpp -I/usr/include/poppler -lpoppler-cpp -o /tmp/poppler.clang++.out /tmp/poppler.cpp /usr/bin/x86_64-pc-linux-gnu-ld: /tmp/poppler-7ea4a0.o: undefined reference to symbol '_Unwind_Resume@@GCC_3.0' /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/libgcc_s.so.1: error adding symbols: DSO missing from command line x86_64-pc-linux-gnu-clang-3.8: error: linker command failed with exit code 1 (use -v to see invocation) + clang++ -v -std=gnu++11 -I/usr/include/poppler/cpp -I/usr/include/poppler -lpoppler-cpp -o /tmp/poppler.clang++.out /tmp/poppler.cpp Result using sys-devel/llvm-3.8.1-r2 with USE="-default-compiler-rt default-libcxx" $ clang++ -std=gnu++11 -I/usr/include/poppler/cpp -I/usr/include/poppler -lpoppler-cpp -o /tmp/poppler.clang++.out /tmp/poppler.cpp /tmp/poppler-324a9a.o: In function `main': /tmp/poppler.cpp:(.text+0x204): undefined reference to `poppler::document::load_from_file(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)' x86_64-pc-linux-gnu-clang-3.8: error: linker command failed with exit code 1 (use -v to see invocation) Result using sys-devel/llvm-3.8.1-r2 with USE="-default-compiler-rt -default-libcxx" $ clang++ -std=gnu++11 -I/usr/include/poppler/cpp -I/usr/include/poppler -lpoppler-cpp -o /tmp/poppler.clang++.out /tmp/poppler.cpp <no output, compliation goes fine> This issue cannot be reproduced using sys-devel/gcc-5.4.0 (hardened and vanilla) I'm attaching to this ticket output of each commands using -v. Thanks! Reproducible: Always
Created attachment 447796 [details] USE="-default-compiler-rt -default-libcxx"
Created attachment 447798 [details] USE="-default-compiler-rt default-libcxx"
Created attachment 447800 [details] USE="default-compiler-rt -default-libcxx"
Created attachment 447802 [details] USE="default-compiler-rt default-libcxx"
I assume that gcc was used to compile poppler. When llvm is compiled with USE="default_libcxx" clang uses its own C++ standard library, which is incompatible with the one used by gcc. So with this USE setting you run into problems similar to those when upgrading to gcc-5 if you don't rebuild all C++ code using clang. compiler_rt is llvm's analog of libgcc. gcc's libstd++ is probably linked against libgcc. I'm not sure it is supported at all to mix them. So it would be more interesting to see link failures if poppler is compiled with the same compiler as your test program.
(In reply to Felix Janda from comment #5) > I assume that gcc was used to compile poppler. > > When llvm is compiled with USE="default_libcxx" clang uses its own C++ > standard library, which is incompatible with the one used by gcc. So > with this USE setting you run into problems similar to those when > upgrading to gcc-5 if you don't rebuild all C++ code using clang. > > compiler_rt is llvm's analog of libgcc. gcc's libstd++ is probably > linked against libgcc. I'm not sure it is supported at all to mix them. > > So it would be more interesting to see link failures if poppler is > compiled with the same compiler as your test program. I confirm, if I build poppler with a clang compiled with USE="default_libcxx", then gcc can't build my test program and clang can. I believe we are good here. Thanks!