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 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.


Home | Main Index | Thread Index | Old Index