Compile CGAL with clang++-3.8 and libc++

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Compile CGAL with clang++-3.8 and libc++

Oren Shpigel
Hi, 
I'm trying to use CGAL with clang++-3.8 and libc++.
I compiled boost, gmp and mpfr, and then compiled CGAL with them (all with clang++-3.8 and libc++).
But when linking my own program with CGAL I get the following error:

//usr/local/lib/libCGAL.so: undefined reference to `std::__1::basic_istream<char, std::__1::char_traits<char> >::operator>>(std::__1::basic_istream<char, std::__1::char_traits<char> >& (*)(std::__1::basic_istream<char, std::__1::char_traits<char> >&))'

In the CGAL website I saw that CGAL supports clang 3.5 and 3.6.2.
Do I get this error because clang 3.8 isn't supported?
What has changed? Is there something I can do to use it?
Or any other idea about this linker error?

Thanks, 
Oren
Reply | Threaded
Open this post in threaded view
|

Re: Compile CGAL with clang++-3.8 and libc++

Marc Glisse
On Sun, 29 Jan 2017, Oren Shpigel wrote:

> Hi,
> I'm trying to use CGAL with clang++-3.8 and libc++.
> I compiled boost, gmp and mpfr, and then compiled CGAL with them (all with
> clang++-3.8 and libc++).
> But when linking my own program with CGAL I get the following error:
>
> //usr/local/lib/libCGAL.so: undefined reference to
> `std::__1::basic_istream<char, std::__1::char_traits<char>
>> ::operator>>(std::__1::basic_istream<char, std::__1::char_traits<char> >&
> (*)(std::__1::basic_istream<char, std::__1::char_traits<char> >&))'
>
> In the CGAL website I saw that CGAL supports clang 3.5 and 3.6.2.
> Do I get this error because clang 3.8 isn't supported?

No.

> What has changed? Is there something I can do to use it?
> Or any other idea about this linker error?

Did you link you program with libc++? It usually helps answering questions
when we can actually see the command producing the error message, and the
full message...

--
Marc Glisse

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Compile CGAL with clang++-3.8 and libc++

Padraig O Conbhui
Hi Oren,

This sounds like an error between one library looking for libc++ and another looking for libstdc++. Using -std=c++11 can cause libc++ to link unless you explicitly pass -stdlib=libstdc++ (not certain if libstdc++ or just stdc++). So differences in compiler flags between gmp, mpfr, boost and cgal and the c++ library they're linking is probably the problem. And since it's c++, probably just boost and cgal. Try passing -std=c++11 -stdlib=libc++ to both boost and cgal during compile.

Cheers,
Paddy

On Sun, Jan 29, 2017 at 5:43 PM, Marc Glisse <[hidden email]> wrote:
On Sun, 29 Jan 2017, Oren Shpigel wrote:

Hi,
I'm trying to use CGAL with clang++-3.8 and libc++.
I compiled boost, gmp and mpfr, and then compiled CGAL with them (all with
clang++-3.8 and libc++).
But when linking my own program with CGAL I get the following error:

//usr/local/lib/libCGAL.so: undefined reference to
`std::__1::basic_istream<char, std::__1::char_traits<char>
::operator>>(std::__1::basic_istream<char, std::__1::char_traits<char> >&
(*)(std::__1::basic_istream<char, std::__1::char_traits<char> >&))'

In the CGAL website I saw that CGAL supports clang 3.5 and 3.6.2.
Do I get this error because clang 3.8 isn't supported?

No.

What has changed? Is there something I can do to use it?
Or any other idea about this linker error?

Did you link you program with libc++? It usually helps answering questions when we can actually see the command producing the error message, and the full message...

--
Marc Glisse

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss



Reply | Threaded
Open this post in threaded view
|

Re: Compile CGAL with clang++-3.8 and libc++

Oren Shpigel
Hi again, 
I tried compiling everything again with the correct flags, and I still get this error when linking my code to CGAL:

