0

I was trying to build my .cpp file in Windows platform (windows 10) using CMake.

My .cpp file makes use of two external libraries:

  1. armadillo
  2. libsnd file.

I have written a corresponding CMakeLists.txt to compile and obtain the binary. I was successful in doing so in Linux. But when it come to Windows I was not able to do so:

   Current branch master is up to date.
   No patch step for 'project_libsndfile'
   Performing autogen step for 'project_libsndfile'
   Performing configure step for 'project_libsndfile'

'C:\Users\computing7\Desktop\TSM_cmake\build\lib\libsndfile\src\project_libsndfile\configure' is not recognized as an internal or external command,
  operable program or batch file.

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code 9009.
   Done executing task "CustomBuild" -- FAILED.

Done building target "CustomBuild" in project "project_libsndfile.vcxproj" -- FAILED.
Build FAILED.

1) Is it possible to build libsnd in Windows? (coz, I came across documents which state that libsndfiles work only in Linux).

2) Could you please provide some guidance.

Tsyvarev
  • 60,011
  • 17
  • 110
  • 153
  • [They say](http://www.mega-nerd.com/libsndfile/win32.html) that you may try to build `libsndfile` on Windows using MinGW, while it is not tested. Alternatively, you may cross-compile it on Linux for Windows using MinGW cross-compiler. – Tsyvarev Mar 02 '17 at 13:30
  • You can cross-compile it on Linux using [MXE](http://mxe.cc/), then run it on windows or in wine. Clone the mxe repo, then `cd mxe`, then `make MXE_TARGETS='x86_64-w64-mingw32.shared.posix' armadillo libsndfile`, then `export PATH=$(pwd)/usr/bin:$PATH`. Then cd into your project build directory and configure your cmake project: `x86_64-w64-mingw32.shared.posix-cmake ` (just like regular cmake command), build it as usual: `make -j4`. – Velkan Mar 06 '17 at 12:33

0 Answers0