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

ninja build failure on master #12448

Closed
gibfahn opened this issue Apr 16, 2017 · 4 comments
Closed

ninja build failure on master #12448

gibfahn opened this issue Apr 16, 2017 · 4 comments
Labels
build Issues and PRs related to build files or the CI. confirmed-bug Issues with confirmed bugs. regression Issues related to regressions.

Comments

@gibfahn
Copy link
Member

gibfahn commented Apr 16, 2017

  • Version: master
  • Platform: macOS Sierra, ninja
  • Subsystem: build

Repro:

alias bn='export CPPFLAGS=-fdiagnostics-color && ./configure && tools/gyp_node.py -f ninja && ninja -C out/Release && ln -fs out/Release/node node'
make clean
bn

Error:

[2284/2284] LINK cctest, POSTBUILDS
FAILED: cctest 
c++ -Wl,-force_load,libopenssl.a -Wl,-force_load,libv8_base.a -Wl,-no_pie -Wl,-search_paths_first -mmacosx-version-min=10.7 -arch x86_64 -L. -stdlib=libc++ -o cctest obj/test/cctest/cctest.test_base64.o obj/test/cctest/cctest.test_environment.o obj/test/cctest/cctest.test_util.o obj/test/cctest/cctest.test_url.o obj/test/cctest/cctest.test_inspector_socket.o obj/test/cctest/cctest.test_inspector_socket_server.o obj/src/cctest.inspector_agent.o obj/src/cctest.inspector_io.o obj/src/cctest.inspector_socket.o obj/src/cctest.inspector_socket_server.o obj/src/cctest.node_crypto.o obj/src/cctest.node_crypto_bio.o obj/src/cctest.node_crypto_clienthello.o obj/src/cctest.tls_wrap.o obj/src/cctest.node_dtrace.o obj/src/cctest.backtrace_posix.o libgtest.a libzlib.a libopenssl.a libhttp_parser.a libuv.a libv8_libplatform.a libicui18n.a libcares.a libv8_libbase.a libv8_base.a libv8_libsampler.a libicuucx.a libicudata.a libicustubdata.a libv8_snapshot.a  obj.target/node/gen/node_javascript.o obj.target/node/src/node_debug_options.o obj.target/node/src/async-wrap.o obj.target/node/src/env.o obj.target/node/src/node.o obj.target/node/src/node_buffer.o obj.target/node/src/node_i18n.o obj.target/node/src/node_url.o obj.target/node/src/debug-agent.o obj.target/node/src/util.o obj.target/node/src/string_bytes.o obj.target/node/src/string_search.o obj.target/node/src/stream_base.o obj.target/node/src/node_constants.o obj.target/node/src/node_revert.o obj.target/node/src/tracing/agent.o obj.target/node/src/tracing/node_trace_buffer.o obj.target/node/src/tracing/node_trace_writer.o obj.target/node/src/tracing/trace_event.o -framework CoreFoundation -lm
clang: error: no such file or directory: 'obj.target/node/gen/node_javascript.o'
clang: error: no such file or directory: 'obj.target/node/src/node_debug_options.o'
clang: error: no such file or directory: 'obj.target/node/src/async-wrap.o'
clang: error: no such file or directory: 'obj.target/node/src/env.o'
clang: error: no such file or directory: 'obj.target/node/src/node.o'
clang: error: no such file or directory: 'obj.target/node/src/node_buffer.o'
clang: error: no such file or directory: 'obj.target/node/src/node_i18n.o'
clang: error: no such file or directory: 'obj.target/node/src/node_url.o'
clang: error: no such file or directory: 'obj.target/node/src/debug-agent.o'
clang: error: no such file or directory: 'obj.target/node/src/util.o'
clang: error: no such file or directory: 'obj.target/node/src/string_bytes.o'
clang: error: no such file or directory: 'obj.target/node/src/string_search.o'
clang: error: no such file or directory: 'obj.target/node/src/stream_base.o'
clang: error: no such file or directory: 'obj.target/node/src/node_constants.o'
clang: error: no such file or directory: 'obj.target/node/src/node_revert.o'
clang: error: no such file or directory: 'obj.target/node/src/tracing/agent.o'
clang: error: no such file or directory: 'obj.target/node/src/tracing/node_trace_buffer.o'
clang: error: no such file or directory: 'obj.target/node/src/tracing/node_trace_writer.o'
clang: error: no such file or directory: 'obj.target/node/src/tracing/trace_event.o'
ninja: build stopped: subcommand failed.

