Comments (18)
Installing collected packages: immutabledict, absl-py, ortools
Successfully installed absl-py-2.1.0 immutabledict-4.2.0 ortools-9.10.9999
from or-tools.
Thank you @Mizux for the recommendation. I was able to get to CMake reporting 32% using the following steps:
# pkg_add swig
$ export LD_LIBRARY_PATH=/home/ro071072/coin/lib:/home/ro071072/libopenblas/lib:/usr/lib:/usr/local/lib
(venv) $ pip install wheel mypy protobuf mypy_protobuf virtualenv
$ cmake -S. -Bbuild -DBUILD_PYTHON=ON -DBUILD_DEPS=ON
$ cmake --build build
The build emits a few warnings along the way but eventually fails with the following:
/home/user/or-tools/ortools/util/fp_utils.h:95:11: error: no member named '__control_word' in 'fenv_t'
fenv_.__control_word &= ~excepts;
~~~~~ ^
For more context, here is the last 265 lines of build output -> https://gist.github.com/ron-at-swgy/1905e788030f0c53be1a16d588678d3f
from or-tools.
I am running a build locally with the addition of __OpenBSD__
to the FreeBSD check. I verified the fenv structure is the same on OpenBSD (at least for amd64).
You can see the github mirror here or the official CVSWeb source here about 2/3rds of the way down.
It seems a safe change - I'll prepare a pull request.
from or-tools.
I've added OpenBSD as a companion to the FreeBSD conditionals found throughout the codebase. I also added it as a classifier for the python package that gets generated. I was able to progress much further in the build before failing with swig errors. I am using swig 4.2.1.
I have included the end of the build log in a gist here -> https://gist.github.com/ron-at-swgy/a1862262f163c6d472c4156965baeac7
from or-tools.
Exciting news - I was able to get a successful build!
In cmake/python.cmake
, I removed the block that conditionally sets -DSWIGWORDSIZENN
, then set -DSMALL_LONG
.
This is not going to work for the project, so we will need to conditionally set it based on conditions Cmake can check. How can I check for OpenBSD with cmake?
from or-tools.
You can try to use CMAKE_SYSTEM_NAME
ref: https://cmake.org/cmake/help/latest/variable/CMAKE_SYSTEM_NAME.html#variable:CMAKE_SYSTEM_NAME
to test in CMake:
message(STATUS "system name: ${CMAKE_SYSTEM_NAME}")
if(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
message(STATUS "On OpenBSD")
list(APPEND CMAKE_SWIG_FLAGS "-DSMALL_LONG")
else()
message(STATUS "NOT on OpenBSD")
endif()
message(FATAL_ERROR "stop cmake configure to fast iterate ! (to remove after dev/debug)")
note: In CMake 3.25 we could use BSD
directly but we currently try to target older CMake (3.18 or 3.19 IIRC)
ref: https://cmake.org/cmake/help/latest/variable/BSD.html
from or-tools.
small comment, you can disable CBC with -DUSE_COINOR=OFF
from or-tools.
my 2 cents,
-
to build a local
ortools
python package you need to use our cmake based build (no python wheel generation support when using bazel based build) -
OR-Tools rely on pybind11 and pybind11_protobuf to generate its python wrapper (i.e. we "just" wrap the libortools C++ using pybind11 than reimplementing/porting ortools to python)
-
The pybind11_protobuf cmake support is borken and do not provide any config.cmake or pkg file yet so the idiomatic
find_package(pybind11_protobuf)
can't currently work with pybind11-protobuf src (even worse pybind11_protobuf do not provide any release yet)
ref: https://github.com/pybind/pybind11_protobuf -
pybind11_protobuf
rely onpython/google/protobuf/proto_api.h
which is an header file not available in the Protobuf cmake based build (not available if you FetchContent protobuf nor if you build it, install it, then consume it) -> you need to patch Protobuf src to make this header available (ed in bazel there is the@com_google_protobuf//:proto_api
target...) -
You could let or-tools build a protobuf and pybind11_protobuf for you using
-DBUILD_Protobuf=ON
and-DBUILD_pybind11_protobuf=ON
(and-DBUILD_pybind11
) -
You can see the patch we apply in https://github.com/google/or-tools/tree/main/patches
and the CMake orchestration is here: https://github.com/google/or-tools/blob/main/cmake/dependencies/CMakeLists.txt#L155-L208
see: https://github.com/google/or-tools/blob/main/cmake/README.md#cmake-options
note: I have this pet project to test pybind11_protobouf
integration (Bazel and CMake support)
https://github.com/Mizux/bazel-pybind11-protobuf very usefull to fast iterate, find bug have a minimal reproducing integration example etc......
from or-tools.
@lperron I was able to get the minor fix needed for COIN-OR's Cbc component (see coin-or/Cbc#653)
from or-tools.
or-tools/ortools/util/fp_utils.h
Lines 84 to 101 in 5b87d86
We have a hack for FreeBSD (line 93) maybe we need to add an OpenBSD #define... (PR welcome ;) )
ref: https://sourceforge.net/p/predef/wiki/OperatingSystems/
from or-tools.
Random guess, could be this lines:
Lines 34 to 40 in 5b87d86
out of curiosity did you see the -DSWIGWORDSIZE64
on the command line for the constraint solver swig target ?
try something like this (not tested yet) to rerurn the swig generation target + build:
touch ortools/constraint_solver/python/routing.i
cmake --build build --target pywrapcp -v
from or-tools.
I searched through the logs and did not find a reference to SWIG
anywhere. I also tried changing the conditional you linked to instead always use -DSWIGWORDSIZE64
. The resulting build had the same error as above - it is trying to use a long
when an int64_t
is expected. If you provide me with a hint about what to configure or change, I will be happy to do so - and provide a PR!
I have installed SWIG using my system's package manager - would that have any impact? I have no experience with SWIG and cannot help.
Thank you
from or-tools.
On my system, all of these types are 64 bits long:
#include <unistd.h>
#include <stdio.h>
int
main(int argc, char **argv)
{
printf("sizeof(long) = %d\n", sizeof(long));
printf("sizeof(int64_t = %d\n", sizeof(int64_t));
printf("sizeof(unsigned long long) = %d\n", sizeof(unsigned long long));
printf("sizeof(uint64_t) = %d\n", sizeof(uint64_t));
return 0;
}
and the output:
sizeof(long) = 8
sizeof(int64_t = 8
sizeof(unsigned long long) = 8
sizeof(uint64_t) = 8
I'm following @Mizux from 2020 across stack overflow and the SWIG project 😆
I'm going to try doing something with PRIMITIVE_TYPEMAP
as is done for Java in ortools/base/base.i
from or-tools.
Few tests/question needed:
0. did you still use the stable
branch ? (note: need to check if we add some swig change on main
contrary to stable
)
-
Which compiler did you use ?
-
Could you provide the information, to know if
int64_t
is bind tolong
orlong long
by your compiler ?
please take a look a this link below should be something like this<compiler> -dM -E -x c /dev/null | grep INT64
ref: https://github.com/google/or-tools/blob/main/cmake/docs/swig.md#int64_t-management
AFAIK, on your system int64_t
seems to be bind to long long
thus the vector<long>
to vector<int64_t>
compile issue.
note: SWIG 4+ should be OK so it is not an issue with SWIG but more with how we call the swig compiler i.e. with or without the -DSWIGWORDSIZE64
(in your case should be without so int64_t is bind to long long like on macos)
Will try to gen locally the python binding of routing.i on stable
to do some tests and compare with you...
from or-tools.
- I am building with
origin/stable
- Clang:
host$ cc --version
OpenBSD clang version 16.0.6
Target: amd64-unknown-openbsd7.5
Thread model: posix
InstalledDir: /usr/bin
- Output of the requested command:
host$ cc -dM -E -x c /dev/null | grep INT64
#define __INT64_C_SUFFIX__ LL
#define __INT64_FMTd__ "lld"
#define __INT64_FMTi__ "lli"
#define __INT64_MAX__ 9223372036854775807LL
#define __INT64_TYPE__ long long int
#define __UINT64_C_SUFFIX__ ULL
#define __UINT64_FMTX__ "llX"
#define __UINT64_FMTo__ "llo"
#define __UINT64_FMTu__ "llu"
#define __UINT64_FMTx__ "llx"
#define __UINT64_MAX__ 18446744073709551615ULL
#define __UINT64_TYPE__ long long unsigned int
Regarding the vector<long>
and vector<int64_t>
issue - is this something that could be handled conditionally in the SWIG *.i
files?
from or-tools.
- Thx, so
INT64_TYPE
is bind tolong long int
like on osx so-DSWIGWORDSIZE64
must be not present on your command line (so swig keep its conservative x86 style to bind int64_t to long long)
AFAIK it can only controlled by the swig cli argument -DSWIGWORDSIZE64
or its absence... (we can control through CMAKE in our python.cmake source file)
in your trace we can see
/home/user/or-tools/build/python/ortools/constraint_solver/routingPYTHON_wrap.cxx:4976:45: note: candidate function not viable: no known conversion from 'const vector<long>' to 'const vector<int64_t>' for 2nd argument
SWIGINTERN operations_research::Constraint *operations_research_IntExpr_Member(operations_research::IntExpr *self,std::vector< int64_t > const &values){
Would it be possible to share the code of this generated source file build/python/ortools/constraint_solver/routingPYTHON_wrap.cxx around this lines ? (so I can compare with mine locally)
from or-tools.
Yes - I have just started a build with the latest stable. I will post it to a gist and share here.
from or-tools.
The generated routingPYTHON_wrap.cxx file can be found here - it's rather large so I don't think a gist is appropriate.
from or-tools.
Related Issues (20)
- Bug Report HOT 2
- Add CP-SAT AddCumulative-like constraint where capacity can be different over periods of time
- Install failing with errors around absl HOT 3
- Number of integer variables in Model
- Check failed: 0.0 <= deterministic_duration (0 vs. -9.02616e-19) HOT 3
- Migration fails from 9.7 to 9.10 due to missing AVX Instruction Set HOT 14
- Solution hint is not passed to the HiGHS solver using mathopt HOT 4
- Creating a WrappedConstraint with and/or operators on two WrappedConstraints results in a WrappedConstraint with a null operator. HOT 2
- ExportModelAsMpsFormat creates an unreadable char pointer in Python HOT 2
- DebugString[abi:cxx11] abi seems not compatible HOT 3
- Upper bound limit on CP-SAT: MODEL_INVALID
- Routing with FirstSolutionStrategy::CHRISTOFIDES fails immediately with any large number of points HOT 4
- Build fails: error: unknown type name 'stderrthreshold' HOT 4
- definition of dllimport data not allowed errors of absl during building HOT 5
- Type hinting for linear solvers HOT 5
- Build error for 9.10 on NetBSD HOT 10
- Patches for build on NetBSD
- DllNotFoundException: Unable to load DLL 'google-ortools-native': The specified module could not be found. (Exception from HRESULT: 0x8007007E HOT 4
- Model is feasible in 9.8 but infeasible in 9.10. Disabling presolve in 9.10 makes the model feasible again. HOT 1
- Active Test runner crashed with OR-Tools 9.10.4067/v9.9.3963/v9.8.3296 working fine with v8.1.8487 HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from or-tools.