Open rjkroege opened 1 year ago
Can you share how are you compiling difftastic
actually?
Using environment from the Dockerfile
. I will note in passing that it failed for all of aarch64-apple-darwin
, x86_64-apple-darwin
, armv7-unknown-linux-musleabihf
, x86_64-unknown-linux-musl
. My exact build commands differed in each case. I'll use aarch64-apple-darwin
as an example:
CC=aarch64-apple-darwin22.2-clang \
CXX=aarch64-apple-darwin22.2-clang++ \
cargo build \
--release \
--target aarch64-apple-darwin
I see from the spew that the C++ compiler has executed because it generated many compilation warnings.
The behaviour for x86_64-unknown-linux-musl
differs (still doesn't work but different errors.) FWIW: I built like so:
CC=musl-gcc \
CXX=musl-g++ \
cargo build \
--release \
--target x86_64-unknown-linux-musl
It also failed in the link phase in a way that suggests a mismatch between libstdc++
(conceivably compiled against Gnu) and must. At least, thatI's what I think is happening. But see the "am I being an idiot?" in the original issue. 🙂
Here's the error:
= note: /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/12/libstdc++.a(stdexcept.o): in function `std::logic_error::~logic_error()':
(.text._ZNSt11logic_errorD2Ev+0x43): undefined reference to `__libc_single_threaded'
collect2: error: ld returned 1 exit status
= note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
= note: use the `-l` flag to specify native libraries to link
= note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)
Maybe I need to add a full musl cross gcc to the Docker (something like richfelker/musl-cross-make: Simple makefile-based build for musl cross compiler) to build difftastic
on Linux?
About musl, we probably have to do some clever stuff such as sysroot musl and add the necessary symlinks similar to cross.
But definitely, this will need some work to be able to statically link libstdc++
when targeting musl.
And regarding Darwin, for me looks like a mismatch issue but I have no clue about it at the moment, so I will try to figure it out.
But in general, there are interesting ideas in the cross project (which BTW difftastic
is using for the musl target).
So feel free to help.
Since I want this to work... I'll see if I can make this work better over the next few weeks and update the bug with anything that I figure out.
When I use the builder, crates that contain Rust-compiled C++ code fail to link. Example:
AFAIK:
lib tree-sitter-ada.a
is built from C++ code by thedifftastic
crate.This is working as intended? Or am I being an idiot?