NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: string_view and clang
On Fri, Jun 08, 2018 at 06:37:47PM +0200, Kamil Rytarowski wrote:
> On 08.06.2018 17:04, Patrick Welche wrote:
> > According to
> >
> > http://en.cppreference.com/w/cpp/compiler_support
> >
> > string_view is supported by gcc 7 and clang 4.0. As in NetBSD-current
> > base we have gcc 6.4.0 and clang 5.0.1, I thought I would try it out:
> >
> > $ clang -std=c++17 -o foo foo.cpp
> > foo.cpp:3:10: fatal error: 'string_view' file not found
> > #include <string_view>
> > ^~~~~~~~~~~~~
> > 1 error generated.
> >
> > Is the page over optimistic, or do I need more flags on my compile line?
> > (Guessing that /usr/include has the gcc include files...)
> >
>
> We ship with an old version of libc++ in base.
>
> If you are using a LLVM style Please try to include it with
> <experimental/string_view>.
>
> I'm working right now on getting HEAD libc++ to work on NetBSD.
Great news!
In the meantime, to try things out, I installed pkgsrc/lang/gcc8 and see:
$ make
rm -f .gdbinit
touch .gdbinit
# compile ts/net.o
c++ -O2 -fPIE -Werror -std=c++14 -fPIC -I/usr/src/local/networking-ts-impl/include -c net.cpp
# link ts/net
c++ -lpthread -pie -shared-libgcc -o net net.o -Wl,-rpath-link,/lib -L=/lib
/usr/bin/ld: /usr/pkg/gcc8/lib/gcc/x86_64--netbsd/8.1.0/crtbegin.o: relocation R_X86_64_32 against hidden symbol `__TMC_END__' can not be used when making a shared object
/usr/bin/ld: /usr/pkg/gcc8/lib/gcc/x86_64--netbsd/8.1.0/crtend.o: relocation R_X86_64_32 against `.ctors' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
I randomly added a -fPIC as the message suggests, so used the following
Makefile for the above:
$ cat Makefile
PROG_CXX=net
MKRELRO=no
CPPFLAGS+=-I/usr/src/local/networking-ts-impl/include
CXXFLAGS+=-std=c++14 -fPIC
LDFLAGS+=-lpthread
#-lstdc++fs
MKMAN=no
.include <bsd.prog.mk>
Cheers,
Patrick
Home |
Main Index |
Thread Index |
Old Index