Open milahu opened 2 years ago
@milahu, where would LIBCXX_INCLUDE_DIR
, GLIBC_INCLUDE_DIR
, and LIBC_INCLUDE_DIR
be set? They aren't normally set outside of nix os. Getting these from llvm-config
would be better, but I don't think llvm-config
has these paths. llvm-config --includedir
is for the headers for llvm/clang's own headers, not libc
's and libcxx
's.
If you make these environment variables optional overrides in c2rust-ast-exporter/build.rs
, I thought that would work fine.
i guess this is mostly a nix problem (multi prefix filesystem)
if c2rust could expose these env-vars this would make the nix side like 1% simpler (less patching)
in nix there is also clangStdenv.mkDerivation
instead of the default stdenv.mkDerivation
where all these include paths should be set by default
see https://nixos.wiki/wiki/Using_Clang_instead_of_GCC
its just a challenge to combine rustPlatform.buildRustPackage
and clangStdenv.mkDerivation
maybe something like
rustPlatform.buildRustPackage {
buildInputs = [
clangStdenv.cc
];
}
what did others do? grep grep grep ...
for example
pkgs/games/blightmud/default.nix pkgs/development/tools/rust/bindgen/unwrapped.nix
I'm getting this error building on Ubuntu 22.04 with the nightly toolchain as well.
Seems to be rectified after double checking my libstdc++ install, might be something to mention in the readme.
For reference, I was experiencing this on my system(s), both Ubuntu 22.04.
The solution has been to install the package libstdc++-12-dev
. @kkysen I think this should be added to the README; I'd add this myself, but the details confuse me, specifically, why v12 is required on Ubuntu 22.04, while on Ubuntu 20.04, older versions were fine :grimacing:
I can confirm that installing libstdc++-12-dev
stopped the compile failures on Ubuntu 22.04, but this seems more like a workaround than a true fix. The compile failures were happening with libstdc++-11-dev
, which also provides <algorithm>
(and std::fill_n
, which seems to be one of the things used by ExportResult.cpp
). So it really seems like compiling with libstdc++11-dev ought to work.
bindgen cannot find C++/C header files = https://github.com/rust-lang/rust-bindgen/issues/1834
same problem as https://github.com/immunant/c2rust/issues/323#issuecomment-779224471 and https://github.com/immunant/c2rust/issues/323#issuecomment-788791767
solution concept:
possible alternative: use
llvm-config
to set these include pathsexample env's on nixos:
strangely, it works with
nix-shell
but fails withnix-build
(debugging this is on my todo list ...)c2rust.nix (draft) (WIP)
```nix /* nix-build -E 'with importtodo: add the
clang_arg
only when the env's are defined