I originally got a longer error:

On a dirty directory: ```cc ninja: Entering directory `out/Release' [7/7] LINK cctest, POSTBUILDS FAILED: cctest c++ -Wl,-force_load,libopenssl.a -Wl,-force_load,libv8_base.a -Wl,-no_pie -Wl,-search_paths_first -mmacosx-version-min=10.7 -arch x86_64 -L. -stdlib=libc++ -o cctest obj/test/cctest/cctest.test_base64.o obj/test/cctest/cctest.test_environment.o obj/test/cctest/cctest.test_util.o obj/test/cctest/cctest.test_url.o obj/test/cctest/cctest.test_inspector_socket.o obj/test/cctest/cctest.test_inspector_socket_server.o obj/src/cctest.inspector_agent.o obj/src/cctest.inspector_io.o obj/src/cctest.inspector_socket.o obj/src/cctest.inspector_socket_server.o obj/src/cctest.node_crypto.o obj/src/cctest.node_crypto_bio.o obj/src/cctest.node_crypto_clienthello.o obj/src/cctest.tls_wrap.o obj/src/cctest.node_dtrace.o obj/src/cctest.backtrace_posix.o libgtest.a libzlib.a libopenssl.a libhttp_parser.a libuv.a libv8_libplatform.a libicui18n.a libcares.a libv8_libbase.a libv8_base.a libv8_libsampler.a libicuucx.a libicudata.a libicustubdata.a libv8_snapshot.a obj.target/node/gen/node_javascript.o obj.target/node/src/node_debug_options.o obj.target/node/src/async-wrap.o obj.target/node/src/env.o obj.target/node/src/node.o obj.target/node/src/node_buffer.o obj.target/node/src/node_i18n.o obj.target/node/src/node_url.o obj.target/node/src/debug-agent.o obj.target/node/src/util.o obj.target/node/src/string_bytes.o obj.target/node/src/string_search.o obj.target/node/src/stream_base.o obj.target/node/src/node_constants.o obj.target/node/src/node_revert.o obj.target/node/src/tracing/agent.o obj.target/node/src/tracing/node_trace_buffer.o obj.target/node/src/tracing/node_trace_writer.o obj.target/node/src/tracing/trace_event.o -framework CoreFoundation -lm Undefined symbols for architecture x86_64: "v8::FunctionTemplate::New(v8::Isolate*, void (*)(v8::FunctionCallbackInfo const&), v8::Local, v8::Local, int)", referenced from: node::AsyncWrap::Initialize(v8::Local, v8::Local, v8::Local) in async-wrap.o node::SetupNextTick(v8::FunctionCallbackInfo const&) in node.o node::SetupProcessObject(node::Environment*, int, char const* const*, int, char const* const*) in node.o node::LoadEnvironment(node::Environment*) in node.o node::CreateEnvironment(v8::Isolate*, uv_loop_s*, v8::Local, int, char const* const*, int, char const* const*) in node.o node::Environment::Environment(v8::Local, uv_loop_s*) in node.o node::Buffer::SetupBufferJS(v8::FunctionCallbackInfo const&) in node_buffer.o ... (maybe you meant: __ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorE) "v8::Context::New(v8::Isolate*, v8::ExtensionConfiguration*, v8::Local, v8::Local)", referenced from: node::Start(int, char**) in node.o node::debugger::Agent::WorkerRun() in debug-agent.o "node::FreeIsolateData(node::IsolateData*)", referenced from: EnvironmentTest_AtExitWithEnvironment_Test::TestBody() in cctest.test_environment.o EnvironmentTest_AtExitWithArgument_Test::TestBody() in cctest.test_environment.o EnvironmentTest_MultipleEnvironmentsPerIsolate_Test::TestBody() in cctest.test_environment.o "node::CreateEnvironment(node::IsolateData*, v8::Local, int, char const* const*, int, char const* const*)", referenced from: EnvironmentTest::Env::Env(v8::HandleScope const&, v8::Isolate*, Argv const&) in cctest.test_environment.o "node::CreateIsolateData(v8::Isolate*, uv_loop_s*)", referenced from: EnvironmentTest::Env::Env(v8::HandleScope const&, v8::Isolate*, Argv const&) in cctest.test_environment.o "node::LowMemoryNotification()", referenced from: char* node::UncheckedRealloc(char*, unsigned long) in cctest.test_util.o unsigned char* node::UncheckedRealloc(unsigned char*, unsigned long) in cctest.test_util.o unsigned short* node::UncheckedRealloc(unsigned short*, unsigned long) in cctest.test_util.o char* node::UncheckedRealloc(char*, unsigned long) in cctest.node_crypto.o unsigned char* node::UncheckedRealloc(unsigned char*, unsigned long) in cctest.node_crypto.o EC_builtin_curve* node::UncheckedRealloc(EC_builtin_curve*, unsigned long) in cctest.node_crypto.o char* node::UncheckedRealloc(char*, unsigned long) in cctest.tls_wrap.o ... "node::ssl_openssl_cert_store", referenced from: node::crypto::NewRootCertStore() in cctest.node_crypto.o "node::i18n::InitializeICUDirectory(std::__1::basic_string, std::__1::allocator > const&)", referenced from: URLTest::SetUp() in cctest.test_url.o "node::i18n::ToASCII(node::MaybeStackBuffer*, char const*, unsigned long, bool)", referenced from: node::url::ParseHost(node::url::url_host*, char const*, unsigned long, bool) in node_url.o "node::i18n::ToUnicode(node::MaybeStackBuffer*, char const*, unsigned long, bool)", referenced from: node::url::ParseHost(node::url::url_host*, char const*, unsigned long, bool) in node_url.o "node::AtExit(node::Environment*, void (*)(void*), void*)", referenced from: EnvironmentTest_AtExitWithEnvironment_Test::TestBody() in cctest.test_environment.o EnvironmentTest_AtExitWithArgument_Test::TestBody() in cctest.test_environment.o EnvironmentTest_MultipleEnvironmentsPerIsolate_Test::TestBody() in cctest.test_environment.o "node::crypto::UseExtraCaCerts(std::string const&)", referenced from: node::Start(int, char**) in node.o "node::inspector::Agent::Start(v8::Platform*, char const*, int, bool)", referenced from: node::StartDebug(node::Environment*, char const*, bool) in node.o "std::string::_Rep::_M_destroy(std::allocator const&)", referenced from: node::Start(int, char**) in node.o node::debugger::Agent::~Agent() in debug-agent.o "std::string::_Rep::_S_empty_rep_storage", referenced from: node::Start(int, char**) in node.o __GLOBAL__sub_I_node.cc in node.o node::debugger::Agent::Agent(node::Environment*) in debug-agent.o node::debugger::Agent::~Agent() in debug-agent.o "std::string::assign(char const*, unsigned long)", referenced from: node::Init(int*, char const**, int*, char const***) in node.o "std::string::assign(std::string const&)", referenced from: node::debugger::Agent::Start(std::string const&, int, bool) in debug-agent.o "std::string::replace(unsigned long, unsigned long, char const*, unsigned long)", referenced from: node::Init(int*, char const**, int*, char const***) in node.o "std::basic_string, std::allocator >::basic_string(char const*, std::allocator const&)", referenced from: node::Start(int, char**) in node.o "std::basic_string, std::allocator >::~basic_string()", referenced from: __GLOBAL__sub_I_node.cc in node.o "std::__throw_length_error(char const*)", referenced from: std::vector >::reserve(unsigned long) in node.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) ninja: build stopped: subcommand failed. ```
@addaleax addaleax added the build Issues and PRs related to build files or the CI. label Apr 16, 2017
@kenany
Copy link
Contributor

