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

--enable-static fails due to multiple definition #13500

Closed
deas opened this issue Jun 6, 2017 · 6 comments
Closed

--enable-static fails due to multiple definition #13500

deas opened this issue Jun 6, 2017 · 6 comments
Labels
build Issues and PRs related to build files or the CI. trace_events Issues and PRs related to V8, Node.js core, and userspace code trace events.

Comments

@deas
Copy link

deas commented Jun 6, 2017

  • Version: v7.10.0, v8.0.0
  • Platform: Linux x64 (Ubuntu 17.04)
  • Subsystem: Build?
./configure --enable-static
make

ends up

/tmp/out/Release/obj.target/node/src/tracing/node_trace_writer.o: In function `node::tracing::NodeTraceWriter::FlushPrivate()':
node_trace_writer.cc:(.text+0x16e0): multiple definition of `node::tracing::NodeTraceWriter::FlushPrivate()'
/tmp/out/Release/obj.target/node/src/tracing/node_trace_writer.o:node_trace_writer.cc:(.text+0x16e0): first defined here
/tmp/out/Release/obj.target/node/src/tracing/trace_event.o: In function `node::tracing::TraceEventHelper::SetCurrentPlatform(v8::Platform*)':
trace_event.cc:(.text+0x0): multiple definition of `node::tracing::TraceEventHelper::SetCurrentPlatform(v8::Platform*)'
/tmp/out/Release/obj.target/node/src/tracing/trace_event.o:trace_event.cc:(.text+0x0): first defined here
/tmp/out/Release/obj.target/node/src/tracing/trace_event.o:(.bss+0x0): multiple definition of `node::tracing::platform_'
/tmp/out/Release/obj.target/node/src/tracing/trace_event.o:(.bss+0x0): first defined here
/tmp/out/Release/obj.target/node/src/tracing/trace_event.o: In function `node::tracing::TraceEventHelper::GetCurrentPlatform()':
trace_event.cc:(.text+0x10): multiple definition of `node::tracing::TraceEventHelper::GetCurrentPlatform()'
/tmp/out/Release/obj.target/node/src/tracing/trace_event.o:trace_event.cc:(.text+0x10): first defined here
collect2: error: ld returned 1 exit status
cctest.target.mk:218: recipe for target '/tmp/out/Release/cctest' failed
make[1]: *** [/tmp/out/Release/cctest] Error 1
rm 8cc54113df3f034cebe6283bb3a0080714e3f522.intermediate
Makefile:76: recipe for target 'node' failed
make: *** [node] Error 2

for me.
With v7.4.0, things are working.

@mscdex mscdex added trace_events Issues and PRs related to V8, Node.js core, and userspace code trace events. v8.x build Issues and PRs related to build files or the CI. labels Jun 6, 2017
@mscdex
Copy link
Contributor

mscdex commented Jun 6, 2017

/cc @nodejs/diagnostics

@mscdex mscdex added the v7.x label Jun 6, 2017
@matiwinnetou
Copy link

matiwinnetou commented Aug 1, 2017

Same issue here.

@matiwinnetou
Copy link

@deas did you find any workaround for this?

@bnoordhuis
Copy link
Member

The problem is with the cctest binary, it seems. You can probably work around it by just building node with make -C out node BUILDTYPE=Release

@deas
Copy link
Author

deas commented Aug 2, 2017

@matiwinnetou Did not try very hard. Ended up assembling the final linking command manually.

@drywolf
Copy link
Contributor

drywolf commented Aug 14, 2017

On a related note, there also seems to be a linking problem on win32 that might be of concern to this issue.

I am building node from the checked out v7.9.0 git tag with --enable-static.
The node.js build finishes ok, but when I try to link the produced static libraries into the J2V8 dll code I get the following linker errors:

"C:\code\Github-Fork\J2V8\cmake.out\win32.x64\j2v8.vcxproj" (Standardziel) (4) ->
(Link Ziel) -> 
  v8_base_1.lib(machine-type.obj) : error LNK2005: "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl v8::internal::operator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,enum v8::internal::MachineRepresentation)" (??6internal@v8@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AEAV23@W4MachineRepresentation@01@@Z) already defined in mksnapshot.lib(mksnapshot.exe) [C:\code\Github-Fork\J2V8\cmake.out\win32.x64\j2v8.vcxproj]
  v8_base_0.lib(wasm-module-builder.obj) : error LNK2005: "public: void __cdecl v8::internal::wasm::WasmModuleBuilder::WriteTo(class v8::internal::wasm::ZoneBuffer &)const " (?WriteTo@WasmModuleBuilder@wasm@internal@v8@@QEBAXAEAVZoneBuffer@234@@Z) already defined in mksnapshot.lib(mksnapshot.exe) [C:\code\Github-Fork\J2V8\cmake.out\win32.x64\j2v8.vcxproj]
  v8_base_0.lib(wasm-module-builder.obj) : error LNK2005: "public: unsigned int __cdecl v8::internal::wasm::WasmModuleBuilder::AddGlobal(enum v8::internal::MachineRepresentation,bool,bool)" (?AddGlobal@WasmModuleBuilder@wasm@internal@v8@@QEAAIW4MachineRepresentation@34@_N1@Z) already defined in mksnapshot.lib(mksnapshot.exe) [C:\code\Github-Fork\J2V8\cmake.out\win32.x64\j2v8.vcxproj]
  v8_base_0.lib(wasm-module-builder.obj) : error LNK2005: "public: void __cdecl v8::internal::wasm::WasmModuleBuilder::MarkStartFunction(class v8::internal::wasm::WasmFunctionBuilder *)" (?MarkStartFunction@WasmModuleBuilder@wasm@internal@v8@@QEAAXPEAVWasmFunctionBuilder@234@@Z) already defined in mksnapshot.lib(mksnapshot.exe) [C:\code\Github-Fork\J2V8\cmake.out\win32.x64\j2v8.vcxproj]
  v8_base_0.lib(wasm-module-builder.obj) : error LNK2005: "public: unsigned int __cdecl v8::internal::wasm::WasmModuleBuilder::AddImport(char const *,int,class v8::internal::Signature<enum v8::internal::MachineRepresentation> *)" (?AddImport@WasmModuleBuilder@wasm@internal@v8@@QEAAIPEBDHPEAV?$Signature@W4MachineRepresentation@internal@v8@@@34@@Z) already defined in mksnapshot.lib(mksnapshot.exe) [C:\code\Github-Fork\J2V8\cmake.out\win32.x64\j2v8.vcxproj]
  v8_base_0.lib(wasm-module-builder.obj) : error LNK2005: "public: void __cdecl v8::internal::wasm::WasmModuleBuilder::AddIndirectFunction(unsigned int)" (?AddIndirectFunction@WasmModuleBuilder@wasm@internal@v8@@QEAAXI@Z) already defined in mksnapshot.lib(mksnapshot.exe) [C:\code\Github-Fork\J2V8\cmake.out\win32.x64\j2v8.vcxproj]
  v8_base_0.lib(wasm-module-builder.obj) : error LNK2005: "public: unsigned int __cdecl v8::internal::wasm::WasmModuleBuilder::AddSignature(class v8::internal::Signature<enum v8::internal::MachineRepresentation> *)" (?AddSignature@WasmModuleBuilder@wasm@internal@v8@@QEAAIPEAV?$Signature@W4MachineRepresentation@internal@v8@@@34@@Z) already defined in mksnapshot.lib(mksnapshot.exe) [C:\code\Github-Fork\J2V8\cmake.out\win32.x64\j2v8.vcxproj]
  v8_base_0.lib(wasm-module-builder.obj) : error LNK2005: "public: class v8::internal::wasm::WasmFunctionBuilder * __cdecl v8::internal::wasm::WasmModuleBuilder::AddFunction(class v8::internal::Signature<enum v8::internal::MachineRepresentation> *)" (?AddFunction@WasmModuleBuilder@wasm@internal@v8@@QEAAPEAVWasmFunctionBuilder@234@PEAV?$Signature@W4MachineRepresentation@internal@v8@@@34@@Z) already defined in mksnapshot.lib(mksnapshot.exe) [C:\code\Github-Fork\J2V8\cmake.out\win32.x64\j2v8.vcxproj]
  v8_base_0.lib(wasm-module-builder.obj) : error LNK2005: "public: __cdecl v8::internal::wasm::WasmModuleBuilder::WasmModuleBuilder(class v8::internal::Zone *)" (??0WasmModuleBuilder@wasm@internal@v8@@QEAA@PEAVZone@23@@Z) already defined in mksnapshot.lib(mksnapshot.exe) [C:\code\Github-Fork\J2V8\cmake.out\win32.x64\j2v8.vcxproj]
  v8_base_0.lib(wasm-module-builder.obj) : error LNK2005: "public: void __cdecl v8::internal::wasm::WasmFunctionBuilder::SetName(char const *,int)" (?SetName@WasmFunctionBuilder@wasm@internal@v8@@QEAAXPEBDH@Z) already defined in mksnapshot.lib(mksnapshot.exe) [C:\code\Github-Fork\J2V8\cmake.out\win32.x64\j2v8.vcxproj]
  v8_base_0.lib(wasm-module-builder.obj) : error LNK2005: "public: void __cdecl v8::internal::wasm::WasmFunctionBuilder::SetExported(void)" (?SetExported@WasmFunctionBuilder@wasm@internal@v8@@QEAAXXZ) already defined in mksnapshot.lib(mksnapshot.exe) [C:\code\Github-Fork\J2V8\cmake.out\win32.x64\j2v8.vcxproj]
  v8_base_0.lib(wasm-module-builder.obj) : error LNK2005: "public: void __cdecl v8::internal::wasm::WasmFunctionBuilder::EmitDirectCallIndex(unsigned int)" (?EmitDirectCallIndex@WasmFunctionBuilder@wasm@internal@v8@@QEAAXI@Z) already defined in mksnapshot.lib(mksnapshot.exe) [C:\code\Github-Fork\J2V8\cmake.out\win32.x64\j2v8.vcxproj]
  v8_base_0.lib(wasm-module-builder.obj) : error LNK2005: "public: void __cdecl v8::internal::wasm::WasmFunctionBuilder::EmitI32Const(int)" (?EmitI32Const@WasmFunctionBuilder@wasm@internal@v8@@QEAAXH@Z) already defined in mksnapshot.lib(mksnapshot.exe) [C:\code\Github-Fork\J2V8\cmake.out\win32.x64\j2v8.vcxproj]
  v8_base_0.lib(wasm-module-builder.obj) : error LNK2005: "public: void __cdecl v8::internal::wasm::WasmFunctionBuilder::EmitWithVarInt(enum v8::internal::wasm::WasmOpcode,unsigned int)" (?EmitWithVarInt@WasmFunctionBuilder@wasm@internal@v8@@QEAAXW4WasmOpcode@234@I@Z) already defined in mksnapshot.lib(mksnapshot.exe) [C:\code\Github-Fork\J2V8\cmake.out\win32.x64\j2v8.vcxproj]
  v8_base_0.lib(wasm-module-builder.obj) : error LNK2005: "public: void __cdecl v8::internal::wasm::WasmFunctionBuilder::EmitWithU8(enum v8::internal::wasm::WasmOpcode,unsigned char)" (?EmitWithU8@WasmFunctionBuilder@wasm@internal@v8@@QEAAXW4WasmOpcode@234@E@Z) already defined in mksnapshot.lib(mksnapshot.exe) [C:\code\Github-Fork\J2V8\cmake.out\win32.x64\j2v8.vcxproj]
  v8_base_0.lib(wasm-module-builder.obj) : error LNK2005: "public: void __cdecl v8::internal::wasm::WasmFunctionBuilder::Emit(enum v8::internal::wasm::WasmOpcode)" (?Emit@WasmFunctionBuilder@wasm@internal@v8@@QEAAXW4WasmOpcode@234@@Z) already defined in mksnapshot.lib(mksnapshot.exe) [C:\code\Github-Fork\J2V8\cmake.out\win32.x64\j2v8.vcxproj]
  v8_base_0.lib(wasm-module-builder.obj) : error LNK2005: "public: void __cdecl v8::internal::wasm::WasmFunctionBuilder::EmitCode(unsigned char const *,unsigned int)" (?EmitCode@WasmFunctionBuilder@wasm@internal@v8@@QEAAXPEBEI@Z) already defined in mksnapshot.lib(mksnapshot.exe) [C:\code\Github-Fork\J2V8\cmake.out\win32.x64\j2v8.vcxproj]
  v8_base_0.lib(wasm-module-builder.obj) : error LNK2005: "public: void __cdecl v8::internal::wasm::WasmFunctionBuilder::EmitTeeLocal(unsigned int)" (?EmitTeeLocal@WasmFunctionBuilder@wasm@internal@v8@@QEAAXI@Z) already defined in mksnapshot.lib(mksnapshot.exe) [C:\code\Github-Fork\J2V8\cmake.out\win32.x64\j2v8.vcxproj]
  v8_base_0.lib(wasm-module-builder.obj) : error LNK2005: "public: void __cdecl v8::internal::wasm::WasmFunctionBuilder::EmitSetLocal(unsigned int)" (?EmitSetLocal@WasmFunctionBuilder@wasm@internal@v8@@QEAAXI@Z) already defined in mksnapshot.lib(mksnapshot.exe) [C:\code\Github-Fork\J2V8\cmake.out\win32.x64\j2v8.vcxproj]
  v8_base_0.lib(wasm-module-builder.obj) : error LNK2005: "public: void __cdecl v8::internal::wasm::WasmFunctionBuilder::EmitGetLocal(unsigned int)" (?EmitGetLocal@WasmFunctionBuilder@wasm@internal@v8@@QEAAXI@Z) already defined in mksnapshot.lib(mksnapshot.exe) [C:\code\Github-Fork\J2V8\cmake.out\win32.x64\j2v8.vcxproj]
  v8_base_0.lib(wasm-module-builder.obj) : error LNK2005: "public: unsigned int __cdecl v8::internal::wasm::WasmFunctionBuilder::AddLocal(enum v8::internal::MachineRepresentation)" (?AddLocal@WasmFunctionBuilder@wasm@internal@v8@@QEAAIW4MachineRepresentation@34@@Z) already defined in mksnapshot.lib(mksnapshot.exe) [C:\code\Github-Fork\J2V8\cmake.out\win32.x64\j2v8.vcxproj]
  v8_base_0.lib(wasm-module-builder.obj) : error LNK2005: "public: void __cdecl v8::internal::wasm::WasmFunctionBuilder::SetSignature(class v8::internal::Signature<enum v8::internal::MachineRepresentation> *)" (?SetSignature@WasmFunctionBuilder@wasm@internal@v8@@QEAAXPEAV?$Signature@W4MachineRepresentation@internal@v8@@@34@@Z) already defined in mksnapshot.lib(mksnapshot.exe) [C:\code\Github-Fork\J2V8\cmake.out\win32.x64\j2v8.vcxproj]
  v8_base_0.lib(wasm-module-builder.obj) : error LNK2005: "public: void __cdecl v8::internal::wasm::WasmFunctionBuilder::EmitVarInt(unsigned int)" (?EmitVarInt@WasmFunctionBuilder@wasm@internal@v8@@QEAAXI@Z) already defined in mksnapshot.lib(mksnapshot.exe) [C:\code\Github-Fork\J2V8\cmake.out\win32.x64\j2v8.vcxproj]
  C:\code\Github-Fork\J2V8\cmake.out\win32.x64\Release\libj2v8-windows-x86_64.dll : fatal error LNK1169: one or more multiply defined symbols found [C:\code\Github-Fork\J2V8\cmake.out\win32.x64\j2v8.vcxproj]

    6 Warnung(en)
    24 Fehler

When I run exactly the same build from the node v7.4.0 tag everything links & works fine.

danbev added a commit to danbev/node that referenced this issue Aug 15, 2017
Currently when building with --enabled-static the cctest target will
include libraries to be linked regardless. This commit adds a condition
to only add the libraries when dynamically linking.

Fixes: nodejs#13500
@danbev danbev closed this as completed in be63c26 Aug 17, 2017
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. trace_events Issues and PRs related to V8, Node.js core, and userspace code trace events.
Projects
None yet
Development

No branches or pull requests

5 participants