# clang++-3.8 -o build/release/my_output_file -stdlib=libc++ -lc++ my_code_stuff -lCGAL -lCGAL_Core -lprofiler -ltcmalloc -lgtest -lpthread -lboost_date_time -lboost_filesystem -lcurl -ljson -lz -lboost_system -lprotobuf -lglog -lgflags -lblas -llapack
//usr/local/lib/libCGAL.so: undefined reference to `std::__1::basic_istream<char, std::__1::char_traits<char> >::operator>>(std::__1::basic_istream<char, std::__1::char_traits<char> >& (*)(std::__1::basic_istream<char, std::__1::char_traits<char> >&))'
//usr/local/lib/libCGAL.so: undefined reference to `std::__1::basic_istream<char, std::__1::char_traits<char> >::operator>>(std::__1::basic_istream<char, std::__1::char_traits<char> >& (*)(std::__1::basic_istream<char, std::__1::char_traits<char> >&))'

When checking my CGAL's dependencies it looks good, no libstdc++ anywhere:
# ldd -r /usr/local/lib/libCGAL.so 
linux-vdso.so.1 =>  (0x00007fff3f2ae000)
libmpfr.so.4 => /usr/local/lib/libmpfr.so.4 (0x00007f77e491f000)
libgmp.so.10 => /usr/local/lib/libgmp.so.10 (0x00007f77e46a9000)
libboost_thread.so.1.55.0 => /usr/local/lib/libboost_thread.so.1.55.0 (0x00007f77e448f000)
libboost_system.so.1.55.0 => /usr/local/lib/libboost_system.so.1.55.0 (0x00007f77e428b000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f77e406d000)
libc++.so.1 => /usr/lib/libc++.so.1 (0x00007f77e3d15000)
libc++abi.so.1 => /usr/lib/libc++abi.so.1 (0x00007f77e3aa0000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f77e379a000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f77e3584000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f77e31bf000)
/lib64/ld-linux-x86-64.so.2 (0x00007f77e4da6000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f77e2fb7000)
undefined symbol: _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsEPFRS3_S4_E (/usr/local/lib/libCGAL.so)

But again, also ldd says this same undefined symbol:
# c++filt _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsEPFRS3_S4_E
std::__1::basic_istream<char, std::__1::char_traits<char> >::operator>>(std::__1::basic_istream<char, std::__1::char_traits<char> >& (*)(std::__1::basic_istream<char, std::__1::char_traits<char> >&))

Anyone has any idea about why it's missing? Or what is using it?
Has anyone ever compiled CGAL 4.8 with clang 3.8 and libc++?

Thanks!
Oren

On Mon, Jan 30, 2017 at 2:43 AM Pádraig Ó Conbhuí <[hidden email]> wrote:
Hi Oren,

This sounds like an error between one library looking for libc++ and another looking for libstdc++. Using -std=c++11 can cause libc++ to link unless you explicitly pass -stdlib=libstdc++ (not certain if libstdc++ or just stdc++). So differences in compiler flags between gmp, mpfr, boost and cgal and the c++ library they're linking is probably the problem. And since it's c++, probably just boost and cgal. Try passing -std=c++11 -stdlib=libc++ to both boost and cgal during compile.

Cheers,
Paddy

On Sun, Jan 29, 2017 at 5:43 PM, Marc Glisse <[hidden email]> wrote:
On Sun, 29 Jan 2017, Oren Shpigel wrote:

Hi,
I'm trying to use CGAL with clang++-3.8 and libc++.
I compiled boost, gmp and mpfr, and then compiled CGAL with them (all with
clang++-3.8 and libc++).
But when linking my own program with CGAL I get the following error:

