September 01, 2020
On Tuesday, 1 September 2020 at 13:18:15 UTC, cbleser wrote:
> On Monday, 31 August 2020 at 08:31:11 UTC, Sebastiaan Koppe wrote:
>> It seems you don't have the right version of ldc/druntime/phobos. Please checkout https://github.com/skoppe/ldc/commit/828926064c52eba905d9bbbf9d4d57f64a2cd267
>
> Hi Sebastiaan.
> Thank you for you input. But still run into another problem.
>
>
> I corrected the branch now it compiles but it does not link.
>
> [...]
>
> --- cut ---
> Error: unrecognized file extension obj
> make[2]: *** [CMakeFiles/druntime-ldc.dir/build.make:1292: lib/libdruntime-ldc.a] Error 1
> make[2]: Leaving directory '/tmp/wasm_druntime/ldc-build-runtime.tmp'
> make[1]: *** [CMakeFiles/Makefile2:265: CMakeFiles/druntime-ldc.dir/all] Error 2
> make[1]: Leaving directory '/tmp/wasm_druntime/ldc-build-runtime.tmp'
> make: *** [Makefile:130: all] Error 2
> --- cut --

Ah yes, I missed that step. You need to patch the toolchain.

See the CI
https://github.com/tagion/ldc/blob/828926064c52eba905d9bbbf9d4d57f64a2cd267/.azure-pipelines/posix.yml#L159

Essentially replace `Wasm` with `Linux` in $WASI_SDK_PREFIX/share/cmake/wasi-sdk.cmake
September 02, 2020
On Tuesday, 1 September 2020 at 16:13:46 UTC, Sebastiaan Koppe wrote:

> Ah yes, I missed that step. You need to patch the sdk.
>
> See the CI
> https://github.com/tagion/ldc/blob/828926064c52eba905d9bbbf9d4d57f64a2cd267/.azure-pipelines/posix.yml#L159
>
> Essentially replace `Wasm` with `Linux` in $WASI_SDK_PREFIX/share/cmake/wasi-sdk.cmake

Thanks!! Now it runs.

Build script can be found here.

https://github.com/tagion/wasm_druntime.git


December 16, 2020
On Thursday, 6 August 2020 at 10:15:54 UTC, Sebastiaan Koppe wrote:
> On Wednesday, 5 August 2020 at 21:46:49 UTC, Hipreme wrote:

> 4) go into the ldc's runtime folder and run `ldc-build-runtime --ninja "--dFlags=-mtriple=wasm32-wasi" --ldcSrcDir=../ CMAKE_TOOLCHAIN_FILE="$WASI_SDK_PREFIX/share/cmake/wasi-sdk.cmake" WASI_SDK_PREFIX=$WASI_SDK_PREFIX BUILD_SHARED_LIBS=OFF` (you may need to build ldc-build-runtime first).

Dear Sebastiaan, I tried the steps you provided. I did it on both my ubuntu 16.04 and Win10. I am receiving the same error on both. I used WASI-SDK 11 for windows because it is the lowest version supporting windows. And please note that the latest WASI-SDK 12 raises some cmake errors that I cannot remember as of writing this.

This one is from Win10
ldc-build-runtime --ninja "--dFlags=-mtriple=wasm32-wasi" --ldcSrcDir=../ CMAKE_TOOLCHAIN_FILE="%WASI_SDK_PREFIX%/share/cmake/wasi-sdk.cmake" WASI_SDK_PREFIX=%WASI_SDK_PREFIX% BUILD_SHARED_LIBS=OFF

output:
https://gist.github.com/aferust/8dfbce368ebdf6b40e54ce9e9e12daa4

I reported my issues here as you said in your e-mail.

Thanks.
December 16, 2020
On Wednesday, 16 December 2020 at 20:07:44 UTC, Ferhat Kurtulmuş wrote:
> I am receiving the same error on both.

Looks like you're using LDC v1.24 to compile that older patched druntime - that won't work, compiler and druntime are tightly coupled. So you'll either need the LDC of that time, or rebase Sebastiaan's changes on top of https://github.com/ldc-developers/druntime/tree/ldc-v1.24.0.
December 17, 2020
On Wednesday, 16 December 2020 at 22:41:55 UTC, kinke wrote:
> On Wednesday, 16 December 2020 at 20:07:44 UTC, Ferhat Kurtulmuş wrote:
>> I am receiving the same error on both.
>
> Looks like you're using LDC v1.24 to compile that older patched druntime - that won't work, compiler and druntime are tightly coupled. So you'll either need the LDC of that time, or rebase Sebastiaan's changes on top of https://github.com/ldc-developers/druntime/tree/ldc-v1.24.0.

Oh, I see. Thank you. I will take that into account.
December 17, 2020
On Thursday, 17 December 2020 at 08:04:01 UTC, Ferhat Kurtulmuş wrote:
> On Wednesday, 16 December 2020 at 22:41:55 UTC, kinke wrote:
>> On Wednesday, 16 December 2020 at 20:07:44 UTC, Ferhat Kurtulmuş wrote:
>>> I am receiving the same error on both.
>>
>> Looks like you're using LDC v1.24 to compile that older patched druntime - that won't work, compiler and druntime are tightly coupled. So you'll either need the LDC of that time, or rebase Sebastiaan's changes on top of https://github.com/ldc-developers/druntime/tree/ldc-v1.24.0.
>
> Oh, I see. Thank you. I will take that into account.

Atleast so far I could compile it on Windows using:

ldc2-1.20
wasi-sdk-11.0
>> Essentially replace `Wasm` with `Linux` in $WASI_SDK_PREFIX/share/cmake/wasi-sdk.cmake

