Hi Sam, Thanks for the quick reply! I checked the symbols and they're defined in one header file (foma.h) which is of course included in the corresponding c files of the object files listed above (apply.c, int_stack.c, topsort.c, flags.c, determinize.c, minimize.c, reverse.c, sigma.c, define.c, io.c). Unfortunately, I don't get what you mean by this:
"it looks like those symbols might be defined in a header file which would mean they are duplicated in each object file that includes them" Isn't it ok that several source files include the same header? Don't get me wrong, I'll do whatever is necessary to make it build ;) The project itself as I said built fine some time back (asm.js times, not wasm) with emscripten via fastcomp of which you can still see an early version still running here: http://r0ller.github.io/alice Other toolchains with which this library compiles fine include native clang++ and cross compiling to arm32 and 64 also works via clang. The arm libs run fine on android called via android-ndk. Thanks®ards, r0ller 2020. március 3., kedd 8:49:41 UTC+1 időpontban Sam Clegg a következőt írta: > > Hi, > > The words `shared:ERROR:` are due to the fact that the error is reported > from the file called shared.py. I can see how that is confusing. We > should probably drop the first part and just repot "error:". > > It does look like that those symbols (e.g. `g_defines`) are being defined > in multiple compilation units. I'm not sure how this would work in > fastcomp but not with the backend. Does this codebase build with other > toolchains? (e.g. native/desktop toolchains?). Can you take a look at the > definition of `g_defines`. Is it defined in a header file? From the error > messages, it looks like those symbols might be defined in a header file > which would mean they are duplicated in each object file that includes them. > > cheers, > sam > > > On Mon, Mar 2, 2020 at 2:37 PM r0ller r0ller <[email protected] > <javascript:>> wrote: > >> Hi All, >> >> My project built fine some time back with fastcomp and now I wanted to >> catch up with upstream. Unfortunately, the command I used to build the >> stuff results in duplicate symbol errors as if I wanted to build a shared >> library. However, all the dependent libs are compiled to .a archives. >> Here's the command (tried to copy relevant parts from the makefile): >> >> CXXFLAGS=-std=c++11 -fPIC -pedantic -Wall >> em++ ${CXXFLAGS} $$includedirs -s EXPORTED_FUNCTIONS=$$exportedfunction >> $$srcfilepath $$projectdir/logger.cpp $$projectdir/sqlite_db.cpp >> $$projectdir/lexer.cpp $$projectdir/sp.cpp $$projectdir/tokenpaths.cpp >> $$projectdir/query_result.cpp $$projectdir/morphan_result.cpp >> $$projectdir/morphan.cpp $$projectdir/transgraph.cpp $$jslibdir -lsqlite3 >> -lfoma -lz -lreadline -o $$absbuilddir/hi_js/embedded/hi.js --embed-file >> $$jsdb --embed-file $$jsfst; >> >> See the result (only the errors it ends up with) at the end. The >> interesting thing is that all errors seem to come from libfoma.a and the >> build stops with SHARED ERROR. Does anyone happen to have any hint how to >> make it build? >> >> Thanks®ards, >> r0ller >> >> wasm-ld: error: duplicate symbol: g_defines >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(apply.o) >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(int_stack.o) >> >> wasm-ld: error: duplicate symbol: g_defines_f >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(apply.o) >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(int_stack.o) >> >> wasm-ld: error: duplicate symbol: g_defines >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(int_stack.o) >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(topsort.o) >> >> wasm-ld: error: duplicate symbol: g_defines_f >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(int_stack.o) >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(topsort.o) >> >> wasm-ld: error: duplicate symbol: g_defines >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(topsort.o) >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(flags.o) >> >> wasm-ld: error: duplicate symbol: g_defines_f >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(topsort.o) >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(flags.o) >> >> wasm-ld: error: duplicate symbol: g_defines >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(flags.o) >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(determinize.o) >> >> wasm-ld: error: duplicate symbol: g_defines_f >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(flags.o) >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(determinize.o) >> >> wasm-ld: error: duplicate symbol: trans_array >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(determinize.o) >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(minimize.o) >> >> wasm-ld: error: duplicate symbol: trans_list >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(determinize.o) >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(minimize.o) >> >> wasm-ld: error: duplicate symbol: g_defines >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(determinize.o) >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(minimize.o) >> >> wasm-ld: error: duplicate symbol: g_defines_f >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(determinize.o) >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(minimize.o) >> >> wasm-ld: error: duplicate symbol: g_defines >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(minimize.o) >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(reverse.o) >> >> wasm-ld: error: duplicate symbol: g_defines_f >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(minimize.o) >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(reverse.o) >> >> wasm-ld: error: duplicate symbol: g_defines >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(reverse.o) >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(sigma.o) >> >> wasm-ld: error: duplicate symbol: g_defines_f >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(reverse.o) >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(sigma.o) >> >> wasm-ld: error: duplicate symbol: g_defines >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(sigma.o) >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(define.o) >> >> wasm-ld: error: duplicate symbol: g_defines_f >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(sigma.o) >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(define.o) >> >> wasm-ld: error: duplicate symbol: g_defines >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(define.o) >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(io.o) >> >> wasm-ld: error: duplicate symbol: g_defines_f >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(define.o) >> >>> defined in /home/r0ller/hi/alice/hi_js/libfoma.a(io.o) >> >> wasm-ld: error: too many errors emitted, stopping now (use -error-limit=0 >> to see all errors) >> shared:ERROR: '/usr/pkg/bin/wasm-ld -o >> /tmp/emscripten_temp_d2_aum2l/hi.wasm --allow-undefined --lto-O0 >> /tmp/emscripten_temp_d2_aum2l/hi.y_0.o >> -L/home/r0ller/emsdk/upstream/emscripten/system/local/lib >> /tmp/emscripten_temp_d2_aum2l/logger_1.o >> -L/home/r0ller/emsdk/upstream/emscripten/system/lib >> /tmp/emscripten_temp_d2_aum2l/sqlite_db_2.o >> -L/home/r0ller/.emscripten_cache/wasm-obj >> /tmp/emscripten_temp_d2_aum2l/lexer_3.o >> /tmp/emscripten_temp_d2_aum2l/sp_4.o >> /tmp/emscripten_temp_d2_aum2l/tokenpaths_5.o >> /tmp/emscripten_temp_d2_aum2l/query_result_6.o >> /tmp/emscripten_temp_d2_aum2l/morphan_result_7.o >> /tmp/emscripten_temp_d2_aum2l/morphan_8.o >> /tmp/emscripten_temp_d2_aum2l/transgraph_9.o -L/home/r0ller/hi/alice/hi_js >> /home/r0ller/hi/alice/hi_js/libsqlite3.a >> /home/r0ller/hi/alice/hi_js/libfoma.a /home/r0ller/hi/alice/hi_js/libz.a >> /home/r0ller/hi/alice/hi_js/libreadline.a >> /home/r0ller/.emscripten_cache/wasm-obj/libc.a >> /home/r0ller/.emscripten_cache/wasm-obj/libcompiler_rt.a >> /home/r0ller/.emscripten_cache/wasm-obj/libc-wasm.a >> /home/r0ller/.emscripten_cache/wasm-obj/libc++-noexcept.a >> /home/r0ller/.emscripten_cache/wasm-obj/libc++abi-noexcept.a >> /home/r0ller/.emscripten_cache/wasm-obj/libdlmalloc.a >> /home/r0ller/.emscripten_cache/wasm-obj/libpthread_stub.a >> /home/r0ller/.emscripten_cache/wasm-obj/libc_rt_wasm.a >> /home/r0ller/.emscripten_cache/wasm-obj/libsockets.a --import-memory >> --import-table -mllvm -combiner-global-alias-analysis=false -mllvm >> -enable-emscripten-sjlj -mllvm -disable-lsr --strip-debug --export >> __wasm_call_ctors --export __data_end --export hi --export malloc --export >> free --export setThrew --export __errno_location --export fflush --export >> _ZSt18uncaught_exceptionv --export emscripten_builtin_free --export >> _get_environ --export emscripten_builtin_memalign --export memalign >> --export usleep --export _get_tzname --export _get_daylight --export >> _get_timezone --export realloc -z stack-size=5242880 >> --initial-memory=16777216 --no-entry --max-memory=16777216 >> --global-base=1024' failed (1) >> *** Error code 1 >> >> Stop. >> make: stopped in /home/r0ller/hi/alice >> >> -- >> You received this message because you are subscribed to the Google Groups >> "emscripten-discuss" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/emscripten-discuss/f9c54035-db3b-4acf-bc87-8aa04c28d527%40googlegroups.com >> >> <https://groups.google.com/d/msgid/emscripten-discuss/f9c54035-db3b-4acf-bc87-8aa04c28d527%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/5c422fa0-0aef-4316-9ed8-3bddaea88034%40googlegroups.com.
