Multiple definition link error

Hello,

I am using a rust library in a crystal project (https://crystal-lang.org/) and I have this error: /usr/src/rustc-1.43.0/vendor/compiler_builtins/src/macros.rs:253: multiple definition of `__mulodi4' _main.o:/usr/share/crystal/src/crystal/compiler_rt/mulodi4.cr:2: 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.