1

I'm trying to build libwebsockets library using minGW by following the steps available at https://github.com/warmcat/libwebsockets/blob/master/READMEs/README.build.md under the section @section cmwmgw Building on Windows (MinGW)

I'm doing

cmake -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=C:\Users\pro12\Desktop\lib\libwebsockets

the directory "C:\Users\pro12\Desktop\lib\libwebsockets" contains the source files for the libwebsockets library and I'm runnning this command from

C:\Users\pro12\Desktop\libwebsockets\build

but it giving me error

CMake Error: The source directory "C:/Users/pro12/Desktop/libwebsockets/build" does not appear to contain CMakeLists.txt.

Can anyone tell what i'm doing wrong here? Thanks

Tim Paine
  • 11
  • 5
  • You should run `make` from the project's root folder (where the `CMakeLists.txt ` file is placed). Also, try to install the library to a different folder (not the source code folder)... perhaps a sub-folder. The installation process might be conflicting with the build process. – Myst Oct 18 '18 at 13:56
  • When i'm running cmake from root directory and installing it to a subfolder i'm gettng this `CMake Error at C:/Program Files/CMake/share/cmake-3.13/Modules/CMakeTestCCompiler.cmake:52 (message):` The C compiler `"C:/MinGW/bin/gcc.exe"` is not able to compile a simple test program. It fails with the following output: `Change Dir: C:/Users/pro12/Desktop/lib/libwebsockets/CMakeFiles/CMakeTmp` – Tim Paine Oct 18 '18 at 14:04
  • I'm not sure what the second error is about just yet, but it certainly sounds like an improvement over the first error (seems you're failing at a more advanced stage, where the compiler is engaged).... What error do you get if you try to install to an unrelated folder (somewhere not in the `libwebsockets` tree)? – Myst Oct 18 '18 at 14:10
  • Getting the same error as above when trying to install at `C:/Users/pro12/Desktop/somefolder/` – Tim Paine Oct 18 '18 at 14:14
  • Could be a permission related error. Make sure you have permission to write/execute for all the folders and files in the project's folder (CMake and the compiler will write stuff in `CMakeTmp`) or maybe run CMake as admin (which might not work). Also, consider running the command with `--debug-trycompile` as suggested [here](https://cmake.org/Bug/view.php?id=9286), this will give you more information. – Myst Oct 18 '18 at 14:24

2 Answers2

0

Since you are building it in C:\Users\pro12\Desktop\libwebsockets\build, but your source code is in C:\Users\pro12\Desktop\libwebsockets, obviously cmake could not find the CMakeLists.txt, try

cmake -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=C:\Users\pro12\Desktop\lib\libwebsockets ..

Do not omit the .. two tailing dots: these indicate the parent directory!

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
Willyu
  • 1
  • 2
-1

Your libwebsockets "CMakeLists.txt" file is exist in

"C:/Users/pro12/Desktop/libwebsockets"

but your "cmake" CMD is running in

"C:/Users/pro12/Desktop/libwebsockets/build"

so , you should:

cmake .. -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=C:\Users\pro12\Desktop\lib\libwebsockets

it can specify "CMakeList.txt" file's directory

Unruly
  • 1
  • 1