Multiple definition link error


I am using a rust library in a crystal project ( and I have this error: /usr/src/rustc-1.43.0/vendor/compiler_builtins/src/ multiple definition of `__mulodi4' _main.o:/usr/share/crystal/src/crystal/compiler_rt/ first defined here

It seems __mulodi4 is a name used both by rust compiler and crystal compiler. I don't know how I can work around this problem since I cannot change the compilers. Any has a suggestion?

Does crystal put __mulodi4 into a separate object file? All functions in a compiler-rt implementation must be in separate object files to prevent duplicate symbols when mixing multiple compiler-rt implementations from for example libgcc_s or in this case rust and crystal.

I don't know but I will check. What should I do if it is in a separate object file? Because I am linking with it anyways so how a separate file can help ?

If it is in a separate object file, it simply should be skipped while linking unless --whole-archive was used. Normally only the object files in an archive that are necessary to provide any symbol are linked in. The rest is skipped. If they are linked in, they must not define any symbols that are also defined by any other linked in object files.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.