Fix Dub package when cross-compiling#9275
Conversation
|
Thanks for your pull request and interest in making D better, @jacob-carlborg! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub fetch digger
dub run digger -- build "master + dmd#9275" |
Please do them as 2 PRs, then. |
|
I don't see the problem of looking at the individual commits. |
|
DAutoTest Say what? |
Hmm, I didn't know that DAutoTest was building the Dub package. But for Semaphore I instead get: |
Turns out that the |
|
BTW, this blocks: #8528. |
cc @CyberShadow |
I think it's coming from here: |
|
Unless it is known for a fact that |
If |
That's fine. If that's your only concern, I recommend that you apply the change I suggested above. |
|
Any equivalent for Windows? |
|
Not in its variable substitution syntax, as far as I know, so only as a separate command. Not updating the Windows command only means that Windows users will have no choice but to update to 2.084, which doesn't seem like a problem. |
|
I got this error following your advice: |
|
And |
Yes, it's special Dub syntax. Some variables will be substituted before the command is run. |
|
I can't find the implementation for parsing that syntax in Dub's source code. It looks like it's just using Edit: Found something, looking into it. |
It must be doing that before calling
Yes, otherwise I get |
|
Oh. Looks like it's a Dub bug. Look at this function: Instead of looking for Never mind my suggestion I guess... |
|
The issue comes from the fact that Dub uses the same variable syntax as Bash. On Windows [1] it's not a problem because the shell on Windows uses [1] https://github.com/dlang/dmd/pull/9275/files#diff-406ece895a5b70a272cd76a2ef902836R43 |
|
Yes, but that doesn't change what I wrote above. Its escaping logic is wrong. |
|
Ok. |
Here it is: dlang/dub#1641 |
c378bde to
5d0d648
Compare
|
@jacob-carlborg In order for the tests to pass on SemaphoreCI, replace Lines 39 to 48 in 54a2a5a with: |
7794aea to
dff9e49
Compare
The pre generate commands were using the native platform instead of target platform.
0b3a621 to
ca4f0d7
Compare
|
@thewilsonator @ZombineDev all tests are passing, finally 😃. |
|
Nice I take it it is goo to go? |
Yes. I had to download Dub separately on Semaphore when using LDC 1.11.0. Because the version of Dub shipped with LDC 1.11.0 is too old and doesn't support the |
|
Can you report the linker error please? |
|
Sure. |
|
Thanks. |
|
Has already been reported: ldc-developers/ldc#2954. |
The build of the lexer dub subpackage requires running and building a little config.d tool as custom pregenerate command. Forwarding the target architecture via `--arch=$DUB_ARCH` to the nested dub build of config.d was added in dlang#9275, to fix cross- compilation, but in reality broke it. Not specifying the architecture explicitly for the little helper build lets the compiler pick the default one, the host's native platform in practice, which is guaranteed to be runnable on that compiling **host**, independent from the **target** platform for the main dub build. Suppose one cross-compiles the dmd:lexer subpackage from x86_64 to AArch64 - an AArch64 config.d executable will hardly run on the x86_64 host, and won't be able to generate the `VERSION` and `SYSCONFDIR.imp` string-import files as pre- requisite of the build. Side note: using little separately-built .d tools/scripts as build helpers for autogenerating little VERSION files etc. is IMO bad practice - when cross-compiling, you require a D compiler that can a) cross-compile, and b) build successfully for the native platform too. Not sure this approach will e.g. ever work with GDC, where you have different toolchains for each host->target combination.
The build of the lexer dub subpackage requires running and building a little config.d tool as custom pregenerate command. Forwarding the target architecture via `--arch=$DUB_ARCH` to the nested dub build of config.d was added in #9275, to fix cross- compilation, but in reality broke it. Not specifying the architecture explicitly for the little helper build lets the compiler pick the default one, the host's native platform in practice, which is guaranteed to be runnable on that compiling **host**, independent from the **target** platform for the main dub build. Suppose one cross-compiles the dmd:lexer subpackage from x86_64 to AArch64 - an AArch64 config.d executable will hardly run on the x86_64 host, and won't be able to generate the `VERSION` and `SYSCONFDIR.imp` string-import files as pre- requisite of the build. Side note: using little separately-built .d tools/scripts as build helpers for autogenerating little VERSION files etc. is IMO bad practice - when cross-compiling, you require a D compiler that can a) cross-compile, and b) build successfully for the native platform too. Not sure this approach will e.g. ever work with GDC, where you have different toolchains for each host->target combination.
The build of the lexer dub subpackage requires running and building a little config.d tool as custom pregenerate command. Forwarding the target architecture via `--arch=$DUB_ARCH` to the nested dub build of config.d was added in dlang#9275, to fix cross- compilation, but in reality broke it. Not specifying the architecture explicitly for the little helper build lets the compiler pick the default one, the host's native platform in practice, which is guaranteed to be runnable on that compiling **host**, independent from the **target** platform for the main dub build. Suppose one cross-compiles the dmd:lexer subpackage from x86_64 to AArch64 - an AArch64 config.d executable will hardly run on the x86_64 host, and won't be able to generate the `VERSION` and `SYSCONFDIR.imp` string-import files as pre- requisite of the build. Side note: using little separately-built .d tools/scripts as build helpers for autogenerating little VERSION files etc. is IMO bad practice - when cross-compiling, you require a D compiler that can a) cross-compile, and b) build successfully for the native platform too. Not sure this approach will e.g. ever work with GDC, where you have different toolchains for each host->target combination.
There are two commits, I recommend reviewing them separately.