coin-or / SHOT

A solver for mixed-integer nonlinear optimization problems
https://shotsolver.dev
Eclipse Public License 2.0
117 stars 25 forks source link

Compilation error #147

Closed damdaepark closed 1 year ago

damdaepark commented 2 years ago

Hi, I am trying to compile SHOT in Windows10 (64bit) by following the instructions on https://shotsolver.dev/shot/about-shot/compiling. But things are not going well, so ask if anyone can let me know a solution for this.

(base) PS C:\Users\Damdae\OneDrive - SNU\Installation Files\solvers\shot\SHOT\build> cmake .. -DCMAKE-BUILD_TYPE=Release -DHAS_IPOPT=on -DHAS_CPLEX_=on -DHAS_GUROBI=on

-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.19044.
-- Git hash: 7f2b2af7
-- Found Gurobi folder: C:/Users/Damdae/OneDrive - SNU/Installation Files/solvers/gurobi/win64
-- Using Gurobi include folder: C:/Users/Damdae/OneDrive - SNU/Installation Files/solvers/gurobi/win64/include
-- Using Gurobi library folder: C:/Users/Damdae/OneDrive - SNU/Installation Files/solvers/gurobi/win64/lib
-- Found Gurobi library: C:/Users/Damdae/OneDrive - SNU/Installation Files/solvers/gurobi/win64/lib/gurobi_c++md2017.lib
-- Found Gurobi C++ library: C:/Users/Damdae/OneDrive - SNU/Installation Files/solvers/gurobi/win64/lib/gurobi95.lib
CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (GUROBI)
  does not match the name of the calling package (Gurobi).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  misc/FindGurobi.cmake:114 (find_package_handle_standard_args)
  CMakeLists.txt:229 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Checking for one of the modules 'ipopt'
CMake Error at C:/Program Files/CMake/share/cmake-3.22/Modules/FindPkgConfig.cmake:890 (message):
  None of the required 'ipopt' found
Call Stack (most recent call first):
  CMakeLists.txt:251 (pkg_search_module)

-- Gurobi include files will be used from: C:/Users/Damdae/OneDrive - SNU/Installation Files/solvers/gurobi/win64/include
-- The following Gurobi libraries will be used:
   C:/Users/Damdae/OneDrive - SNU/Installation Files/solvers/gurobi/win64/lib/gurobi_c++md2017.lib
   C:/Users/Damdae/OneDrive - SNU/Installation Files/solvers/gurobi/win64/lib/gurobi95.lib
-- Ipopt include files will be used from: C:\Users\Damdae\OneDrive - SNU\Installation Files\solvers\ipopt\bin\ipopt.exe/include/coin
-- The following Ipopt libraries will be used from:

-- Configuring incomplete, errors occurred!
See also "C:/Users/Damdae/OneDrive - SNU/Installation Files/solvers/shot/SHOT/build/CMakeFiles/CMakeOutput.log".

It's weird because Gurobi is detected while IPOPT is not. They are all in the PATH environment variable and reachable, as you can see below.

(base) PS C:\Users\Damdae\OneDrive - SNU\Installation Files\solvers\shot\SHOT\build> gcm ipopt

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Application     ipopt.exe                                          0.0.0.0    C:\Users\Damdae\OneDrive - SNU\Installation Files\solvers\ipopt\bin\ipopt.exe
andreaslundell commented 2 years ago

Hi,

There seems to be something wrong with your specified path to the Ipopt libraries (note, it should not point to the executable!):

Ipopt include files will be used from: C:\Users\Damdae\OneDrive - SNU\Installation Files\solvers\ipopt\bin\ipopt.exe/include/coin

The correct path should perhaps be:

C:\Users\Damdae\OneDrive - SNU\Installation Files\solvers\ipopt\lib?

damdaepark commented 2 years ago

I guess it is not a problem with PATH. Seeing that the lines starting from 244 in CMakeLists.txt, which are about Ipopt solver, are different from Gurobi and CPLEX cases, I guess the current implementation needs an IPOPT that has been compiled from the source files.

Can someone revise CMakeLists.txt so that it can run with IPOPT executable binaries in https://github.com/coin-or/Ipopt/releases?

svigerske commented 2 years ago

The binaries attached to the Ipopt releases do not include the pkg-config files that SHOT is looking for. (I excluded them, because I didn't think someone would have use for them.) Can you try creating a ipopt.pc in directory lib/pkgconfig of your Ipopt download with the content

prefix=${pcfiledir}/../..
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include/coin-or

Name: Ipopt
Description: Interior Point Optimizer
URL: https://github.com/coin-or/Ipopt
Version: 3.14.5
Cflags: -I${includedir}
Libs: -L${libdir} -lipopt
#Requires.private: coinmumps

Further, you need to install pkg-config (pacman -S pkg-config under MSYS2; or see https://stackoverflow.com/questions/1710922/how-to-install-pkg-config-in-windows).

If that works, I can include the .pc files in future Ipopt binary downloads.

andreaslundell commented 1 year ago

I will close this now. Please feel free to reopen if you still have issues.