Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 595072 - sys-devel/llvm-3.8.1-r2 - app-text/poppler linking issue with USE="default-libcxx default-compiler-rt"
Summary: sys-devel/llvm-3.8.1-r2 - app-text/poppler linking issue with USE="default-li...
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-25 01:21 UTC by Bertrand Jacquin
Modified: 2016-10-03 22:19 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
USE="-default-compiler-rt -default-libcxx" (poppler-llvm.-default-compiler-rt.-default-libcxx.log,672 bytes, text/x-log)
2016-09-25 01:22 UTC, Bertrand Jacquin
Details
USE="-default-compiler-rt default-libcxx" (poppler-llvm.-default-compiler-rt.+default-libcxx.log,5.13 KB, text/x-log)
2016-09-25 01:22 UTC, Bertrand Jacquin
Details
USE="default-compiler-rt -default-libcxx" (poppler-llvm.+default-compiler-rt.-default-libcxx.log,5.27 KB, text/x-log)
2016-09-25 01:22 UTC, Bertrand Jacquin
Details
USE="default-compiler-rt default-libcxx" (poppler-llvm.+default-compiler-rt.+default-libcxx.log,5.25 KB, text/x-log)
2016-09-25 01:23 UTC, Bertrand Jacquin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bertrand Jacquin 2016-09-25 01:21:02 UTC
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
Comment 1 Bertrand Jacquin 2016-09-25 01:22:25 UTC
Created attachment 447796 [details]
USE="-default-compiler-rt -default-libcxx"
Comment 2 Bertrand Jacquin 2016-09-25 01:22:43 UTC
Created attachment 447798 [details]
USE="-default-compiler-rt default-libcxx"
Comment 3 Bertrand Jacquin 2016-09-25 01:22:57 UTC
Created attachment 447800 [details]
USE="default-compiler-rt -default-libcxx"
Comment 4 Bertrand Jacquin 2016-09-25 01:23:16 UTC
Created attachment 447802 [details]
USE="default-compiler-rt default-libcxx"
Comment 5 Felix Janda 2016-09-25 11:13:49 UTC
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.
Comment 6 Bertrand Jacquin 2016-09-25 14:17:39 UTC
(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!