Open apbryan opened 8 months ago
✅ PR OK, no changes in deprecations or warnings
Total deprecations: 8
Total warnings: 0
Build statistics:
statistics (-before, +after)
executable size=5293368 bin/dub
-rough build time=62s
+rough build time=61s
Open question: should dub attempt to detect if the version of the compiler supports cImportPaths ?
Everything is in place for it to work, so it could do it.
Tested (on my machine) with ldc2 1.35.0 based on DMD v2.105.2
Moving on to adding a test case to $REPO/test. Will the automatic test runner be running with a new enough version of ldc?
Looks like the test is failing ?
Looks like the test is failing ?
The test script attempts a build of a dummy project first with dmd, then with ldc via dub's --compiler flag. The jobs labeled with dmd fail at the ldc step, and the jobs labeled with ldc fail at the dmd step. Do the jobs labeled with a certain compiler not have any of the other compilers installed?
Do the jobs labeled with a certain compiler not have any of the other compilers installed?
That's correct, to prevent those kinds of mistake.
Do the jobs labeled with a certain compiler not have any of the other compilers installed?
That's correct, to prevent those kinds of mistake.
So if I change test/issue2698-cimport-paths-broken-with-dmd-ldc.sh to simply call ${DUB} build --root test/issue2698-cimoort-paths-broken-with-dmd-ldc, is this redundant? I noticed there's a test/run-unittest.sh that will go through and run dub build/run/test on every folder in test/ that doesn't have a special dotfile to disable build/run/test. Should I delete the issue-specific .sh file (which only call dub build) and depend on run-unittest.sh
Yes, if you have have something that just succeeds/fails with dub build
it's less work.
Ok, so the only builds that are failing at the moment are windows builds with dmd. Here is the relevant output:
[INFO] Building /d/a/dub/dub/test/issue2698-cimportpaths-broken-with-dmd-ldc/...
Starting Performing "debug" build using dmd for x86_64.
Building issue2698-cimportpaths-broken-with-dmd-ldc ~master: building configuration [application]
Error: C preprocess command C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\cl.exe failed for file test\issue2698-cimportpaths-broken-with-dmd-ldc\source\foo.c, exit status 2
C:\hostedtoolcache\windows\dc\dmd-2.106.1\x64\dmd2\windows\bin64\..\..\src\druntime\import\importc.h(134): fatal error C1083: Cannot open include file: 'sal.h': No such file or directory
Error dmd failed with exit code 1.
[ERROR] Build failure.
[INFO] Running /d/a/dub/dub/test/issue2698-cimportpaths-broken-with-dmd-ldc/...
Starting Performing "debug" build using dmd for x86_64.
Building issue2698-cimportpaths-broken-with-dmd-ldc ~master: building configuration [application]
Error: C preprocess command C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\cl.exe failed for file test\issue2698-cimportpaths-broken-with-dmd-ldc\source\foo.c, exit status 2
C:\hostedtoolcache\windows\dc\dmd-2.106.1\x64\dmd2\windows\bin64\..\..\src\druntime\import\importc.h(134): fatal error C1083: Cannot open include file: 'sal.h': No such file or directory
Error dmd failed with exit code 1.
[ERROR] Run failure.
[INFO] Testing /d/a/dub/dub/test/issue2698-cimportpaths-broken-with-dmd-ldc/...
Generating test runner configuration 'issue2698-cimportpaths-broken-with-dmd-ldc-test-library' for 'library' (library).
Starting Performing "unittest" build using dmd for x86_64.
Building issue2698-cimportpaths-broken-with-dmd-ldc ~master: building configuration [issue2698-cimportpaths-broken-with-dmd-ldc-test-library]
Error: C preprocess command C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\cl.exe failed for file source\foo.c, exit status 2
C:\hostedtoolcache\windows\dc\dmd-2.106.1\x64\dmd2\windows\bin64\..\..\src\druntime\import\importc.h(134): fatal error C1083: Cannot open include file: 'sal.h': No such file or directory
Error dmd failed with exit code 1.
[ERROR] Test failure.
I hate to point fingers......but it looks to me like this error is unrelated to my changes. It'll take me a little time to get a dev environment set up on windows to look into this. In the meantime, do you (@Geod24) see anything obvious to point me in the right direction?
@apbryan ImportC does not work with dmd on Windows as it is. Issue 24308 - [ImportC] druntime\import\importc.h(134): fatal error C1034: sal.h: no include path set Issue 24111 - [ImportC] fatal error C1034: stdio.h: no include path set
D:\labo\dlang\dub\test\issue2698-cimportpaths-broken-with-dmd-ldc>set VCTOOLSINSTALLDIR
Environment variable VCTOOLSINSTALLDIR not defined
D:\labo\dlang\dub\test\issue2698-cimportpaths-broken-with-dmd-ldc>set VCINSTALLDIR
Environment variable VCINSTALLDIR not defined
D:\labo\dlang\dub\test\issue2698-cimportpaths-broken-with-dmd-ldc>set UniversalCRTSdkDir
Environment variable UniversalCRTSdkDir not defined
D:\labo\dlang\dub\test\issue2698-cimportpaths-broken-with-dmd-ldc>set WindowsSdkDir
Environment variable WindowsSdkDir not defined
D:\labo\dlang\dub\test\issue2698-cimportpaths-broken-with-dmd-ldc>..\..\bin\dub run --compiler=dmd
Starting Performing "debug" build using dmd for x86_64.
Building issue2698-cimportpaths-broken-with-dmd-ldc ~master: building configuration [application]
cl : コマンド ライン warning D9002 : 不明なオプション '/Zc:preprocessor' を無視します。
cl : コマンド ライン warning D9002 : 不明なオプション '/PD' を無視します。
D:\scoop\user\apps\dmd\current\windows\bin64\..\..\src\druntime\import\importc.h(140): fatal error C1083: include t@CJ܂B'sal.h':No such file or directory
Error: C preprocess command D:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\cl.exe failed for file source\foo.c, exit status 2
Error dmd failed with exit code 1.
In order for ImportC to work, Visual Studio(or Build Tools) and Windows SDK must be installed and the Visual Studio environment variables must be set. Startup VS Native Tools Command Prompt and run.
d:\labo\dlang\dub\test\issue2698-cimportpaths-broken-with-dmd-ldc>..\..\bin\dub run --compiler=dmd
Starting Performing "debug" build using dmd for x86_64.
Up-to-date issue2698-cimportpaths-broken-with-dmd-ldc ~master: target for configuration [application] is up to date.
Finished To force a rebuild of up-to-date targets, run again with --force
Running issue2698-cimportpaths-broken-with-dmd-ldc.exe
func bar in foo.h
Unlike LDC, the environment variable setting process in dmd does not seem to be working properly yet.
D:\labo\dlang\dub\test\issue2698-cimportpaths-broken-with-dmd-ldc>dmd --version
DMD64 D Compiler v2.107.0
@apbryan : I took the liberty to rebase your PR and try a solution to the problem. That didn't quite work, I'll try a few more things tonight.
@apbryan : I took the liberty to rebase your PR and try a solution to the problem. That didn't quite work, I'll try a few more things tonight.
Wonderful. I haven't had time to dig into this myself (doing very important work playing stormgate). It's nice to see the work being done!
@Geod24 I tried Github Actions. I only needed to set up the preferences for DMD, so I was able to pass with the following settings.
- name: '[Windows] Add VC toolset to PATH (DMD only)'
if: ${{ runner.os == 'Windows' && env.DC == 'dmd' }}
uses: ilammy/msvc-dev-cmd@v1
@apbryan @Geod24 That windows-dmd error is due to https://issues.dlang.org/show_bug.cgi?id=24111 The bug fixes I have implemented will fix this. I would recommend waiting for the current dmd-master to become dmd-latest ( release dmd 2.109.0 ), then trying git rebase to dub's master. Or, as @takinutani points out, setting the INCLUDE environment variable in msvc will solve the problem.
I think this PR would pass the test now.
Looks like one automated test failed (buildkite/dub) because whatever box/VM it was running on didn't have a new enough version of LLVM to build ldc with.
From the log: CMake Error at cmake/Modules/FindLLVM.cmake:62 (message): Unsupported LLVM version 14.0.0 found (/bin/llvm-config). At least version 15.0 is required. You can also set variables 'LLVM_ROOT_DIR' or 'LLVM_CONFIG' to use a different LLVM installation. Call Stack (most recent call first): cmake/Modules/FindLLVM.cmake:190 (_LLVM_FAIL) CMakeLists.txt:37 (find_package)
Addresses issue 2698 where the wrong flags are passed to dmd and ldc2 such that cImportPaths do not work. I tested with the dmd version I have currently installed (2.106.1), but have not tested with the old version of ldc2 I have (1.28.0 based on dmd 2.098.0) as it does not appear to support the -P arg for passing C preprocessor flags
Still need to:
Open question: should dub attempt to detect if the version of the compiler supports cImportPaths ?