nyx-space / nyx

Nyx is a high fidelity, fast, reliable and validated astrodynamics toolkit library written in Rust and available in Python
https://nyxspace.com
GNU Affero General Public License v3.0
198 stars 20 forks source link

Compilation Error #353

Closed gwbres closed 1 month ago

gwbres commented 3 months ago

Bug report

Describe the bug

I can't compile nyx by itself (current main branch), although I usually don't have problems when referring to it externally (at least stable version) by means of cargo.

I tried build -r at the root of the current branch, it first complaned about clang which I installed. Now it complains:

note: clang: error: invalid linker name in argument '-fuse-ld=ldd'

could not compile 'serde' (build script)
could not compile 'num-traits' (build script)
linking with 'clang' failed

note: clang: error: invalid linker name in argument '-fuse-ld=ldd'

could not compile 'libm' 
linking with 'clang' failed

Does nyx have some specific libc requirements? or does it require some special Rust/C/C++ library ? I would like to make a proposal but I cannot test it on my side, due to incapacity to build the library

ChristopherRabotin commented 3 months ago

Hi Guillaume,

ldd is a very fast linker that is built by the same team as clang. It saves several minutes of compilation time for Nyx in the Github CI actions. You may need to install clang-ldd or a package with a similar name to build. That linker is provided by default in the rust toolchain in the Github CI actions.

Let me know if that works.

gwbres commented 3 months ago

I don't see any package close or similar to clang-ldd (personaly, I use debian OS). I searched on the web a little bit, and everybody facing similar issues keep bringing llvm up. I don't understand if this is a nyx dependency that is failing to be built, or nyx itself.

I used to have rustc 1.77 and just upgraded to 1.80, but it is not a rustc issue, It's a clang compiler issue. I will take a loot a the CI script see if you have any core dependencies

ChristopherRabotin commented 3 months ago

Yes, it's a Nyx issue because the Cargo.toml specifies which linker to use: https://github.com/nyx-space/nyx/blob/master/Cargo.toml#L100 .

It seems that you may be able to overwrite the linker in your local ~/.cargo/config:

Create or edit ~/.cargo/config.toml and add:

[target.x86_64-unknown-linux-gnu]
linker = "gcc"
gwbres commented 3 months ago

If I define a linker, whether it is in my own cargo, or the nyx cargo, it always gives the warning that the manifest key target.x86_64-unknown-linux-gnu.linker is not used. I happens even in current nyx (unmodified) because that's how you define to use clang as the linker. I simply did not notice, due to the tons of errors. Therefore, I don't understand why it does use clang and I end up with this error.

it seems to be caused by libc, which is a very basis dependency of your library, either in what they have in the Cargo.toml script, or their build script

ChristopherRabotin commented 3 months ago

Any update on this issue? Have you found a fix?

gwbres commented 3 months ago

Unfortunately not :( I just gave it a try again, just to check if you were inquiring this topic. I updated my branch to your latest "master", it still fails with the same error. It seems like the Cargo.toml customization has no impact on what is happening in the build process. To my understanding, because it comes from libc itself, which is a dependency, not from nyx directly. So there is not much we can do. The only thing I don't understand, is why should I be the only one facing this issue ? I would like to propose a new method to the nyx core

ephraim271 commented 1 month ago

@gwbres Were you able to find a fix? Having same issue on Ubuntu 22.04

ephraim271 commented 1 month ago

Resolved, for ubuntu : sudo apt install clang sudo apt install lld

@ChristopherRabotin could be added to quickstart?

gwbres commented 1 month ago

@ephraim271 ,

confirmed that this works, good job 👍 💯