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++?



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


Home | Main Index | Thread Index | Old Index