//usr/local/lib/libCGAL.so: undefined reference to
`std::__1::basic_istream<char, std::__1::char_traits<char>
::operator>>(std::__1::basic_istream<char, std::__1::char_traits<char> >&
(*)(std::__1::basic_istream<char, std::__1::char_traits<char> >&))'

In the CGAL website I saw that CGAL supports clang 3.5 and 3.6.2.
Do I get this error because clang 3.8 isn't supported?

No.

What has changed? Is there something I can do to use it?
Or any other idea about this linker error?

Did you link you program with libc++? It usually helps answering questions when we can actually see the command producing the error message, and the full message...

--
Marc Glisse

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss



Reply | Threaded
Open this post in threaded view
|

Re: Compile CGAL with clang++-3.8 and libc++

Marc Glisse
On Tue, 31 Jan 2017, Oren Shpigel wrote:

> Hi again,
> I tried compiling everything again with the correct flags, and I still get
> this error when linking my code to CGAL:
>
> # clang++-3.8 -o build/release/my_output_file -stdlib=libc++
> -lc++ my_code_stuff -lCGAL -lCGAL_Core -lprofiler -ltcmalloc -lgtest

Better put -lc++ much later in the command line, but clang already adds
one anyway.

> -lpthread -lboost_date_time -lboost_filesystem -lcurl -ljson -lz
> -lboost_system -lprotobuf -lglog -lgflags -lblas -llapack
> //usr/local/lib/libCGAL.so: undefined reference to
> `std::__1::basic_istream<char, std::__1::char_traits<char>
>> ::operator>>(std::__1::basic_istream<char, std::__1::char_traits<char> >&
> (*)(std::__1::basic_istream<char, std::__1::char_traits<char> >&))'
> //usr/local/lib/libCGAL.so: undefined reference to
> `std::__1::basic_istream<char, std::__1::char_traits<char>
>> ::operator>>(std::__1::basic_istream<char, std::__1::char_traits<char> >&
> (*)(std::__1::basic_istream<char, std::__1::char_traits<char> >&))'
>
> When checking my CGAL's dependencies it looks good, no libstdc++ anywhere:
> # ldd -r /usr/local/lib/libCGAL.so
> linux-vdso.so.1 =>  (0x00007fff3f2ae000)
> libmpfr.so.4 => /usr/local/lib/libmpfr.so.4 (0x00007f77e491f000)
> libgmp.so.10 => /usr/local/lib/libgmp.so.10 (0x00007f77e46a9000)
> libboost_thread.so.1.55.0 => /usr/local/lib/libboost_thread.so.1.55.0
> (0x00007f77e448f000)
> libboost_system.so.1.55.0 => /usr/local/lib/libboost_system.so.1.55.0
> (0x00007f77e428b000)
> libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
> (0x00007f77e406d000)
> libc++.so.1 => /usr/lib/libc++.so.1 (0x00007f77e3d15000)
> libc++abi.so.1 => /usr/lib/libc++abi.so.1 (0x00007f77e3aa0000)
> libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f77e379a000)
> libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f77e3584000)
> libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f77e31bf000)
> /lib64/ld-linux-x86-64.so.2 (0x00007f77e4da6000)
> librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f77e2fb7000)
> undefined symbol:
> _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsEPFRS3_S4_E
> (/usr/local/lib/libCGAL.so)
>
> But again, also ldd says this same undefined symbol:
> # c++filt _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsEPFRS3_S4_E
> std::__1::basic_istream<char, std::__1::char_traits<char>
>> ::operator>>(std::__1::basic_istream<char, std::__1::char_traits<char> >&
> (*)(std::__1::basic_istream<char, std::__1::char_traits<char> >&))

nm -D /usr/lib/x86_64-linux-gnu/libc++.so.1|grep _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsEPFRS3_S4_E
000000000009f784 W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsEPFRS3_S4_E

This symbol is provided by libc++ here...

> Anyone has any idea about why it's missing? Or what is using it?
> Has anyone ever compiled CGAL 4.8 with clang 3.8 and libc++?

Just tried CGAL-4.9 with CXX='clang++-3.8 -stdlib=libc++' and it is
working fine. I expect the issue is with your installation of clang or
libc++, not with CGAL.

--
Marc Glisse

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Compile CGAL with clang++-3.8 and libc++

Oren Shpigel
Thanks for the reply!

I'm using CGAL 4.8, not 4.9 yet. Can this be the issue?

Also, I checked your command on my environment and it returned empty:
# nm -D /usr/lib/x86_64-linux-gnu/libc++.so.1|grep _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsEPFRS3_S4_E

I compiled the libc++ from here: http://libcxx.llvm.org/docs/BuildingLibcxx.html, but used tag RELEASE_380 instead of trunk.
Where's your libc++ from? Different version/form?

Thanks, 
Oren

On Tue, Jan 31, 2017 at 5:31 PM Marc Glisse <[hidden email]> wrote:
On Tue, 31 Jan 2017, Oren Shpigel wrote:

> Hi again,
> I tried compiling everything again with the correct flags, and I still get
> this error when linking my code to CGAL:
>
> # clang++-3.8 -o build/release/my_output_file -stdlib=libc++
> -lc++ my_code_stuff -lCGAL -lCGAL_Core -lprofiler -ltcmalloc -lgtest

Better put -lc++ much later in the command line, but clang already adds
one anyway.

> -lpthread -lboost_date_time -lboost_filesystem -lcurl -ljson -lz
> -lboost_system -lprotobuf -lglog -lgflags -lblas -llapack
> //usr/local/lib/libCGAL.so: undefined reference to
> `std::__1::basic_istream<char, std::__1::char_traits<char>
>> ::operator>>(std::__1::basic_istream<char, std::__1::char_traits<char> >&
> (*)(std::__1::basic_istream<char, std::__1::char_traits<char> >&))'
> //usr/local/lib/libCGAL.so: undefined reference to
> `std::__1::basic_istream<char, std::__1::char_traits<char>
>> ::operator>>(std::__1::basic_istream<char, std::__1::char_traits<char> >&
> (*)(std::__1::basic_istream<char, std::__1::char_traits<char> >&))'
>
> When checking my CGAL's dependencies it looks good, no libstdc++ anywhere:
> # ldd -r /usr/local/lib/libCGAL.so
> linux-vdso.so.1 =>  (0x00007fff3f2ae000)
> libmpfr.so.4 => /usr/local/lib/libmpfr.so.4 (0x00007f77e491f000)
> libgmp.so.10 => /usr/local/lib/libgmp.so.10 (0x00007f77e46a9000)
> libboost_thread.so.1.55.0 => /usr/local/lib/libboost_thread.so.1.55.0
> (0x00007f77e448f000)
> libboost_system.so.1.55.0 => /usr/local/lib/libboost_system.so.1.55.0
> (0x00007f77e428b000)
> libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
> (0x00007f77e406d000)
> libc++.so.1 => /usr/lib/libc++.so.1 (0x00007f77e3d15000)
> libc++abi.so.1 => /usr/lib/libc++abi.so.1 (0x00007f77e3aa0000)
> libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f77e379a000)
> libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f77e3584000)
> libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f77e31bf000)
> /lib64/ld-linux-x86-64.so.2 (0x00007f77e4da6000)
> librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f77e2fb7000)
> undefined symbol:
> _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsEPFRS3_S4_E
> (/usr/local/lib/libCGAL.so)
>
> But again, also ldd says this same undefined symbol:
> # c++filt _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsEPFRS3_S4_E
> std::__1::basic_istream<char, std::__1::char_traits<char>
>> ::operator>>(std::__1::basic_istream<char, std::__1::char_traits<char> >&
> (*)(std::__1::basic_istream<char, std::__1::char_traits<char> >&))

nm -D /usr/lib/x86_64-linux-gnu/libc++.so.1|grep _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsEPFRS3_S4_E
000000000009f784 W _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsEPFRS3_S4_E

This symbol is provided by libc++ here...

> Anyone has any idea about why it's missing? Or what is using it?
> Has anyone ever compiled CGAL 4.8 with clang 3.8 and libc++?

Just tried CGAL-4.9 with CXX='clang++-3.8 -stdlib=libc++' and it is
working fine. I expect the issue is with your installation of clang or
libc++, not with CGAL.

--
Marc Glisse

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Reply | Threaded
Open this post in threaded view
|

Re: Compile CGAL with clang++-3.8 and libc++

Marc Glisse
On Tue, 31 Jan 2017, Oren Shpigel wrote:

> I'm using CGAL 4.8, not 4.9 yet. Can this be the issue?

No.

> Also, I checked your command on my environment and it returned empty:
> # nm -D /usr/lib/x86_64-linux-gnu/libc++.so.1|grep
> _ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsEPFRS3_S4_E

From your previous email, it sounded like you had a libc++ in /usr/lib.
Apparently you have a second one in /usr/lib/x86_64-linux-gnu. You may
also have 2 versions of the headers. I suspect that you are using the
headers from one version and the library from the other one, although I
thought the interface of libc++ was quite stable.

> I compiled the libc++ from here:
> http://libcxx.llvm.org/docs/BuildingLibcxx.html, but used tag RELEASE_380
> instead of trunk.
> Where's your libc++ from? Different version/form?

Mine is the package in Debian (testing).

--
Marc Glisse

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss