KhronosGroup / KTX-Software

KTX (Khronos Texture) Library and Tools
Other
854 stars 226 forks source link

When compiling under Windows, it prompts unix2dos: command not found. #834

Closed jimwang118 closed 7 months ago

jimwang118 commented 7 months ago

I updated ktx in vcpkg and installed it under Windows after updating the version. The following error occurred: unix2dos: command not found. The installation was successful after I deleted all commands related to unix2dos.

MarkCallow commented 7 months ago

unix2dos has been required for a very long time. What has changed in your set up that it is now an issue? On my Windows system I have 2 instances: one in GitForWindows, which also provides the Bash shell the build uses, and one in the Strawberry Perl installation.

It is only needed when rebuilding some source files that are generated from vulkan_core.h after a vulkan_core.h update. Such updates are rare so deleting the commands in the vcpkg version will not be an issue. Unfortunately cmake likes to run these commands for each build even though there has been no update to the dependencies. If it wasn't for this, you would never have noticed the existence of the commands that use unix2dos.

There are 2 problems that I'd like to fix but I've not been able to determine the causes in the time I've had available for investigation.

  1. Why does cmake want to keep rerunning these build commands?
  2. Why does Perl on Windows like to write Unix line endings? That is why we are using unix2dos. Perhaps the issue is fixed in recent versions of Perl.
jimwang118 commented 7 months ago

When installing port ktx in vcpkg, use msys to provide a bash environment. There is no unix2dos command in the bash environment command provided by msys. So this error is caused.

MarkCallow commented 7 months ago

There is no unix2dos command in the bash environment command provided by msys. So this error is caused.

When was it removed? It is still in Git for Windows which is based on msys.

Regardless, I have put the targets that were using it behind a config option that is off by default and also stopped using unix2dos in those targets.

jimwang118 commented 7 months ago

When was it removed? It is still in Git for Windows which is based on msys.

Regardless, I have put the targets that were using it behind a config option that is off by default and also stopped using unix2dos in those targets.

There is no dos2unix command in the msys I downloaded. I added the download of dos2unix package and the problem was solved.

MarkCallow commented 7 months ago

Thanks for the info @jimwang118. Now the PR has landed, you no longer need unix2dos.