`mt.exe` issue with CMake
falhumai96 opened this issue · 7 comments
Hello @mstorsjo,
I was trying to build a C/C++ project a while ago (not sure whether it was ZLib or LLVM, but pretty sure it was a CMake-based project), and CMake was failing on mt.exe
. However, if mt.exe
ran again after failing the first time, CMake would pass.
I was about to make the following change to the script, but was hesitant whether or not this is a hacky fix:
diff --git a/wrappers/mt b/wrappers/mt
index 30349ed..f6f359f 100755
--- a/wrappers/mt
+++ b/wrappers/mt
@@ -1,3 +1,7 @@
#!/bin/bash
. $(dirname $0)/msvcenv.sh
$(dirname $0)/wine-msvc.sh $SDKBINDIR/mt.exe "$@"
+
+if [ $? -ne 0 ]; then
+ $(dirname $0)/wine-msvc.sh $SDKBINDIR/mt.exe "$@"
+fi
Hello @mstorsjo,
I was trying to build a C/C++ project a while ago (not sure whether it was ZLib or LLVM, but pretty sure it was a CMake-based project), and CMake was failing on
mt.exe
. However, ifmt.exe
ran again after failing the first time, CMake would pass.I was about to make the following change to the script, but was hesitant whether or not this is a hacky fix:
diff --git a/wrappers/mt b/wrappers/mt index 30349ed..f6f359f 100755 --- a/wrappers/mt +++ b/wrappers/mt @@ -1,3 +1,7 @@ #!/bin/bash . $(dirname $0)/msvcenv.sh $(dirname $0)/wine-msvc.sh $SDKBINDIR/mt.exe "$@" + +if [ $? -ne 0 ]; then + $(dirname $0)/wine-msvc.sh $SDKBINDIR/mt.exe "$@" +fi
More context:
This was used with cccl, but I believe this issue will also happen if I use a CMake project in Linux that cross-compiles to MSVC Windows using this toolchain with cccl
.
Hello @mstorsjo,
I was trying to build a C/C++ project a while ago (not sure whether it was ZLib or LLVM, but pretty sure it was a CMake-based project), and CMake was failing onmt.exe
. However, ifmt.exe
ran again after failing the first time, CMake would pass.
I was about to make the following change to the script, but was hesitant whether or not this is a hacky fix:diff --git a/wrappers/mt b/wrappers/mt index 30349ed..f6f359f 100755 --- a/wrappers/mt +++ b/wrappers/mt @@ -1,3 +1,7 @@ #!/bin/bash . $(dirname $0)/msvcenv.sh $(dirname $0)/wine-msvc.sh $SDKBINDIR/mt.exe "$@" + +if [ $? -ne 0 ]; then + $(dirname $0)/wine-msvc.sh $SDKBINDIR/mt.exe "$@" +fi
More context:
This was used with cccl, but I believe this issue will also happen if I use a CMake project in Linux that cross-compiles to MSVC Windows using this toolchain with
cccl
.
Did you do this with the patched version of cmake with this change? https://gitlab.kitware.com/mstorsjo/cmake/-/commit/06e5e18d386041a3ec73cf9b0d4dcbc1290ef176
Hello @mstorsjo,
I was trying to build a C/C++ project a while ago (not sure whether it was ZLib or LLVM, but pretty sure it was a CMake-based project), and CMake was failing onmt.exe
. However, ifmt.exe
ran again after failing the first time, CMake would pass.
I was about to make the following change to the script, but was hesitant whether or not this is a hacky fix:diff --git a/wrappers/mt b/wrappers/mt index 30349ed..f6f359f 100755 --- a/wrappers/mt +++ b/wrappers/mt @@ -1,3 +1,7 @@ #!/bin/bash . $(dirname $0)/msvcenv.sh $(dirname $0)/wine-msvc.sh $SDKBINDIR/mt.exe "$@" + +if [ $? -ne 0 ]; then + $(dirname $0)/wine-msvc.sh $SDKBINDIR/mt.exe "$@" +fi
More context:
This was used with cccl, but I believe this issue will also happen if I use a CMake project in Linux that cross-compiles to MSVC Windows using this toolchain withcccl
.Did you do this with the patched version of cmake with this change? https://gitlab.kitware.com/mstorsjo/cmake/-/commit/06e5e18d386041a3ec73cf9b0d4dcbc1290ef176
No, I have not. Apparently, I missed this part. I will test it again, and if it passes with this patched version of CMake, I'll close this issue. Thank you for suggesting the patch.
Hello @mstorsjo,
I was trying to build a C/C++ project a while ago (not sure whether it was ZLib or LLVM, but pretty sure it was a CMake-based project), and CMake was failing onmt.exe
. However, ifmt.exe
ran again after failing the first time, CMake would pass.
I was about to make the following change to the script, but was hesitant whether or not this is a hacky fix:diff --git a/wrappers/mt b/wrappers/mt index 30349ed..f6f359f 100755 --- a/wrappers/mt +++ b/wrappers/mt @@ -1,3 +1,7 @@ #!/bin/bash . $(dirname $0)/msvcenv.sh $(dirname $0)/wine-msvc.sh $SDKBINDIR/mt.exe "$@" + +if [ $? -ne 0 ]; then + $(dirname $0)/wine-msvc.sh $SDKBINDIR/mt.exe "$@" +fi
More context:
This was used with cccl, but I believe this issue will also happen if I use a CMake project in Linux that cross-compiles to MSVC Windows using this toolchain withcccl
.Did you do this with the patched version of cmake with this change? https://gitlab.kitware.com/mstorsjo/cmake/-/commit/06e5e18d386041a3ec73cf9b0d4dcbc1290ef176
No, I have not. Apparently, I missed this part. I will test it again, and if it passes with this patched version of CMake, I'll close this issue. Thank you for suggesting the patch.
By the way, what's the point of the if-statement in the patch if the condition will always be false? Might as well delete the if-statement block entirely.
Hello @mstorsjo,
I was trying to build a C/C++ project a while ago (not sure whether it was ZLib or LLVM, but pretty sure it was a CMake-based project), and CMake was failing onmt.exe
. However, ifmt.exe
ran again after failing the first time, CMake would pass.
I was about to make the following change to the script, but was hesitant whether or not this is a hacky fix:diff --git a/wrappers/mt b/wrappers/mt index 30349ed..f6f359f 100755 --- a/wrappers/mt +++ b/wrappers/mt @@ -1,3 +1,7 @@ #!/bin/bash . $(dirname $0)/msvcenv.sh $(dirname $0)/wine-msvc.sh $SDKBINDIR/mt.exe "$@" + +if [ $? -ne 0 ]; then + $(dirname $0)/wine-msvc.sh $SDKBINDIR/mt.exe "$@" +fi
More context:
This was used with cccl, but I believe this issue will also happen if I use a CMake project in Linux that cross-compiles to MSVC Windows using this toolchain withcccl
.Did you do this with the patched version of cmake with this change? https://gitlab.kitware.com/mstorsjo/cmake/-/commit/06e5e18d386041a3ec73cf9b0d4dcbc1290ef176
No, I have not. Apparently, I missed this part. I will test it again, and if it passes with this patched version of CMake, I'll close this issue. Thank you for suggesting the patch.
By the way, what's the point of the if-statement in the patch if the condition will always be false? Might as well delete the if-statement block entirely.
Also, can you update the README
of this repo with the link to the CMake patch including the Ninja and cl
errors fixed, please?
By the way, what's the point of the if-statement in the patch if the condition will always be false? Might as well delete the if-statement block entirely.
No point other than keeping the patch as small and simple as possible (e.g. less risk for merge conflicts when applying the change to newer upstream versions.
Also, can you update the
README
of this repo with the link to the CMake patch including the Ninja andcl
errors fixed, please?
The readme already points to it:
# Custom CMake git clone https://gitlab.kitware.com/mstorsjo/cmake.git cd cmake git checkout 844ccd2280d11ada286d0e2547c0fa5ff22bd4db
By the way, what's the point of the if-statement in the patch if the condition will always be false? Might as well delete the if-statement block entirely.
No point other than keeping the patch as small and simple as possible (e.g. less risk for merge conflicts when applying the change to newer upstream versions.
Also, can you update the
README
of this repo with the link to the CMake patch including the Ninja andcl
errors fixed, please?The readme already points to it:
# Custom CMake git clone https://gitlab.kitware.com/mstorsjo/cmake.git cd cmake git checkout 844ccd2280d11ada286d0e2547c0fa5ff22bd4db
I see, I might have missed it in the README
. You know what, I'll close the issue and reopen it again only if I still encounter issues after the patch being applied. Thanks for your help.