Reputation: 638
When I set "-s ASSERTIONS=1" then linker will fail with lots of "Referencing global in another module!" messages, e.g.:
Referencing global in another module! [16 x i8]* @_ZZN8nlohmann10basic_jsonINSt3__23mapENS1_6vectorENS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbxydS7_NS_14adl_serializerEE13escape_stringERKS9_E6hexify ; ModuleID = 'src/ui_lib/logic/libcommands.bc' [16 x i8]* @_ZZN8nlohmann10basic_jsonINSt3__23mapENS1_6vectorENS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbxydS7_NS_14adl_serializerEE13escape_stringERKS9_E6hexify ; ModuleID = 'src/ui_lib/curves.bc' Referencing global in another module! %"struct.ui::EmscriptenBindingInitializer_uicurves"* @_ZN5boost6detail15optional_detail13none_instanceINS_6none_tEE8instanceE ; ModuleID = 'src/ui_lib/logic/libcommands.bc' %"struct.ui::EmscriptenBindingInitializer_uicurves"* @_ZN5boost6detail15optional_detail13none_instanceINS_6none_tEE8instanceE ; ModuleID = 'src/ui_lib/curves.bc'
It happens when I use instances of nlohmann::json (https://github.com/nlohmann/json) in multiple translation units.
Is that a bug or a feature? How can I fix it?
Upvotes: 1
Views: 131
Reputation: 638
It is an emscripten bug: https://github.com/kripken/emscripten/issues/5008
Fix is very easy: https://github.com/kripken/emscripten/pull/5021/commits/1b0d41d1845015491a52da2cb9f7da7dfe3acf44
Upvotes: 1