0

I'm trying to compile a program with clang++ and libc++ on NetBSD. Clang version is 3.9.0, and NetBSD version is 7.0.2. The compile is failing with:

$ make
clang++  -D_NETBSD_SOURCE -m64 -pthread -stdlib=libc++ -fPIC -fvisibility=hidden \
  -std=c++11 -D_REENTRANT -O3 -Wall -Ibuild/include -c ./src/lib/asn1/alg_id.cpp \
  -o build/obj/lib/asn1_alg_id.o
In file included from ./src/lib/asn1/alg_id.cpp:8:
In file included from build/include/botan/alg_id.h:11:
In file included from build/include/botan/asn1_obj.h:11:
In file included from build/include/botan/secmem.h:11:
In file included from build/include/botan/mem_ops.h:11:
build/include/botan/types.h:14:10: fatal error: 'cstddef' file not found
#include <cstddef>
         ^
1 error generated.
*** Error code 1

<cstddef> is present, but it appears to be GCC's:

$ find /usr -name cstddef
/usr/include/g++/cstddef

If I am parsing Index of pub/NetBSD/NetBSD-release-7/src/external/bsd/libc++ correctly, the library is available. When I attempt to install libc++ or libcxx:

bash-4.4$ sudo PKG_PATH="http://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/`uname -m`/`uname -r`/All/" pkg_add libcxx
pkg_add: no pkg found for 'libcxx', sorry.
pkg_add: 1 package addition failed
bash-4.4$ sudo PKG_PATH="http://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/`uname -m`/`uname -r`/All/" pkg_add libc++
pkg_add: no pkg found for 'libc++', sorry.
pkg_add: 1 package addition failed

Is Clang with libc++ a supported configuration on NetBSD? How do we use Clang and libc++ on NetBSD?

jww
  • 97,681
  • 90
  • 411
  • 885

1 Answers1

1

Libc++ is supported on NetBSD (Although it's not regularly tested). Unfortunately I'm not sure what package provides it (if any).

One alternative would be to build and install libc++ from source. Clang will search its own prefix for the libc++ headers first and /usr/local/include/c++/v1 second, so you'll want to install libc++ in one of those two locations (e.g -DCMAKE_INSTALL_PREFIX=/usr/local) .

EricWF
  • 1,005
  • 7
  • 8