-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Issue building or-tools with Python support on OpenBSD #4249
Comments
small comment, you can disable CBC with -DUSE_COINOR=OFF |
my 2 cents,
see: https://github.com/google/or-tools/blob/main/cmake/README.md#cmake-options note: I have this pet project to test |
Thank you @Mizux for the recommendation. I was able to get to CMake reporting 32% using the following steps:
The build emits a few warnings along the way but eventually fails with the following:
For more context, here is the last 265 lines of build output -> https://gist.github.com/ron-at-swgy/1905e788030f0c53be1a16d588678d3f |
@lperron I was able to get the minor fix needed for COIN-OR's Cbc component (see coin-or/Cbc#653) |
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/ |
I am running a build locally with the addition of 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. |
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 |
Random guess, could be this lines: Lines 34 to 40 in 5b87d86
out of curiosity did you see the 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 |
I searched through the logs and did not find a reference to 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 |
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:
I'm following @Mizux from 2020 across stack overflow and the SWIG project 😆 I'm going to try doing something with |
Few tests/question needed:
AFAIK, on your system 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 Will try to gen locally the python binding of routing.i on |
Regarding the |
AFAIK it can only controlled by the swig cli argument in your trace we can see
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) |
Yes - I have just started a build with the latest stable. I will post it to a gist and share here. |
The generated routingPYTHON_wrap.cxx file can be found here - it's rather large so I don't think a gist is appropriate. |
Exciting news - I was able to get a successful build! In 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? |
Installing collected packages: immutabledict, absl-py, ortools
Successfully installed absl-py-2.1.0 immutabledict-4.2.0 ortools-9.10.9999 |
You can try to use 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 |
What version of OR-Tools and what language are you using?
Version: Latest (git clone of stable branch)
Language: Attempting to build Python bindings
Which solver are you using (e.g. CP-SAT, Routing Solver, GLOP, BOP, Gurobi)
N/A
What operating system (Linux, Windows, ...) and version?
OpenBSD-current
What did you do?
Steps to reproduce the behavior:
$ git clone --depth=1 https://github.com/google/or-tools.git
# pkg_add lzlib abseil-cpp protobuf eigen3 re2
The
Cbc
repository includes a compilation error on BSD systems that must be corrected. Replace thereinterpret_cast
at src/CbcModel.cpp line ~6255 withstatic_cast
. This is due to the way NULL is defined on BSD systems. See this commit for more information.Then:
pip install pybind11
.pybind11_protobuf
project here.pybind11_protobuf
export LD_LIBRARY_PATH=/home/myuser/coin/lib:/home/myuser/libopenblas/lib
What did you expect to see
A successful build producing a python package suitable for use on platforms for which no "wheel" is prebuilt on pypi.org.
What did you see instead?
Anything else we should know about your project / environment
For operating systems other than macOS, GNU/Linux, and some Windows flavors, there are no prebuilt wheels for the python or-tools library. This means
pip install or-tools
fails to find a candidate:$ pip install or-tools ERROR: Could not find a version that satisfies the requirement or-tools (from versions: none) ERROR: No matching distribution found for or-tools
As such, one must resort to building the library from source. Luckily several dependencies are prebuilt for my platform (see the
pkg_add
step above) and the COIN-OR projects are easier to build than their documentation portrays. My current roadblock is thispybind11_protobuf
piece. It is admittedly outside my area of expertise, so without documentation detailing installation or integration procedures, I am left with a guess-test-and-revise strategy.The text was updated successfully, but these errors were encountered: