Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dotnet with CPLEX: not linked or license not found #3475

Closed
jose-joaquim opened this issue Sep 26, 2022 · 5 comments
Closed

dotnet with CPLEX: not linked or license not found #3475

jose-joaquim opened this issue Sep 26, 2022 · 5 comments
Assignees
Labels
Bug Solver: CPLEX CPLEX Solver related issue
Milestone

Comments

@jose-joaquim
Copy link

jose-joaquim commented Sep 26, 2022

What version of OR-Tools and what language are you using?
Version: stable/v9.4
Language: C#

Which solver are you using (e.g. CP-SAT, Routing Solver, GLOP, BOP, Gurobi)

CPLEX 20.10

What operating system (Linux, Windows, ...) and version?

Windows 11

What did you do?

Right after cloning the repository:

  1. Changed Makefile.cpp.mk adding USE_CPLEX ?= ON and providing the -DCPLEX_ROOT option in the third_party target recipe.
  2. Executed: tools\make third_party
  3. Executed then: tools\make dotnet
  4. Created a console application project from scratch in VS 2022.
  5. Installed the two nuget packages located in the .\or-tools\build_make\dotnet\packages into my project.

What did you expect to see

Execute with success the simple MIP example.

What did you see instead?

An error. The console outputs:

WARNING: Logging before InitGoogleLogging() is written to STDERR
W0926 16:52:33.024684 30456 linear_solver.cc:625] Support for cplex not linked in, or the license was not found.

Anything else we should know about your project / environment

I thought that this could be an error involving not supported CPLEX versions. After seeing this answer, I changed the FindCPLEX.cmake file right after the elseif(MSVC) line to:

set_target_properties(CPLEX::CPLEX PROPERTIES IMPORTED_LOCATION "${CPLEX_ROOT}/cplex/lib/x64_windows_msvc14/stat_mda/cplex2010.lib")

which was somehow cplex12100.lib before.

@lperron
Copy link
Collaborator

lperron commented Sep 27, 2022

Can you check it does not uses the package from nuget ?

@Mizux Mizux added Bug Solver: CPLEX CPLEX Solver related issue labels Sep 27, 2022
@Mizux Mizux self-assigned this Sep 27, 2022
@Mizux Mizux added this to the v9.6 milestone Sep 28, 2022
@jose-joaquim
Copy link
Author

Can you check it does not uses the package from nuget ?

Thanks for the reply.

I'm using the nuget packages generated from the compilation process.
Besides, I updated the section "What did you do" with steps 4. and 5. I hope this clarifies!

PS: a friend of mine reproduced steps 4. and 5. in his computer, with the .nupkgs generated in my local, and it worked with CPLEX 12.7!

@Mizux
Copy link
Collaborator

Mizux commented Sep 28, 2022

@jjaneto in your cplex install dir what is the name of the "cplex*.lib" (and its relative location from the cplex root dir installation) ?

ps: 12100 stand for 12.10.0 IIRC which is the new cplex naming convention for their lib

note: PR welcome to have a more versatile cplex find package
aka make this work with wild character aka cplex*.lib

if(APPLE) # be aware that `UNIX` is `TRUE` on OS X, so this check must be first
set_target_properties(CPLEX::CPLEX PROPERTIES
IMPORTED_LOCATION "${CPLEX_ROOT}/cplex/lib/x86-64_osx/static_pic/libcplex.a")
elseif(UNIX)
set_target_properties(CPLEX::CPLEX PROPERTIES
IMPORTED_LOCATION "${CPLEX_ROOT}/cplex/lib/x86-64_linux/static_pic/libcplex.a")
elseif(MSVC)
set_target_properties(CPLEX::CPLEX PROPERTIES
IMPORTED_LOCATION "${CPLEX_ROOT}/cplex/lib/x64_windows_msvc14/stat_mda/cplex12100.lib")
else()
message(FATAL_ERROR "CPLEX not supported for ${CMAKE_SYSTEM}")
endif()

@jose-joaquim
Copy link
Author

jose-joaquim commented Sep 28, 2022

@Mizux the name of the lib is cplex2010.lib; I installed in my local with the default settings. The relative path to this library is IBM\ILOG\CPLEX_Studio201\cplex\lib\cplex2010.lib.

I also checked for any error involving environment variables, but could not find evidences for it.

I reproduced again the steps of the original post, changing the FindCPLEX.cmake file according to your suggestion (editing to cplex*.lib), but the outcome that I got was the same error from before!

@lperron
Copy link
Collaborator

lperron commented Nov 22, 2022

Make is deprecated.

Followup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Solver: CPLEX CPLEX Solver related issue
Projects
None yet
Development

No branches or pull requests

3 participants