But I have to add `version (WebAssembly){}else:` at the beginnings of the files related with cpp: core/stdcpp/ exception.d, /new_d, /string_view.d, /typeinfo.d.
December 18, 2020
On Thursday, 17 December 2020 at 11:34:32 UTC, Ferhat Kurtulmuş wrote:
> On Thursday, 17 December 2020 at 08:04:01 UTC, Ferhat Kurtulmuş wrote:
>> On Wednesday, 16 December 2020 at 22:41:55 UTC, kinke wrote:
>>> On Wednesday, 16 December 2020 at 20:07:44 UTC, Ferhat

I cannot compile a test program on Windows using Sebastiaan's druntime. Do I need to compile the ldc from scratch? I am using a precompiled one. Why do I get `cannot find source code for runtime library file 'object.d'`? ldc2.conf has already the required include paths?

TLDR: Failed to invoke the compiler ldc2 to determine the build platform: binary

import std.stdio;

void main() {
    import core.stdc.stdio;
    printf("exit");
}

dub.json includes:
"buildRequirements": ["allowWarnings"],
"dflags": ["-mtriple=wasm32-unknown-unknown-wasm"]

etc/ldc2.conf includes

"^wasm(32|64)-":
{
    switches = [
        "-defaultlib=c,druntime-ldc,phobos2-ldc",
        "-link-internally",
    ];
    post-switches = [
     "-ID:/dlang/ldc/runtime/druntime/src>",
     "-ID:/dlang/ldc/runtime/phobos>",
    ],
    lib-dirs = ["D:/dlang/ldc/runtime/ldc-build-runtime.tmp/lib>","D:/dlang/wasi-sdk-11.0/share/wasi-sysroot/lib/wasm32-wasi/>"];
};

set PATH=%PATH%;D:\dlang\ldc2-1.20.0-windows-multilib\bin
dub --arch=wasm32-unknown-unknown-wasm --build-mode=allAtOnce --compiler=ldc2

and the output is

Failed to invoke the compiler ldc2 to determine the build platform: binary    D:\dlang\ldc2-1.20.0-windows-multilib\bin\ldc2.exe
version   1.20.0 (DMD v2.090.1, LLVM 9.0.1)
config    D:\dlang\ldc2-1.20.0-windows-multilib\etc\ldc2.conf (wasm32-unknown-unknown-wasm)
predefs   LDC all D_Version2 assert D_ModuleInfo D_Exceptions D_TypeInfo WebAssembly LittleEndian LDC_LLVM_900
parse     dub_platform_probe_162f26df_07c5_464d_99bd_3df41eb112d9
importall dub_platform_probe
Error: cannot find source code for runtime library file 'object.d'
       ldc2 might not be correctly installed.
       Please check your ldc2.conf configuration file.
       Installation instructions can be found at http://wiki.dlang.org/LDC.
import path[0] = D:\dlang\ldc\runtime\druntime\src>
import path[1] = D:\dlang\ldc\runtime\phobos>



December 18, 2020
On Friday, 18 December 2020 at 12:32:53 UTC, Ferhat Kurtulmuş wrote:
> import path[0] = D:\dlang\ldc\runtime\druntime\src>
> import path[1] = D:\dlang\ldc\runtime\phobos>

Your ldc2.conf is wrong, get rid of the trailing `>` in the import and lib paths. You also don't need -mtriple in dub.json; that's added by dub with the `--arch` option.
December 18, 2020
On Friday, 18 December 2020 at 13:29:17 UTC, kinke wrote:
> On Friday, 18 December 2020 at 12:32:53 UTC, Ferhat Kurtulmuş wrote:
>> import path[0] = D:\dlang\ldc\runtime\druntime\src>
>> import path[1] = D:\dlang\ldc\runtime\phobos>
>
> Your ldc2.conf is wrong, get rid of the trailing `>` in the import and lib paths. You also don't need -mtriple in dub.json; that's added by dub with the `--arch` option.

Yes, that was the problem. I didn't even know such a file exists.

Thank you again.
December 18, 2020
On Friday, 18 December 2020 at 17:53:39 UTC, Ferhat Kurtulmuş wrote:
> On Friday, 18 December 2020 at 13:29:17 UTC, kinke wrote:
>> On Friday, 18 December 2020 at 12:32:53 UTC, Ferhat Kurtulmuş wrote:
>>> import path[0] = D:\dlang\ldc\runtime\druntime\src>
>>> import path[1] = D:\dlang\ldc\runtime\phobos>
>>
>> Your ldc2.conf is wrong, get rid of the trailing `>` in the import and lib paths. You also don't need -mtriple in dub.json; that's added by dub with the `--arch` option.
>
> Yes, that was the problem. I didn't even know such a file exists.
>
> Thank you again.

Just for records, in my case, I could compile the test code with some workarounds due to missing symbols although I switched back to wasm-sdk-8.

extern(C) void proc_exit(int exitcode){
    import core.stdc.stdlib;
    exit(exitcode);
}

extern(C) int __wasi_clock_res_get(uint32_t id, uint64_t* resolution);
extern(C) int clock_res_get(uint32_t id, uint64_t* resolution){
    return __wasi_clock_res_get(id, resolution);
}

extern(C) int __wasi_clock_time_get(uint32_t id, uint64_t precision, uint64_t* time);
extern(C) int clock_time_get(uint32_t id, uint64_t precision, uint64_t* time){
    return __wasi_clock_time_get(id, precision, time);
}
1 2
Next ›   Last »