pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CPPFLAGS in textproc/tree-sitter/grammar.mk



Hello,

I just installed pkgsrc stable on macOS and tried to build editors/emacs. That failed in textproc/tree-sitter-yaml with the error:

libtool: compile:  clang++ -O2 -fpic -Os -fno-delete-null-pointer-checks -fno-strict-aliasing -fwrapv -stdlib=libc++ -I. -c -fPIC scanner.cc  -DPIC -o .libs/scanner.o
scanner.cc:2:10: fatal error: 'vector' file not found
    2 | #include <vector>
      |          ^~~~~~~~

This is because textproc/tree-sitter/grammar.mk does not use CPPFLAGS, which I have defined in etc/mk.conf as follows:

.if ${OPSYS} == "Darwin"
SDKROOT!=                               xcrun --sdk macosx --show-sdk-path
OSX_SDK_PATH=                   ${SDKROOT}
CLANGBASE=                              ${SDKROOT}/usr
CC!=                                    xcrun --find clang
CXX!=                                   xcrun --find clang++
CPPFLAGS+=                              -isystem ${SDKROOT}/usr/include
CPPFLAGS+=                              -isystem ${SDKROOT}/usr/include/c++/v1
CXXFLAGS+=                              -stdlib=libc++
.endif

The solution was to edit grammar.mk and change:

    libtool --mode=compile ${CC} ${CFLAGS} ...
    libtool --mode=compile ${CXX} ${CXXFLAGS} ...

to 

    libtool --mode=compile ${CC} ${CPPFLAGS} ${CFLAGS} ...
    libtool --mode=compile ${CXX} ${CPPFLAGS} ${CXXFLAGS} ...




Home | Main Index | Thread Index | Old Index