nodejs / nodejs/node-gyp

Link static library(.a) using --no-pie

Open
#2,175 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.7k
Forks
1.9k
Avg merge
1d 4h
Merged PRs (30d)
5

Description

I need to link static library(.a) in binding.gyp but when I use "ldflags":["-no-pie"] I get below error
Release/obj.target/cakserver/fileprocess.o: In function Napi::AsyncWorker::OnWorkComplete(Napi::Env, napi_status)': fileprocess.cc:(.text._ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status[_ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status]+0x19b9): undefined reference to napi_get_and_clear_last_exception'
fileprocess.cc:(.text._ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status[_ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status]+0x19dd): undefined reference to napi_create_type_error' fileprocess.cc:(.text._ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status[_ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status]+0x1a04): undefined reference to napi_create_type_error'
fileprocess.cc:(.text._ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status[_ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status]+0x1a1a): undefined reference to napi_create_type_error' fileprocess.cc:(.text._ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status[_ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status]+0x1a41): undefined reference to napi_create_type_error'
fileprocess.cc:(.text._ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status[_ZN4Napi11AsyncWorker14OnWorkCompleteENS_3EnvE11napi_status]+0x1a57): undefined reference to `napi_create_type_error'

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with binding.gyp and the fileprocess.cc linker errors, then reproduce the build using the reported -no-pie flag to inspect how the static library and Node-API symbols are linked. Done means the addon links successfully with the static library and no undefined napi_* references remain.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, nodejs
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.