Skip to content

nar-compile cannot find mt.exe with Visual Studio 2017 #335

@bribass

Description

@bribass

The attached nar-issue.zip contains a project that builds a JAR and a JNI library. When built on a Windows 10 machine with Visual Studio 2017 (version 15.9.7), nar-compile fails to build the DLL because it cannot find mt.exe.

[INFO] --- nar-maven-plugin:3.6.0:nar-compile (default-nar-compile) @ nar-mt-issue ---
[INFO] Compiling 1 native files
[INFO] 1 total files to be compiled.
[INFO] Found 8 processors available
[INFO] Limited used processors to 1
[INFO]
Starting Core 0 with 1 source files...
[INFO] native.c
[INFO] Linking...
[INFO] Starting link {link /MANIFEST /MANIFESTFILE:C:\src\terrsrv\pythonsrv\src\nar-issue\target\nar\nar-mt-issue-0.1-SNAPSHOT-amd64-Windows-msvc-jni\lib\amd64-Windows-msvc\jni\native.manifest /MACHINE:X64 /LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\lib\x64 /LIBPATH:C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64 /LIBPATH:C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\um\x64 /NOLOGO /DLL /SUBSYSTEM:CONSOLE /INCREMENTAL:NO}
[INFO]    Creating library native.lib and object native.exp
[INFO] + mt.exe /manifest C:\src\terrsrv\pythonsrv\src\nar-issue\target\nar\nar-mt-issue-0.1-SNAPSHOT-amd64-Windows-msvc-jni\lib\amd64-Windows-msvc\jni\native.manifest /outputresource:C:\src\terrsrv\pythonsrv\src\nar-issue\target\nar\nar-mt-issue-0.1-SNAPSHOT-amd64-Windows-msvc-jni\lib\amd64-Windows-msvc\jni\native.dll;#2
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.039 s
[INFO] Finished at: 2019-03-01T14:32:01-08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.maven-nar:nar-maven-plugin:3.6.0:nar-compile (default-nar-compile) on project nar-mt-issue: Could not launch cmd.exe /X /C "mt.exe /manifest C:\src\terrsrv\pythonsrv\src\nar-issue\target\nar\nar-mt-issue-0.1-SNAPSHOT-amd64-Windows-msvc-jni\lib\amd64-Windows-msvc\jni\native.manifest /outputresource:C:\src\terrsrv\pythonsrv\src\nar-issue\target\nar\nar-mt-issue-0.1-SNAPSHOT-amd64-Windows-msvc-jni\lib\amd64-Windows-msvc\jni\native.dll;#2": Error while executing process. Cannot run program "mt.exe": CreateProcess error=2, The system cannot find the file specified -> [Help 1]

If I add the directory C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64 (the directory in which mt.exe resides) to the PATH, nar-compile succeeds. However, since nar-maven-plugin automatically determines paths for other parts of nar-compile (i.e., the compiler and the linker), this is not expected (or desired) behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions