On Apr 23, 2019, at 10:15, Ken Cunningham wrote:

> In the process of trying to fix up the nodejs ports to build on older 
> systems, I ran across a strange issue attempting to run the test suite.
> 
> sudo port -v test nodejsN   (where N = any even number I tried) always seems 
> to fail.
> 
> I was seeing this on 10.6.8 on all the nodejs builds, so I ran the test suite 
> on nodejs10 on Mojave, and got much the same error.
> 
> Does anyone use nodejs enough to help me figure out how to run the tests, so 
> I can be sure these builds are working? And for that matter, to enable the 
> tests on current systems?
> 
> Ken
> 
> 
> Error: 
> 
> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_nodejs10/nodejs10/work/node-v10.15.3/tools/build-addons.js:58
> main(process.argv[3]).catch((err) => setImmediate(() => { throw err; }));
>                                                           ^
> 
> Error: Command failed: 
> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_nodejs10/nodejs10/work/node-v10.15.3/out/Release/node
>  
> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_nodejs10/nodejs10/work/node-v10.15.3/deps/npm/node_modules/node-gyp/bin/node-gyp.js
>  rebuild 
> --directory=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_nodejs10/nodejs10/work/node-v10.15.3/test/addons/08_void_atexitcallback_args
> c++: error: unrecognized command line option '-stdlib=libc++'
> make[2]: *** [Release/obj.target/addon/addon.o] Error 1
> 
>     at ChildProcess.exithandler (child_process.js:294:12)
>     at ChildProcess.emit (events.js:189:13)
>     at maybeClose (internal/child_process.js:970:16)
>     at Socket.stream.socket.on (internal/child_process.js:389:11)
>     at Socket.emit (events.js:189:13)
>     at Pipe._handle.close (net.js:597:12)
> make[1]: *** [test/addons/.buildstamp] Error 1
> 


Looking at the nodejs10 portfile, I see that it tells the build system what 
compiler to use during the build phase by setting build.args but it doesn't do 
anything to tell the build system what compiler to use during the test phase, 
so anything built or rebuilt during the test phase would use the default 
compiler "c++".

On 10.6, "c++" is g++-4.2, which doesn't understand the -stdlib flag, which 
explains the above error message. On later systems, "c++" is clang++, which 
does understand the -stdlib flag, so you should not have seen the same error on 
later systems.

The portfile probably just needs to be fixed to use the right compiler in the 
test phase as well. It might be as simple as copying build.args to test.args:


test.args {*}${build.args}


Reply via email to