kenany commented Apr 16, 2017

Same for me on Linux. Bisect points to 6a09a69.

@gibfahn gibfahn changed the title ninja build failure on macOS ninja build failure on master Apr 16, 2017
@gibfahn
Copy link
Member Author

gibfahn commented Apr 16, 2017

Thanks @kenany!

@danbev any ideas?

@kenany
Copy link
Contributor

kenany commented Apr 16, 2017

I first tried:

diff --git a/common.gypi b/common.gypi
index 2c061a7b05..edb5fc154b 100644
--- a/common.gypi
+++ b/common.gypi
@@ -50,7 +50,7 @@
       }, {
         'conditions': [
           ['GENERATOR=="ninja"', {
-            'OBJ_DIR': '<(PRODUCT_DIR)/obj',
+            'OBJ_DIR': '<(PRODUCT_DIR)/obj.target',
             'V8_BASE': '<(PRODUCT_DIR)/obj/deps/v8/src/libv8_base.a',
           }, {
             'OBJ_DIR%': '<(PRODUCT_DIR)/obj.target',

which resolved the specific errors we're seeing, but then openssl fails to link. I tried to fix that too:

diff --git a/node.gypi b/node.gypi
index a926d9a8e7..40df17639e 100644
--- a/node.gypi
+++ b/node.gypi
@@ -132,7 +132,7 @@
                 ['OS in "linux freebsd" and node_shared=="false"', {
                   'ldflags': [
                     '-Wl,--whole-archive,'
-                        '<(OBJ_DIR)/deps/openssl/'
+                        '<(PRODUCT_DIR)/obj/deps/openssl/'
                         '<(OPENSSL_PRODUCT)',
                     '-Wl,--no-whole-archive',
                   ],

But then the original issue seems to pop up again somehow.

@danbev
Copy link
Contributor

danbev commented Apr 17, 2017 via email

@refack refack added the regression Issues related to regressions. label Apr 17, 2017
@refack refack added the confirmed-bug Issues with confirmed bugs. label Apr 18, 2017
danbev added a commit to danbev/node that referenced this issue May 11, 2017
When working on commit 6a09a69
("build: enable cctest to use generated objects") I did not take into
account building with ninja:

$ ./configure
$ tools/gyp_node.py -f ninja
$ ninja -C out/Release
$ ln -fs out/Release/node node

When ninja generated the ninja build files, src files that are
relative to the src directory will be named with a dot instead of a
path separator, for example:

out/Release/obj/src/node/node.o
would instead become:
out/Release/obj/src/node.node.o

This commit adds an additional variable for the typ of object separator
used for this case.

Also, the LIBS specified in the 'libraries' section are not
being included in the --start-group --end-group section which
means that these libraries will not be searched causing issue
with linkers where the order matters.

Fixes: nodejs#12448
@refack refack closed this as completed in bb88cae May 11, 2017
refack pushed a commit that referenced this issue May 11, 2017
Currently the files specified in libraries in node.gyp `cctest` target are
getting a '.lib' extension on windows when generated with ninja.
This commit adds a check to see if a file has a '.obj' extension and in
that case no '.lib' extension will be added.

Also, the LIBS specified in the 'libraries' section are not
being included in the --start-group --end-group section which
means that these libraries will not be searched causing issue
with linkers where the order matters.

PR-URL: #12484
Fixes: #12448
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
anchnk pushed a commit to anchnk/node that referenced this issue May 19, 2017
When working on commit 6a09a69
("build: enable cctest to use generated objects") I did not take into
account building with ninja:

$ ./configure
$ tools/gyp_node.py -f ninja
$ ninja -C out/Release
$ ln -fs out/Release/node node

When ninja generated the ninja build files, src files that are
relative to the src directory will be named with a dot instead of a
path separator, for example:

out/Release/obj/src/node/node.o
would instead become:
out/Release/obj/src/node.node.o

This commit adds an additional variable for the type of object separator
used for this case.

Currently the check for if ninja is being used is a normal if statement
as are the following os checks (win and aix). But the win and aix ones
should only be evaluated if the build is not generated by ninja.
This commit turns this logic into an if ninja else statement.

PR-URL: nodejs#12484
Fixes: nodejs#12448
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
anchnk pushed a commit to anchnk/node that referenced this issue May 19, 2017
Currently the files specified in libraries in node.gyp `cctest` target are
getting a '.lib' extension on windows when generated with ninja.
This commit adds a check to see if a file has a '.obj' extension and in
that case no '.lib' extension will be added.

Also, the LIBS specified in the 'libraries' section are not
being included in the --start-group --end-group section which
means that these libraries will not be searched causing issue
with linkers where the order matters.

PR-URL: nodejs#12484
Fixes: nodejs#12448
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
refack pushed a commit to refack/node that referenced this issue Jul 18, 2017
Currently the files specified in libraries in node.gyp `cctest` target are
getting a '.lib' extension on windows when generated with ninja.
This commit adds a check to see if a file has a '.obj' extension and in
that case no '.lib' extension will be added.

Also, the LIBS specified in the 'libraries' section are not
being included in the --start-group --end-group section which
means that these libraries will not be searched causing issue
with linkers where the order matters.

PR-URL: nodejs#12484
Fixes: nodejs#12448
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
refack pushed a commit to refack/node that referenced this issue Aug 23, 2017
Currently the files specified in libraries in node.gyp `cctest` target are
getting a '.lib' extension on windows when generated with ninja.
This commit adds a check to see if a file has a '.obj' extension and in
that case no '.lib' extension will be added.

Also, the LIBS specified in the 'libraries' section are not
being included in the --start-group --end-group section which
means that these libraries will not be searched causing issue
with linkers where the order matters.

PR-URL: nodejs#12484
Fixes: nodejs#12448
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
addaleax pushed a commit to addaleax/ayo that referenced this issue Aug 25, 2017
Currently the files specified in libraries in node.gyp `cctest` target are
getting a '.lib' extension on windows when generated with ninja.
This commit adds a check to see if a file has a '.obj' extension and in
that case no '.lib' extension will be added.

Also, the LIBS specified in the 'libraries' section are not
being included in the --start-group --end-group section which
means that these libraries will not be searched causing issue
with linkers where the order matters.

PR-URL: nodejs/node#12484
Fixes: nodejs/node#12448
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
addaleax pushed a commit to ayojs/ayo that referenced this issue Aug 28, 2017
Currently the files specified in libraries in node.gyp `cctest` target are
getting a '.lib' extension on windows when generated with ninja.
This commit adds a check to see if a file has a '.obj' extension and in
that case no '.lib' extension will be added.

Also, the LIBS specified in the 'libraries' section are not
being included in the --start-group --end-group section which
means that these libraries will not be searched causing issue
with linkers where the order matters.

PR-URL: nodejs/node#12484
Fixes: nodejs/node#12448
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
MylesBorins pushed a commit that referenced this issue Sep 10, 2017
Currently the files specified in libraries in node.gyp `cctest` target are
getting a '.lib' extension on windows when generated with ninja.
This commit adds a check to see if a file has a '.obj' extension and in
that case no '.lib' extension will be added.

Also, the LIBS specified in the 'libraries' section are not
being included in the --start-group --end-group section which
means that these libraries will not be searched causing issue
with linkers where the order matters.

PR-URL: #12484
Fixes: #12448
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
MylesBorins pushed a commit that referenced this issue Sep 12, 2017
Currently the files specified in libraries in node.gyp `cctest` target are
getting a '.lib' extension on windows when generated with ninja.
This commit adds a check to see if a file has a '.obj' extension and in
that case no '.lib' extension will be added.

Also, the LIBS specified in the 'libraries' section are not
being included in the --start-group --end-group section which
means that these libraries will not be searched causing issue
with linkers where the order matters.

PR-URL: #12484
Fixes: #12448
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
rvagg pushed a commit to nodejs/node-gyp that referenced this issue Aug 9, 2018
Currently the files specified in libraries in node.gyp `cctest` target are
getting a '.lib' extension on windows when generated with ninja.
This commit adds a check to see if a file has a '.obj' extension and in
that case no '.lib' extension will be added.

Also, the LIBS specified in the 'libraries' section are not
being included in the --start-group --end-group section which
means that these libraries will not be searched causing issue
with linkers where the order matters.

PR-URL: nodejs/node#12484
Fixes: nodejs/node#12448
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
rvagg pushed a commit to nodejs/node-gyp that referenced this issue Aug 9, 2018
Currently the files specified in libraries in node.gyp `cctest` target are
getting a '.lib' extension on windows when generated with ninja.
This commit adds a check to see if a file has a '.obj' extension and in
that case no '.lib' extension will be added.

Also, the LIBS specified in the 'libraries' section are not
being included in the --start-group --end-group section which
means that these libraries will not be searched causing issue
with linkers where the order matters.

PR-URL: nodejs/node#12484
Fixes: nodejs/node#12448
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. confirmed-bug Issues with confirmed bugs. regression Issues related to regressions.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants