pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: How to force clang to use libc++?



‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

On Wednesday, June 30th, 2021 at 5:16 PM, hung.nguyengia <hung.nguyengia%protonmail.com@localhost> wrote:

> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
>
> On Wednesday, June 30th, 2021 at 4:51 PM, hung.nguyengia hung.nguyengia%protonmail.com@localhost wrote:
>
> > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> >
> > On Wednesday, June 30th, 2021 at 12:13 PM, hung.nguyengia hung.nguyengia%protonmail.com@localhost wrote:
> >
> > > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> > >
> > > On Wednesday, June 30th, 2021 at 2:23 AM, Joerg Sonnenberger joerg%bec.de@localhost wrote:
> > >
> > > > On Tue, Jun 29, 2021 at 05:53:38PM +0200, Tobias Nygren wrote:
> > > >
> > > > > On Tue, 29 Jun 2021 15:46:00 +0000
> > > > >
> > > > > "hung.nguyengia" hung.nguyengia%protonmail.com@localhost wrote:
> > > > >
> > > > > > I'm trying to use pkgsrc with clang as the compiler. Clang by default still uses libstdc++ as the standard library. I found I could force it to use libc++ with this line in mk.conf:
> > > > > >
> > > > > > CXXFLAGS+= -stdlib=libc++
> > > > > >
> > > > > > But lang/nodejs still fails to build. I found when compiling clang used libc++ headers so compilation when really straight forward but when linking it still default to link with libstdc++ so this cause the problem.
> > > > > >
> > > > > > What is the correct way to force clang to use libc++?
> > > > >
> > > > > These kind of system-wide options may be better suited in the compiler
> > > > >
> > > > > wrappers than CXXFLAGS:
> > > > >
> > > > > CWRAPPERS_APPEND.cxx+= -stdlib=libc++
> > > >
> > > > Correct.
> > > >
> > > > > If the package tries to link manually with ld(1) you may need this also:
> > > > >
> > > > > BUILDLINK_TRANSFORM+= l:stdc++:libc++
> > > >
> > > > clang does that automatically.
> > > >
> > > > Joerg
> > >
> > > Thanks everyone for help me. This seemed to work but the build of lang/nodejs still fails at the linking stage with this error:
> > >
> > > /usr/bin/x86_64-unknown-linux-gnu-ld: cannot find -latomic
> > >
> > > Any pointers would be appreciated.
> >
> > I rolled out my own version of clang using lang/clang and the linking stage still fails because of the same error:
> >
> > /usr/bin/ld: cannot find -latomic
>
> I think when using clang with libc++ we shouldn't link with libatomic at all because libatomic is of GCC. Clang has atomic implemented in compiler-rt as stated here: https://clang.llvm.org/docs/Toolchain.html#atomics-library
>
> Anyway I will try to install devel/libatomic to see if it could let lang/nodejs to build.

devel/libatomic seems to dislike clang:

=> Bootstrap dependency digest>=20010302: found digest-20190127
ERROR: This package has set PKG_SKIP_REASON:
ERROR: Uses esoteric GCC-specific features
*** Error code 1

Stop.
bmake: stopped in /home/hung/Downloads/pkgsrc/devel/libatomic

I resorted back to install the system's lib64atomic1 package. Unfortunately it still can't find -latomic even though I confirm will you it's there:

/usr/lib64/libatomic.so.1
/usr/lib64/libatomic.so.1.1.0

which the former is a symlink to the later.


Home | Main Index | Thread Index | Old Index