Multiple definition when linking with a Rust library

Hello,

When linking with a Rust library, I get 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

Any suggestion on how should I resolve this ? The function is part of rust/crystal standard libraries so I cannot change the name?

It seems that function is from compiler-ft to support Int128. I don’t know how you can solve it… maybe in rust there’s a way to exclude that symbol? Alternatively we could add an option to Crystal to specify symbols that should be external.

Even if it is external and despite the name, we cannot be sure it will be exactly the same function. So I don’t think making it external will be a good solution.

It’s the same definition

You can see if there’s a linker flag to allow duplicate definitions: https://stackoverflow.com/questions/17443976/how-to-allow-z-multidefs-with-g47

You can pass -Dskip_crystal_compiler_rt to skip the Crystal compier-rt definitions