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 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.
Home |
Main Index |
Thread Index |
Old Index