Svalorzen / AI-Toolbox

A C++ framework for MDPs and POMDPs with Python bindings
GNU General Public License v3.0
647 stars 98 forks source link

Can't build because of lpslove #68

Open WiemeJarne opened 10 months ago

WiemeJarne commented 10 months ago

When using cmake .. command in the build folder I get the next: C:\AI-Toolbox\build>cmake .. -- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.19045. -- Could not link against lpsolve55! CMake Error at C:/Program Files/CMake/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:230 (message): Could NOT find LpSolve (missing: LPSOLVE_LIBRARIES) Call Stack (most recent call first): C:/Program Files/CMake/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE) cmake/Modules/FindLpSolve.cmake:91 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:143 (find_package)

-- Configuring incomplete, errors occurred!

Any idea how to fix this?

Svalorzen commented 10 months ago

Did you install lp solve? There's many issues in the repo that you can search that show how you can do it on Windows.

WiemeJarne commented 10 months ago

Did you install lp solve? There's many issues in the repo that you can search that show how you can do it on Windows.

Yes I did Install lp solve. I did look at the other issues but I could not get it to work.

Svalorzen commented 10 months ago

Where is it located in your directories? Could you share what is in its folder exactly?

WiemeJarne commented 10 months ago

Its located at C:\Program Files\lpsolve.

Svalorzen commented 10 months ago

Again, what is in it? What exactly did you download?

I also need the entire output of CMake. You might need to delete the entire build folder and start CMake from scratch to get it.

WiemeJarne commented 10 months ago

Screenshot 2023-10-30 180432

full command output: (c) Microsoft Corporation. All rights reserved.

C:\AI-Toolbox>mkdir build

C:\AI-Toolbox>cmake .. CMake Warning: Ignoring extra path from command line:

".."

CMake Error: The source directory "C:/" does not appear to contain CMakeLists.txt. Specify --help for usage, or press the help button on the CMake GUI.

C:\AI-Toolbox>cd build

C:\AI-Toolbox\build>cmake .. -- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.19045. -- Could not link against lpsolve55! CMake Error at C:/Program Files/CMake/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:230 (message): Could NOT find LpSolve (missing: LPSOLVE_LIBRARIES) Call Stack (most recent call first): C:/Program Files/CMake/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE) cmake/Modules/FindLpSolve.cmake:91 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:143 (find_package)

-- Configuring incomplete, errors occurred!

Svalorzen commented 10 months ago

What compiler are you using?

WiemeJarne commented 10 months ago

What compiler are you using?

I am not sure. I googled it how to find out which one I am using but could not find it. I have visual studio 2022 installed idk if that helps?

Svalorzen commented 10 months ago

Because the CMake script that is looking to find lp_solve does so by (1) searching for the correct folder and (2) trying to compile a test program, one small test you can try to see what is wrong is to try to compile an example project with lp solve. If you can, then it's just a matter of making CMake here find the folder correctly. If you can't, then there's something wrong with the files and you might have to compile lp solve from source.

The docs here might help you on how to do that. https://lpsolve.sourceforge.net/5.5/Build.htm#Statically%20link%20your%20application%20with%20lpsolve

WiemeJarne commented 10 months ago

Because the CMake script that is looking to find lp_solve does so by (1) searching for the correct folder and (2) trying to compile a test program, one small test you can try to see what is wrong is to try to compile an example project with lp solve. If you can, then it's just a matter of making CMake here find the folder correctly. If you can't, then there's something wrong with the files and you might have to compile lp solve from source.

The docs here might help you on how to do that. https://lpsolve.sourceforge.net/5.5/Build.htm#Statically%20link%20your%20application%20with%20lpsolve

I created a visual studio project and included the lp_lib.h file and noticed that the file has errors the first one is that it can't find dlfcn.h. Is this normal? Or do I have to install that file from somewhere?

Svalorzen commented 10 months ago

To be honest, I don't know. I don't think I'm the right person to ask; I don't have much experience with Windows.

It is for sure that if you can't compile a simple project with the lp_solve headers, then compiling this one won't be any easier, so I'd work on figuring that out first.

As a last remark, in theory, not all of the library depends on lp_solve, and if the parts of AI-Toolbox you want to use don't depend on it you could extract their headers/cpp files and only use those. Unfortunately I have not yet had the time to go and make lp_solve an optional dependency.

WiemeJarne commented 10 months ago

I fixed the errors in the lp_lib.h file and recloned the repo just to try again and for now its not complaining about lp solve but its something with the boost library now. Here is the full about I get when doing cmake .. in the build folder: C:\AI-Toolbox\build>cmake .. -- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.19045. CMake Warning at C:/Program Files/CMake/share/cmake-3.26/Modules/FindBoost.cmake:1384 (message): New Boost version may have incorrect or missing dependencies and imported targets Call Stack (most recent call first): C:/Program Files/CMake/share/cmake-3.26/Modules/FindBoost.cmake:1508 (_Boost_COMPONENT_DEPENDENCIES) C:/Program Files/CMake/share/cmake-3.26/Modules/FindBoost.cmake:2119 (_Boost_MISSING_DEPENDENCIES) CMakeLists.txt:184 (find_package)

CMake Error at C:/Program Files/CMake/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:230 (message): Could NOT find Boost (missing: unit_test_framework) (found suitable version "1.83.0", minimum required is "1.67") Call Stack (most recent call first): C:/Program Files/CMake/share/cmake-3.26/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE) C:/Program Files/CMake/share/cmake-3.26/Modules/FindBoost.cmake:2377 (find_package_handle_standard_args) CMakeLists.txt:184 (find_package)

This time there are some file being generated CMakeCache.txt is one of them CMakeCache.txt

Svalorzen commented 10 months ago

That seems to say that Boost Test is missing. You might not have it installed? Certain Boost packages are installed separately because they are not header only (also Boost Python). In any case, if you just set -DMAKE_TEST=0 it should not be needed (you can't build the tests then though obviously).

WiemeJarne commented 10 months ago

That seems to say that Boost Test is missing. You might not have it installed? Certain Boost packages are installed separately because they are not header only (also Boost Python). In any case, if you just set -DMAKE_TEST=0 it should not be needed (you can't build the tests then though obviously).

I checked in the boost folder and there is a test folder. So it should work right? Here are the files that are in the test folder. (this folder is locaed in boost/libs/test). image I also tried this command: cmake -DMAKE_TEST=0 .. but that gives the same result.

Svalorzen commented 10 months ago

I don't think that test folder is what you need. What's inside of it?

For the command, my bad, if you only specify no tests it will still build them by default. Try with:

cmake -DMAKE_LIB=1

WiemeJarne commented 10 months ago

I don't think that test folder is what you need. What's inside of it?

For the command, my bad, if you only specify no tests it will still build them by default. Try with:

cmake -DMAKE_LIB=1

Ah yes that made the build succeed but I do get errors when trying to run the projects. For example here are the errors when trying to run AIToolboxFMDP: image

All project fail to build. I also tried the examples but they also fail to build.