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

error building from source on windows with CPLEX #3061

Closed
qtbgo opened this issue Jan 4, 2022 · 3 comments
Closed

error building from source on windows with CPLEX #3061

qtbgo opened this issue Jan 4, 2022 · 3 comments
Assignees
Labels
Bug Build: Makefile Makefile based build issue OS: Windows Windows OS
Milestone

Comments

@qtbgo
Copy link

qtbgo commented Jan 4, 2022

What version of OR-Tools and what language are you using?
Version: master/v9.2
Language: Python

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

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

What did you do?
Steps to reproduce the behavior:
to build from source.
I succeeded in tools\make third_party, but failed in tools\make python.

Here is the error messages:
ortools.lib(common.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(knapsack_solver_python_wrap.obj 中)
ortools.lib(status.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(knapsack_solver_python_wrap.obj 中)
ortools.lib(strutil.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(knapsack_solver_python_wrap.obj 中)
ortools.lib(int128.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(knapsack_solver_python_wrap.obj 中)
ortools.lib(arenastring.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(knapsack_solver_python_wrap.obj 中)
ortools.lib(repeated_ptr_field.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(knapsack_solver_python_wrap.obj 中)
ortools.lib(repeated_field.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(knapsack_solver_python_wrap.obj 中)
ortools.lib(descriptor.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(knapsack_solver_python_wrap.obj 中)
ortools.lib(generated_message_reflection.cc.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MT_StaticRelease”不匹配值“MD_DynamicRelease”(knapsack_solver_python_wrap.obj 中)

It seems that somthing wrong with knapsack solver. Since I do not need knapsack solver, I wonder if I can switch off knapsack solver build?

@Mizux Mizux self-assigned this Jan 4, 2022
@Mizux Mizux added Bug Build: Makefile Makefile based build issue OS: Windows Windows OS labels Jan 4, 2022
@Mizux
Copy link
Collaborator

Mizux commented Jan 4, 2022

Makefile and CMake based build currently only build a big fat ortools lib.
Bazel build do not support Python/Java/.Net but only C++ part (and CPLEX is not supported).

IIRC we try to build everything using /MD

CCC=cl /std:c++17 /EHsc /MD /nologo -nologo $(SYSCFLAGS) /D__WIN32__ /DPSAPI_VERSION=1 \

Is is possible that xpress is built using /MT thus your bug ?
note: i think we use the stat_mda (which could stand for static MD release ?)
STATIC_CPLEX_LNK = "$(WINDOWS_CPLEX_DIR)\\cplex\\lib\\x64_windows_msvc14\\stat_mda\\cplex$(WINDOWS_CPLEX_VERSION).lib"

Do you have this issue if you disable cplex support ?

@lperron lperron changed the title error building from source on windows. error building from source on windows with CPLEX Jan 23, 2022
@ktnr
Copy link

ktnr commented Jan 28, 2022

I have similar issues without CPLEX (and more third party deps disabled). After build with cmake from master:

cmake .. -DBUILD_DEPS=ON -DUSE_SCIP=OFF -DUSE_COINOR=OFF -DBUILD_SAMPLES=OFF -DBUILD_CXX_SAMPLES=OFF -DBUILD_PYTHON_SAMPLES=OFF -DBUILD_JAVA_SAMPLES=OFF -DBUILD_DOTNET_SAMPLES=OFF  -DBUILD_EXAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF -DBUILD_PYTHON_EXAMPLES=OFF -DBUILD_JAVA_EXAMPLES=OFF -DBUILD_DOTNET_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=install -DINSTALL_BUILD_DEPS=OFF

cmake --build .

cmake --build . --target install

I get many errors of the following category

2>ortools.lib(cp_model.obj) : error LNK2038: Konflikt ermittelt für "_ITERATOR_DEBUG_LEVEL": Der Wert "2" stimmt nicht mit dem Wert "0" in ContainerLoadingApplication.obj überein.
2>ortools.lib(cp_model.obj) : error LNK2038: Konflikt ermittelt für "RuntimeLibrary": Der Wert "MDd_DynamicDebug" stimmt nicht mit dem Wert "MD_DynamicRelease" in ContainerLoadingApplication.obj überein.
2>ContainerLoading.lib(file_util.obj) : error LNK2001: Unresolved external symbol ""public: enum absl::lts_20211102::StatusCode __cdecl absl::lts_20211102::Status::code(void)const " (?code@Status@lts_20211102@absl@@QEBA?AW4StatusCode@23@XZ)".
2>ContainerLoading.lib(file_util.obj) : error LNK2001: Unresolved external symbol ""public: bool __cdecl google::protobuf::MessageLite::SerializeToZeroCopyStream(class google::protobuf::io::ZeroCopyOutputStream *)const " (?SerializeToZeroCopyStream@MessageLite@protobuf@google@@QEBA_NPEAVZeroCopyOutputStream@io@23@@Z)".
2>ContainerLoading.lib(file_util.obj) : error LNK2001: Unresolved external symbol "inflate".

If relevant, I have two projects: core and CLI-App. The core project compiles without error but only when the CLI-App links to the core project, the compilation errors occur in the CLI-App. Don't know what to make of this.

Also tried to build with -DCMAKE_BUILD_TYPE=Release but it yields the same errors.

The project works fine when or-tools is built with the make toolchain instead of the cmake build (everything else is the same: flags, or-tools version)...

@Mizux Mizux added this to the v10.0 milestone Mar 3, 2022
@lperron
Copy link
Collaborator

lperron commented Nov 22, 2022

Regrouped into

Please followup there.

@lperron lperron closed this as completed Nov 22, 2022
@Mizux Mizux modified the milestones: v10.0, v9.5 Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Build: Makefile Makefile based build issue OS: Windows Windows OS
Projects
None yet
Development

No branches or pull requests

4 participants