-
-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compiling for WebAssembly uses host file extensions #1749
Comments
I think there are different ways to solve this. Either by a new build options "wasm" which would be a rather small fix, or by having a complete solution as described here @wilzbach |
I don't know about a new build option, I feel it doesn't fit the bill. I have to look at the code to really propose something, but a new entry for $ARCH seems to be in the right direction. But I don't yet see how dub can infer we are targeting wasm. |
Yeah, I think using triples works great. Do you know if anybody is moving forward on that? I see several issues going back to 2014 about extending arch or using triples. |
There might be a chance that this year someone will work on AOC on "multi language support for Dub" (https://forum.dlang.org/thread/fhtfxkidkeaetdkquatn@forum.dlang.org). But beside of this I am not aware that someone at the moment is active at all on enhancing dub. If there would be a pull by someone ;) the chances are very very high that it is accepted. |
By simply treating all non-empty strings except for special `x86[_64]` as `-mtriple` values. E.g., `dub --arch=wasm32-unknown-unknown-wasm` to cross-compile to WebAssembly. This dub switch is already used when probing the compiler, so the build platform detection works as expected. Also add `wasm` as detected platform and use the .wasm executable file extension (for ldc2). This fixes dlang#1749 when moving the `-mtriple` option from the dub config file to the dub command line.
By treating all 'architectures' containing a `-` as `-mtriple` values. E.g., `dub --arch=wasm32-unknown-unknown-wasm` to cross-compile to WebAssembly. This dub switch is already used when probing the compiler, so the build platform detection works as expected. Also add `wasm` as detected platform and use the .wasm executable file extension (for ldc2). This fixes dlang#1749 when moving the `-mtriple` option from the dub config file to the dub command line.
System information
Bug Description
Dub isn't aware of the webassembly target and uses host file extensions for static libraries and the final binary. On windows this means the static libraries are named
.lib
, while ldc expect wasm libraries to have the.a
extensions, and the final binary is named.exe
. On Linux the final binary has no.wasm
extension.How to reproduce?
ldc2 --version
showswasm32
target (I usedlang2/ldc-ubuntu:1.16.0
docker image)dub build --build=release --config=executable
dub build --build=release --config=library
Expected Behavior
On windows the library config should result in an
wasm-file-extension.a
file. And the executable config should result in awasm-file-extension.wasm
file.On linux the executable config should result in a
wasm-file-extension.wasm
file.The text was updated successfully, but these errors were encountered: