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

recompile with -fPIC #1495

Closed
rhyek opened this issue Jul 7, 2018 · 1 comment
Closed

recompile with -fPIC #1495

rhyek opened this issue Jul 7, 2018 · 1 comment

Comments

@rhyek
Copy link

rhyek commented Jul 7, 2018

  • Node Version: node 9.11.2 npm 6.1.0
  • Platform: Linux carlos-ubuntu 4.15.0-24-generic Overriding default flags #26-Ubuntu SMP Wed Jun 13 08:44:47 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
  • Compiler: Using built-in specs. COLLECT_GCC=cc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.3.0-16ubuntu3' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --with-as=/usr/bin/x86_64-linux-gnu-as --with-ld=/usr/bin/x86_64-linux-gnu-ld --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 7.3.0 (Ubuntu 7.3.0-16ubuntu3)
  • Module: custom
Verbose output (from npm or node-gyp):
> $(npm bin)/electron-rebuild

✖ Rebuild Failed

An unhandled error occurred inside electron-rebuild
make: Entering directory '/home/carlos/dev/carlos-cerrato/tokenpay-help/efin/build'
  CXX(target) Release/obj.target/coin_sign/coin_sign/main.o
  SOLINK_MODULE(target) Release/obj.target/coin_sign.node
/usr/bin/x86_64-linux-gnu-ld: /home/carlos/dev/carlos-cerrato/tokenpay-help/efin/coin_sign/libcoin_sign.a(coin-sign.cpp.o): relocation R_X86_64_PC32 against symbol `_ZN16CBaseChainParams4MAINB5cxx11E'can not be used when making a shared object; recompile with -fPIC
/usr/bin/x86_64-linux-gnu-ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
coin_sign.target.mk:134: recipe for target 'Release/obj.target/coin_sign.node' failed
make: *** [Release/obj.target/coin_sign.node] Error 1
make: Leaving directory '/home/carlos/dev/carlos-cerrato/tokenpay-help/efin/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/carlos/dev/carlos-cerrato/tokenpay-help/efin/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:180:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
gyp ERR! System Linux 4.15.0-24-generic
gyp ERR! command "/usr/bin/node" "/home/carlos/dev/carlos-cerrato/tokenpay-help/efin/node_modules/.bin/node-gyp" "rebuild" "--target=2.0.0" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source"
gyp ERR! cwd /home/carlos/dev/carlos-cerrato/tokenpay-help/efin
gyp ERR! node -v v9.11.2
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok

Failed with exit code: 1

Error: make: Entering directory '/home/carlos/dev/carlos-cerrato/tokenpay-help/efin/build'
  CXX(target) Release/obj.target/coin_sign/coin_sign/main.o
  SOLINK_MODULE(target) Release/obj.target/coin_sign.node
/usr/bin/x86_64-linux-gnu-ld: /home/carlos/dev/carlos-cerrato/tokenpay-help/efin/coin_sign/libcoin_sign.a(coin-sign.cpp.o): relocation R_X86_64_PC32 against symbol `_ZN16CBaseChainParams4MAINB5cxx11E'can not be used when making a shared object; recompile with -fPIC
/usr/bin/x86_64-linux-gnu-ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
coin_sign.target.mk:134: recipe for target 'Release/obj.target/coin_sign.node' failed
make: *** [Release/obj.target/coin_sign.node] Error 1
make: Leaving directory '/home/carlos/dev/carlos-cerrato/tokenpay-help/efin/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/carlos/dev/carlos-cerrato/tokenpay-help/efin/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:180:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
gyp ERR! System Linux 4.15.0-24-generic
gyp ERR! command "/usr/bin/node" "/home/carlos/dev/carlos-cerrato/tokenpay-help/efin/node_modules/.bin/node-gyp" "rebuild" "--target=2.0.0" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source"
gyp ERR! cwd /home/carlos/dev/carlos-cerrato/tokenpay-help/efin
gyp ERR! node -v v9.11.2
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok

Failed with exit code: 1
    at SafeSubscriber._error (/home/carlos/dev/carlos-cerrato/tokenpay-help/efin/node_modules/spawn-rx/lib/src/index.js:277:84)
    at SafeSubscriber.__tryOrUnsub (/home/carlos/dev/carlos-cerrato/tokenpay-help/efin/node_modules/rxjs/Subscriber.js:242:16)
    at SafeSubscriber.error (/home/carlos/dev/carlos-cerrato/tokenpay-help/efin/node_modules/rxjs/Subscriber.js:201:26)
    at Subscriber._error (/home/carlos/dev/carlos-cerrato/tokenpay-help/efin/node_modules/rxjs/Subscriber.js:132:26)
    at Subscriber.error (/home/carlos/dev/carlos-cerrato/tokenpay-help/efin/node_modules/rxjs/Subscriber.js:106:18)
    at MapSubscriber.Subscriber._error (/home/carlos/dev/carlos-cerrato/tokenpay-help/efin/node_modules/rxjs/Subscriber.js:132:26)
    at MapSubscriber.Subscriber.error (/home/carlos/dev/carlos-cerrato/tokenpay-help/efin/node_modules/rxjs/Subscriber.js:106:18)
    at SafeSubscriber._next (/home/carlos/dev/carlos-cerrato/tokenpay-help/efin/node_modules/spawn-rx/lib/src/index.js:251:65)
    at SafeSubscriber.__tryOrSetError (/home/carlos/dev/carlos-cerrato/tokenpay-help/efin/node_modules/rxjs/Subscriber.js:251:16)
    at SafeSubscriber.next (/home/carlos/dev/carlos-cerrato/tokenpay-help/efin/node_modules/rxjs/Subscriber.js:191:27)
npm ERR! code ELIFECYCLE
npm ERR! errno 255
npm ERR! electron-quick-start@1.0.0 build: `rm -rf build && $(npm bin)/electron-rebuild`
npm ERR! Exit status 255
npm ERR!
npm ERR! Failed at the electron-quick-start@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/carlos/.npm/_logs/2018-07-07T16_39_35_480Z-debug.log

this is my binding.gyp contents:

{
  "targets": [{
    "target_name": "coin_sign",
    "sources": [ "./coin_sign/main.cpp" ],
    "cflags": ["-w", "-fpermissive", "-fPIC"],
    "libraries": [
      "/home/carlos/dev/carlos-cerrato/tokenpay-help/efin/coin_sign/libcoin_sign.a"
    ]
    # "link_settings": {
    #   "libraries": [
    #     "-lcoin_sign"
    #   ]
    # }
  }]
}
@rhyek
Copy link
Author

rhyek commented Jul 7, 2018

The -fPIC compiler option was needed when compiling the lib I'm including here.

@rhyek rhyek closed this as completed Jul 7, 2018
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