Closed xMAC94x closed 2 weeks ago
Those are windows error code constants. Either mimalloc messed up their includes somehow, or you messed up your cross-compilation environment. Giving the relevant file a quick once-over, I don't see anything immediately wrong with it, but I might have missed something. Maybe try to compile mimalloc separately in a similar environment?
I can give it a try, we just reverted the latest version here: https://gitlab.com/veloren/veloren/-/merge_requests/4522/diffs?commit_id=54e3cef22362825b3c998c746b48845484a1c9b9 and the result is a flawless compilation https://gitlab.com/veloren/veloren-docker-ci/-/jobs/7302239817
Edit the failing function was added since the last version libmimalloc-sys@0.1.38 and libmimalloc-sys@0.1.39 thats mimalloc 61418436 -> 8c532c32 Also the latest tag is not passing CI completely (though the logs seems to no longer exist)
Here is a minimal reproduction scenario:
git clone https://github.com/purpleprotocol/mimalloc_rust.git
cd mimalloc_rust
git submodule update --init --recursive
create file Dockerfile
FROM rust:1.79.0-bullseye
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive \
&& apt-get install -y --no-install-recommends --assume-yes \
# Needed to cross compile to windows
gcc-mingw-w64-x86-64 \
gcc \
libc-dev \
python3 \
g++-mingw-w64-x86-64 \
# Cleanup extra cached files
&& rm -rf /var/lib/apt/lists/*;
RUN mkdir -p /root/.cargo && echo \
"[target.x86_64-pc-windows-gnu]\nlinker = \"/usr/bin/x86_64-w64-mingw32-gcc\"\n" \
>> /root/.cargo/config \
&& rustup target add x86_64-pc-windows-gnu
COPY . /opt
WORKDIR /opt
RUN cargo build --target=x86_64-pc-windows-gnu --release
run file docker build .
verify that old version still works: git checkout v0.1.42
, repeat docker build steps from above
looks like that installs mingw 8 and version 10 is needed: version correspondence https://www.mingw-w64.org/downloads/ commit adding error code https://github.com/mirror/mingw-w64/commit/558907c052696dc20fea9a5c5140fae7c51ed2b8
Quick test would be to change the rust:1.79.0-bullseye
in the Dockerfile
to rust:1.79.0-bookworm
, as that has mingw 10. Don't currently have docker set up on my computer to test.
Can confirm: switching to bookworm indeed fixes the problem, which verifies that a mingw version requirement was the culprit.
This issue can therefore be closed.
Thanks for analysing this, I am going to close this issue, the workaround is: update your OS to one with the respective mingw version of at least:
libmimalloc-sys@v0.1.38
-> 8
libmimalloc-sys@v0.1.39
-> 10
if you want to use this crate.
Hey folks, we at veloren use cross-compile from linux for windows builds. since the latest version we get a compilation error which looks like this. Seems to be a C constant missing, however I couldn't find neither ERROR_COMMITMENT_LIMIT nor ERROR_COMMITMENT_MINIMUM.
Is there a new version available which works on windows? e.g. with a never mimalloc subrepo ?
Note: windows, linux and macos compilation on respectives hosts works flawlessly, it seems to be just the cross compilation. BaseOS us ubuntu 22.04
Any Idea what might be wrong ?
Full logs: https://gitlab.com/veloren/veloren-docker-ci/-/jobs/7300415963