Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

c++ called by gyp on macos don't respect cflags. #273

Open
Freed-Wu opened this issue Dec 5, 2024 · 0 comments
Open

c++ called by gyp on macos don't respect cflags. #273

Freed-Wu opened this issue Dec 5, 2024 · 0 comments

Comments

@Freed-Wu
Copy link

Freed-Wu commented Dec 5, 2024

I have a project which needs pkg-config --cflags rime so I add

            "cflags": [
                "<!@(pkg-config --cflags rime)",
            ],

to binding.gyp

In linux, it work well. make -Cbuild V=1 tell:

  g++ -o Release/obj.target/rime/binding.o ../binding.cc '-DNODE_GYP_MODULE_NAME=rime' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DNAPI_DISABLE_CPP_EXCEPTIONS' '-DNODE_ADDON_API_DISABLE_DEPRECATED' '-DBUILDING_NODE_EXTENSION' -I/home/wzy/.cache/node-gyp/20.18.0/include/node -I/home/wzy/.cache/node-gyp/20.18.0/src -I/home/wzy/.cache/node-gyp/20.18.0/deps/openssl/config -I/home/wzy/.cache/node-gyp/20.18.0/deps/openssl/openssl/include -I/home/wzy/.cache/node-gyp/20.18.0/deps/uv/include -I/home/wzy/.cache/node-gyp/20.18.0/deps/zlib -I/home/wzy/.cache/node-gyp/20.18.0/deps/v8/include -I/home/wzy/Desktop/coc-rime/node_modules/node-addon-api  -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -I/nix/store/r4d1aphfpvpfj9g2lw6qsnxz42adfc61-librime-1.12.0/include -m64 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++17 -MMD -MF ./Release/.deps/Release/obj.target/rime/binding.o.d.raw   -c

where pkg-config --cflags rime is -I/nix/store/r4d1aphfpvpfj9g2lw6qsnxz42adfc61-librime-1.12.0/include.

In macos, pkg-config can search rime, however, make -Cbuild V=1 don't use it.

c++ -o Release/obj.target/rime/binding.o ../binding.cc '-DNODE_GYP_MODULE_NAME=rime' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DNAPI_DISABLE_CPP_EXCEPTIONS' '-DNODE_ADDON_API_DISABLE_DEPRECATED' '-DBUILDING_NODE_EXTENSION' -I/Users/runner/Library/Caches/node-gyp/23.3.0/include/node -I/Users/runner/Library/Caches/node-gyp/23.3.0/src -I/Users/runner/Library/Caches/node-gyp/23.3.0/deps/openssl/config -I/Users/runner/Library/Caches/node-gyp/23.3.0/deps/openssl/openssl/include -I/Users/runner/Library/Caches/node-gyp/23.3.0/deps/uv/include -I/Users/runner/Library/Caches/node-gyp/23.3.0/deps/zlib -I/Users/runner/Library/Caches/node-gyp/23.3.0/deps/v8/include -I/Users/runner/work/coc-rime/coc-rime/node_modules/node-addon-api  -O3 -gdwarf-2 -fno-strict-aliasing -mmacosx-version-min=11.0 -arch arm64 -Wall -Wendif-labels -W -Wno-unused-parameter -std=gnu++20 -stdlib=libc++ -fno-rtti -fno-exceptions -MMD -MF ./Release/.deps/Release/obj.target/rime/binding.o.d.raw   -c
../binding.cc:2:10: fatal error: 'rime_api.h' file not found
#include <rime_api.h>
         ^~~~~~~~~~~~
1 error generated.

only add pkg-config --variables includedir rime to include_dirs can make it work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant