kibaekkim / DSPopt.jl

Julia modeling interface to parallel decomposition solver DSP
MIT License
12 stars 2 forks source link

Unable to call CPLEX on Mac M1 #32

Closed Zhangyl09 closed 2 months ago

Zhangyl09 commented 2 months ago

Hello,

I’m encountering an issue using DSP through DSPopt.jl on my Mac (Apple M1 Pro, macOS Sonoma 14.5). Despite setting the CPLEX path in UserConfig.cmake during DSP compilation, DSP can’t locate CPLEX solver (as shown in the figure below). I was able to use CPLEX with Python without any issues, and I’ve tried running Julia under Rosetta to enable Intel-based packages, but the problem persists.

Screenshot 2024-09-03 at 11 54 53

Here is the building setting of my mac:

cmake 3.30.0
Julia 1.10.4
Cplex 22.1.1 for OS-arm
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.5.

The UserConfig.cmake content:

# This file defines the user-specific settings.
set(MA27LIB_DIR     "$ENV{MA27LIB_DIR}")
set(CPLEX_LIB_DIR   "$ENV{/Applications/CPLEX_Studio2211/cplex/lib/arm64_osx/static_pic}")
set(CPLEX_INC_DIR   "$ENV{/Applications/CPLEX_Studio2211/cplex/include/ilcplex}")
set(GUROBI_LIB_DIR  "$ENV{GUROBI_LIB_DIR}")
set(GUROBI_INC_DIR  "$ENV{GUROBI_INC_DIR}")
set(SCIPOPT_INC_DIR "$ENV{SCIPOPT_INC_DIR}")
set(SCIPOPT_LIB_DIR "$ENV{SCIPOPT_LIB_DIR}")

And, the output from cmake:

Screenshot 2024-09-03 at 14 50 57

Your assistance would be greatly appreciated.

kibaekkim commented 2 months ago

The setting in UserConfig.cmake does not look correct, as it indicates "environment" variables. Either you have to set the paths to the following environment variables

set(CPLEX_LIB_DIR   "$ENV{CPLEX_LIB_DIR}")
set(CPLEX_INC_DIR   "$ENV{CPLEX_INC_DIR}")

or set the absolute paths as follows:

set(CPLEX_LIB_DIR   "/Applications/CPLEX_Studio2211/cplex/lib/arm64_osx/static_pic")
set(CPLEX_INC_DIR   "/Applications/CPLEX_Studio2211/cplex/include/ilcplex")
Zhangyl09 commented 2 months ago

It worked. Thanks for your help!