dtolnay / cxx

Safe interop between Rust and C++
https://cxx.rs
Apache License 2.0
5.68k stars 320 forks source link

Compilation Issue: Linking to std in no_std Environment #1329

Open Moadao opened 3 months ago

Moadao commented 3 months ago

Context: I've been tinkering with embedded lately and using cxx to utilize some C++ code with Rust without the standard library (no std). This repository had a promising example, but I hit a snag during compilation.

Problem: As I compile the example in the repository for running cxx without the standard library, I ran into a little hiccup. The compilation process threw up an error message that said:

rust-lld: error: unable to find library -lstdc++

It seems like the linker (rust-lld) is having a tough time tracking down the standard C++ library (libstdc++). My guess is there might be a small hiccup in the configuration somewhere causing it to slip through the cracks.

Please note that I tried using the current version as well as this version:

[dependencies]
cxx = { version = "1.0.58", default-features = false, features = ["alloc"] }

In addition, I've already communicated with the repository owner regarding this issue, and it turns out he is facing the same problem.