Open mauroballestra opened 3 years ago
The relevant generator is https://github.com/nodejs/node-gyp/blob/ee6a837cb71f465c0e689a81b4adc784bdf8a0c7/gyp/pylib/gyp/generator/make.py#L223-L238
Maybe as a workaround you could try setting AR_target
to something like $(AR) --target=aixcoff-rs6000
? https://github.com/nodejs/node-gyp/blob/ee6a837cb71f465c0e689a81b4adc784bdf8a0c7/gyp/pylib/gyp/generator/make.py#L2291
cc @nodejs/platform-aix
FYI, I tested on IBM i 7.3 (variant of AIX 7.1 TL4) with node 14.11.0 and the build was successful.
We need to proceed with caution because I don't believe the IBM i ar
command supports --target
. We will need to do testing/verification.
@ThePrez,
thank you for checking. In fact I've tried with the IBM XLC toolchain but with that I'm unable to reach the AR phase.
Output:
gmake: Entering directory '/home/fctech/Mauro/test/node_modules/ref-napi/build' CC(target) Release/obj.target/nothing/../node-addon-api/src/nothing.o cc: 1501-289 (W) Option -Wall was incorrectly specified. The option will be ignored. cc: 1501-289 (W) Option -Wextra was incorrectly specified. The option will be ignored. cc: 1501-289 (W) Option -Wno-unused-parameter was incorrectly specified. The option will be ignored. cc: 1501-289 (W) Option -Wno-attributes was incorrectly specified. The option will be ignored. cc: 1501-210 (W) command option t contains an incorrect subargument cc: 1501-216 (W) command option -64 is not recognized - passed to ld cc: 1501-208 (S) command option D is missing a subargument gmake: *** [../node-addon-api/src/nothing.target.mk:108: Release/obj.target/nothing/../node-addon-api/src/nothing.o] Error 40 gmake: Leaving directory '/home/fctech/Mauro/test/node_modules/ref-napi/build'
Anyways you are correct as IBM ar doesn't support --target switch.
May I ask you which version of IBM XLC did you used to build?
@ThePrez,
thanks to your suggestion I've been able to setup an environment where I use gcc as compiler and IBM ar as archiver. In this case the build is successful for me but I'm still unsure which toolchain I am expected to use to build with node-gyp on AIX.
@ThePrez,
thanks to your suggestion I've been able to setup an environment where I use gcc as compiler and IBM ar as archiver. In this case the build is successful for me but I'm still unsure which toolchain I am expected to use to build with node-gyp on AIX.
I can't give an official answer, but given that the supported platforms page for Node calls out GCC 6 as what's used for the platform builds, I would guess GCC is the expected norm, at minimum.
May I ask you which version of IBM XLC did you used to build?
I used gcc 6.3.0
FYI, I tested on IBM i 7.3 (variant of AIX 7.1 TL4) with node 14.11.0 and the build was successful. We need to proceed with caution because I don't believe the IBM i
ar
command supports--target
. We will need to do testing/verification.
Just thought I'd mention that the native
ar on AIX does not support --target
either. Feels like coreutils
are added, and in the PATH.
I've never tried to do this build - have some other priorities this week - but I'll see about what I can do independently of the current test machines and try and figure out why AR should have an affect on anything.
Have you tried not using the X32_64 argument. By default AIX is in 32-bit mode, and to swap to 64-bit mode just use:
# export OBJECT_MODE=64
And all the supporting tools know that mode -X64 is in effect. (and when unset -X32 is effective the option set).
Verbose output (from npm or node-gyp):
``` $ npm install ref-napi --loglevel verbose npm info it worked if it ends with ok npm verb cli [ npm verb cli '/home/fctech/Mauro/node-v14.15.0-aix-ppc64/bin/node', npm verb cli '/home/fctech/Mauro/node-v14.15.0-aix-ppc64/bin/npm', npm verb cli 'install', npm verb cli 'ref-napi', npm verb cli '--loglevel', npm verb cli 'verbose' npm verb cli ] npm info using npm@6.14.8 npm info using node@v14.15.0 npm verb npm-session 2f61aed209eead82 npm http fetch GET 304 https://registry.npmjs.org/ref-napi 1158ms (from cache) npm timing stage:loadCurrentTree Completed in 1402ms npm timing stage:loadIdealTree:cloneCurrentTree Completed in 1ms npm timing stage:loadIdealTree:loadShrinkwrap Completed in 1ms npm http fetch GET 304 https://registry.npmjs.org/node-gyp-build 207ms (from cache) npm http fetch GET 304 https://registry.npmjs.org/node-addon-api 279ms (from cache) npm http fetch GET 304 https://registry.npmjs.org/debug 347ms (from cache) npm http fetch GET 304 https://registry.npmjs.org/get-symbol-from-current-process-h 1029ms (from cache) npm http fetch GET 304 https://registry.npmjs.org/ms 98ms (from cache) npm timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 1187ms npm timing stage:loadIdealTree Completed in 1205ms npm timing stage:generateActionsToTake Completed in 19ms npm verb correctMkdir /home/fctech/.npm/_locks correctMkdir not in flight; initializing npm verb lock using /home/fctech/.npm/_locks/staging-79bd5c4ad4d29246.lock for /home/fctech/Mauro/test/node_modules/.staging npm timing audit submit Completed in 319ms npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/audits/quick 319ms npm timing audit body Completed in 3ms npm timing action:extract Completed in 1089ms npm timing action:finalize Completed in 49ms npm timing action:refresh-package-json Completed in 163ms npm info lifecycle ms@2.1.2~preinstall: ms@2.1.2 npm info lifecycle debug@4.2.0~preinstall: debug@4.2.0 npm info lifecycle get-symbol-from-current-process-h@1.0.2~preinstall: get-symbol-from-current-process-h@1.0.2 npm info lifecycle node-addon-api@2.0.2~preinstall: node-addon-api@2.0.2 npm info lifecycle node-gyp-build@4.2.3~preinstall: node-gyp-build@4.2.3 npm info lifecycle ref-napi@3.0.1~preinstall: ref-napi@3.0.1 npm timing action:preinstall Completed in 8ms npm info linkStuff ms@2.1.2 npm info linkStuff debug@4.2.0 npm info linkStuff get-symbol-from-current-process-h@1.0.2 npm info linkStuff node-addon-api@2.0.2 npm info linkStuff node-gyp-build@4.2.3 npm verb linkBins [ npm verb linkBins { npm verb linkBins 'node-gyp-build': 'bin.js', npm verb linkBins 'node-gyp-build-optional': 'optional.js', npm verb linkBins 'node-gyp-build-test': 'build-test.js' npm verb linkBins }, npm verb linkBins '/home/fctech/Mauro/test/node_modules/.bin', npm verb linkBins false npm verb linkBins ] npm info linkStuff ref-napi@3.0.1 npm timing action:build Completed in 49ms npm info lifecycle ms@2.1.2~install: ms@2.1.2 npm info lifecycle debug@4.2.0~install: debug@4.2.0 npm info lifecycle get-symbol-from-current-process-h@1.0.2~install: get-symbol-from-current-process-h@1.0.2 npm info lifecycle node-addon-api@2.0.2~install: node-addon-api@2.0.2 npm info lifecycle node-gyp-build@4.2.3~install: node-gyp-build@4.2.3 npm info lifecycle ref-napi@3.0.1~install: ref-napi@3.0.1 > ref-napi@3.0.1 install /home/fctech/Mauro/test/node_modules/ref-napi > node-gyp-build /home/fctech/Mauro/test/node_modules/node-gyp-build/index.js:59 throw new Error('No native build was found for ' + target + '\n loaded from: ' + dir + '\n') ^ Error: No native build was found for platform=aix arch=ppc64 runtime=node abi=83 uv=1 libc=glibc node=14.15.0 loaded from: /home/fctech/Mauro/test/node_modules/ref-napi at Function.load.path (/home/fctech/Mauro/test/node_modules/node-gyp-build/index.js:59:9) at load (/home/fctech/Mauro/test/node_modules/node-gyp-build/index.js:21:30) at Object.As suggested by the ref-napi developer (see issue 48) I wish to report the following issue I get when building the native part of ref-napi on AIX 7.1 PPC 64bit:
CC(target) Release/obj.target/nothing/../node-addon-api/src/nothing.o AR(target) Release/obj.target/../node-addon-api/src/nothing.a COPY Release/nothing.a CXX(target) Release/obj.target/binding/src/binding.o SOLINK_MODULE(target) Release/obj.target/binding.node collect2: fatal error: Release/obj.target/../node-addon-api/src/nothing.a: not a COFF file
It's relatively easy to fix the issue in the Makefile by changing the AR archive command from:
cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) -X32_64 crs $@ $(filter %.o,$^)
tocmd_alink = rm -f $@ && $(AR.$(TOOLSET)) -X32_64 crs $@ $(filter %.o,$^) --target=aixcoff-rs6000
Unfortunately as the Makefile is created by node-gyp and I have zero experience with it I'm unable to figure out how I can change node-gyp or any other of its related files to obtain the Makefile as I need.
Can someone help by changing the way the Makefile is generated for AIX PPC?
Thanks