sjml opened issue #3979:
Test Case
The problem is a build/link issue, so I created a minimal example in this repository.
Steps to Reproduce
- Assuming you have
make
and a mingw pipeline available...- Run
make
* the resulting executable inout/dynamic
runs fine on Windows with its accompanying DLL- Run
make wasmplay-static
, which runs the same compilation/linking command, but passes "-static" to it
* Note that it cannot even buildExpected Results
Being able to link wasmtime statically for a MinGW build.
Actual Results
Build fails.
Versions and Environment
Wasmtime version or commit: v0.35.1
Operating system: Building on macOS, running on Windows
Architecture: x86_64
Extra Info
Part of the issue seems to be these lines in
wasm.h
: note that it declares an external implementation (dllimport) if_WIN32
is defined, with no provision for static linking.If I change that so
WASM_API_EXTERN
is blank (as on other platforms) then it's able to link tolibwasmtime.a
, but then fails the build since it can't find a bunch of Windows libraries.If static linking with MinGW is not possible or practical, I understand, but what is the static
.a
library file used for, then? I note there's a DLL loading static lib, which I get, but it's not clear how to use the full static library, if it's even possible.I'm not a MinGW expert, so there may be something I'm missing here... thanks for whatever help you can offer.
sjml labeled issue #3979:
Test Case
The problem is a build/link issue, so I created a minimal example in this repository.
Steps to Reproduce
- Assuming you have
make
and a mingw pipeline available...- Run
make
* the resulting executable inout/dynamic
runs fine on Windows with its accompanying DLL- Run
make wasmplay-static
, which runs the same compilation/linking command, but passes "-static" to it
* Note that it cannot even buildExpected Results
Being able to link wasmtime statically for a MinGW build.
Actual Results
Build fails.
Versions and Environment
Wasmtime version or commit: v0.35.1
Operating system: Building on macOS, running on Windows
Architecture: x86_64
Extra Info
Part of the issue seems to be these lines in
wasm.h
: note that it declares an external implementation (dllimport) if_WIN32
is defined, with no provision for static linking.If I change that so
WASM_API_EXTERN
is blank (as on other platforms) then it's able to link tolibwasmtime.a
, but then fails the build since it can't find a bunch of Windows libraries.If static linking with MinGW is not possible or practical, I understand, but what is the static
.a
library file used for, then? I note there's a DLL loading static lib, which I get, but it's not clear how to use the full static library, if it's even possible.I'm not a MinGW expert, so there may be something I'm missing here... thanks for whatever help you can offer.
sjml edited issue #3979:
Test Case
The problem is a build/link issue, so I created a minimal example in this repository.
Steps to Reproduce
- Assuming you have
make
and a mingw pipeline available...- Run
make
* the resulting executable inout/dynamic
runs fine on Windows with its accompanying DLL- Run
make wasmplay-static
, which runs the same compilation/linking command, but passes "-static" to it
* Note that it cannot even build, error:undefined reference to
__imp_wasm_engine_new'`Expected Results
Being able to link wasmtime statically for a MinGW build.
Actual Results
Build fails.
Versions and Environment
Wasmtime version or commit: v0.35.1
Operating system: Building on macOS, running on Windows
Architecture: x86_64
Extra Info
Part of the issue seems to be these lines in
wasm.h
: note that it declares an external implementation (dllimport) if_WIN32
is defined, with no provision for static linking.If I change that so
WASM_API_EXTERN
is blank (as on other platforms) then it's able to link tolibwasmtime.a
, but then fails the build since it can't find a bunch of Windows libraries.If static linking with MinGW is not possible or practical, I understand, but what is the static
.a
library file used for, then? I note there's a DLL loading static lib, which I get, but it's not clear how to use the full static library, if it's even possible.I'm not a MinGW expert, so there may be something I'm missing here... thanks for whatever help you can offer.
sjml edited issue #3979:
Test Case
The problem is a build/link issue, so I created a minimal example in this repository.
Steps to Reproduce
- Assuming you have
make
and a mingw pipeline available...- Run
make
* the resulting executable inout/dynamic
runs fine on Windows with its accompanying DLL- Run
make wasmplay-static
, which runs the same compilation/linking command, but passes "-static" to it
* Note that it cannot even build, error:undefined reference to \
__imp_wasm_engine_new'`Expected Results
Being able to link wasmtime statically for a MinGW build.
Actual Results
Build fails.
Versions and Environment
Wasmtime version or commit: v0.35.1
Operating system: Building on macOS, running on Windows
Architecture: x86_64
Extra Info
Part of the issue seems to be these lines in
wasm.h
: note that it declares an external implementation (dllimport) if_WIN32
is defined, with no provision for static linking.If I change that so
WASM_API_EXTERN
is blank (as on other platforms) then it's able to link tolibwasmtime.a
, but then fails the build since it can't find a bunch of Windows libraries.If static linking with MinGW is not possible or practical, I understand, but what is the static
.a
library file used for, then? I note there's a DLL loading static lib, which I get, but it's not clear how to use the full static library, if it's even possible.I'm not a MinGW expert, so there may be something I'm missing here... thanks for whatever help you can offer.
sjml edited issue #3979:
Test Case
The problem is a build/link issue, so I created a minimal example in this repository.
Steps to Reproduce
- Assuming you have
make
and a mingw pipeline available...- Run
make
* the resulting executable inout/dynamic
runs fine on Windows with its accompanying DLL- Run
make wasmplay-static
, which runs the same compilation/linking command, but passes "-static" to it
* Note that it cannot even build, error:undefined reference to '__imp_wasm_engine_new'
Expected Results
Being able to link wasmtime statically for a MinGW build.
Actual Results
Build fails.
Versions and Environment
Wasmtime version or commit: v0.35.1
Operating system: Building on macOS, running on Windows
Architecture: x86_64
Extra Info
Part of the issue seems to be these lines in
wasm.h
: note that it declares an external implementation (dllimport) if_WIN32
is defined, with no provision for static linking.If I change that so
WASM_API_EXTERN
is blank (as on other platforms) then it's able to link tolibwasmtime.a
, but then fails the build since it can't find a bunch of Windows libraries.If static linking with MinGW is not possible or practical, I understand, but what is the static
.a
library file used for, then? I note there's a DLL loading static lib, which I get, but it's not clear how to use the full static library, if it's even possible.I'm not a MinGW expert, so there may be something I'm missing here... thanks for whatever help you can offer.
alexcrichton commented on issue #3979:
Yeah linking with Windows is a bit trickier than other platforms, as you've found you'll need to
-DWASM_API_EXTERN
on the command line to avoid the dllimport annotation. Note that when static linking you'll need to link all of the Windows libraries manually since they're not implicitly listed in the*.a
file.You can see an example of how this is done with the wasmtime-go compliation flags on Windows which statically links using MinGW I believe.
Can you try passing the extra
-l
flags and see if it works for you?
sjml commented on issue #3979:
Ah, yup that did the trick. Sorry to bug you on that -- very glad for the pointer to the wasmtime-go example.
sjml closed issue #3979:
Test Case
The problem is a build/link issue, so I created a minimal example in this repository.
Steps to Reproduce
- Assuming you have
make
and a mingw pipeline available...- Run
make
* the resulting executable inout/dynamic
runs fine on Windows with its accompanying DLL- Run
make wasmplay-static
, which runs the same compilation/linking command, but passes "-static" to it
* Note that it cannot even build, error:undefined reference to '__imp_wasm_engine_new'
Expected Results
Being able to link wasmtime statically for a MinGW build.
Actual Results
Build fails.
Versions and Environment
Wasmtime version or commit: v0.35.1
Operating system: Building on macOS, running on Windows
Architecture: x86_64
Extra Info
Part of the issue seems to be these lines in
wasm.h
: note that it declares an external implementation (dllimport) if_WIN32
is defined, with no provision for static linking.If I change that so
WASM_API_EXTERN
is blank (as on other platforms) then it's able to link tolibwasmtime.a
, but then fails the build since it can't find a bunch of Windows libraries.If static linking with MinGW is not possible or practical, I understand, but what is the static
.a
library file used for, then? I note there's a DLL loading static lib, which I get, but it's not clear how to use the full static library, if it's even possible.I'm not a MinGW expert, so there may be something I'm missing here... thanks for whatever help you can offer.
Last updated: Nov 22 2024 at 16:03 UTC