From b34393660a49b4bb6ed0f0ef6699a33084dfa9fd Mon Sep 17 00:00:00 2001 From: Corentin Le Molgat Date: Fri, 27 Sep 2024 16:29:32 +0200 Subject: [PATCH] Fix NetBSD build (Fix #4359 #4361) --- cmake/Makefile | 65 ++++++++----- cmake/vagrant/netbsd/cpp/Vagrantfile | 115 ++++++++++++++++++++++ cmake/vagrant/netbsd/dotnet/Vagrantfile | 118 +++++++++++++++++++++++ cmake/vagrant/netbsd/java/Vagrantfile | 119 +++++++++++++++++++++++ cmake/vagrant/netbsd/python/Vagrantfile | 122 ++++++++++++++++++++++++ ortools/base/sysinfo.cc | 6 +- ortools/python/setup.py.in | 1 + ortools/util/fp_utils.h | 6 ++ ortools/util/zvector.h | 3 +- 9 files changed, 525 insertions(+), 30 deletions(-) create mode 100644 cmake/vagrant/netbsd/cpp/Vagrantfile create mode 100644 cmake/vagrant/netbsd/dotnet/Vagrantfile create mode 100644 cmake/vagrant/netbsd/java/Vagrantfile create mode 100644 cmake/vagrant/netbsd/python/Vagrantfile diff --git a/cmake/Makefile b/cmake/Makefile index 848e9bd1c9f..6d6dfa5fc8b 100644 --- a/cmake/Makefile +++ b/cmake/Makefile @@ -143,7 +143,8 @@ help: @echo -e "\t${BOLD}clean_vms${RESET}: Remove ALL vagrant box." @echo @echo -e "\tWith ${BOLD}${RESET}:" - @echo -e "\t\t${BOLD}freebsd${RESET} (FreeBSD)" + @echo -e "\t\t${BOLD}freebsd${RESET} (FreeBSD 14)" + @echo -e "\t\t${BOLD}netbsd${RESET} (NetBSD 9)" @echo -e "\te.g. 'make freebsd_cpp'" @echo @echo -e "\t${BOLD}glop_${RESET}: Build Glop using an Ubuntu:rolling docker image." @@ -717,30 +718,42 @@ clean_web: $(addprefix clean_web_, $(WEB_STAGES)) ############# ## VAGRANT ## ############# -VMS := freebsd - -freebsd_targets = $(addprefix freebsd_, $(LANGUAGES)) -.PHONY: freebsd $(freebsd_targets) -freebsd: $(freebsd_targets) -$(freebsd_targets): freebsd_%: vagrant/freebsd/%/Vagrantfile - @cd vagrant/freebsd/$* && vagrant destroy -f - cd vagrant/freebsd/$* && vagrant box update - cd vagrant/freebsd/$* && vagrant up - -# SSH to a freebsd_ vagrant machine (debug). -sh_freebsd_targets = $(addprefix sh_freebsd_, $(LANGUAGES)) -.PHONY: $(sh_freebsd_targets) -$(sh_freebsd_targets): sh_freebsd_%: - cd vagrant/freebsd/$* && vagrant up - cd vagrant/freebsd/$* && vagrant ssh - -# Clean FreeBSD vagrant machine -clean_freebsd_targets = $(addprefix clean_freebsd_, $(LANGUAGES)) -.PHONY: clean_freebsd $(clean_freebsd_targets) -clean_freebsd: $(clean_freebsd_targets) -$(clean_freebsd_targets): clean_freebsd_%: - cd vagrant/freebsd/$* && vagrant destroy -f - -rm -rf vagrant/freebsd/$*/.vagrant +VAGRANT_VMS := \ + freebsd \ + netbsd \ + +define make-vagrant-target = +#$$(info VMS: $1) +#$$(info Create target: $1_.) +$1_targets = $(addprefix $1_, $(LANGUAGES)) +.PHONY: $1 $$($1_targets) +$1: $$($1_targets) +$$($1_targets): $1_%: vagrant/$1/%/Vagrantfile + @cd vagrant/$1/$$* && vagrant destroy -f + cd vagrant/$1/$$* && vagrant box update + cd vagrant/$1/$$* && vagrant up + +#$$(info Create targets: sh_$1_ vagrant machine (debug).) +sh_$1_targets = $(addprefix sh_$1_, $(LANGUAGES)) +.PHONY: $$(sh_$1_targets) +$$(sh_$1_targets): sh_$1_%: + cd vagrant/$1/$$* && vagrant up + cd vagrant/$1/$$* && vagrant ssh + +#$$(info Create targets: clean_$1) +clean_$1_targets = $(addprefix clean_$1_, $(LANGUAGES)) +.PHONY: clean_$1 $(clean_$1_targets) +clean_$1: $$(clean_$1_targets) +$$(clean_$1_targets): clean_$1_%: + cd vagrant/$1/$$* && vagrant destroy -f + -rm -rf vagrant/$1/$$*/.vagrant +endef + +$(foreach vms,$(VAGRANT_VMS),$(eval $(call make-vagrant-target,$(vms)))) + +## MERGE ## +.PHONY: clean_vagrant +clean_vagrant: $(addprefix clean_, $(VAGRANT_VMS)) ########## ## GLOP ## @@ -779,7 +792,7 @@ clean_glop: $(addprefix clean_glop_, $(STAGES)) ## CLEAN ## ########### .PHONY: clean -clean: clean_all clean_platforms clean_toolchains clean_web clean_freebsd clean_glop +clean: clean_all clean_platforms clean_toolchains clean_web clean_vagrant clean_glop docker container prune -f docker image prune -f -rmdir cache diff --git a/cmake/vagrant/netbsd/cpp/Vagrantfile b/cmake/vagrant/netbsd/cpp/Vagrantfile new file mode 100644 index 00000000000..0378b3d5a80 --- /dev/null +++ b/cmake/vagrant/netbsd/cpp/Vagrantfile @@ -0,0 +1,115 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# All Vagrant configuration is done below. The "2" in Vagrant.configure +# configures the configuration version (we support older styles for +# backwards compatibility). Please don't change it unless you know what +# you're doing. +Vagrant.configure("2") do |config| + # The most common configuration options are documented and commented below. + # For a complete reference, please see the online documentation at + # https://docs.vagrantup.com. + + # Every Vagrant development environment requires a box. You can search for + # boxes at https://vagrantcloud.com/search. + config.vm.guest = :netbsd + config.vm.box = "generic/netbsd9" + config.vm.provider "virtualbox" do |v| + v.name = "ortools_netbsd_cpp" + end + config.ssh.shell = "sh" + + # Disable automatic box update checking. If you disable this, then + # boxes will only be checked for updates when the user runs + # `vagrant box outdated`. This is not recommended. + # config.vm.box_check_update = false + + # Create a forwarded port mapping which allows access to a specific port + # within the machine from a port on the host machine. In the example below, + # accessing "localhost:8080" will access port 80 on the guest machine. + # NOTE: This will enable public access to the opened port + # config.vm.network "forwarded_port", guest: 80, host: 8080 + + # Create a forwarded port mapping which allows access to a specific port + # within the machine from a port on the host machine and only allow access + # via 127.0.0.1 to disable public access + # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1" + + # Create a private network, which allows host-only access to the machine + # using a specific IP. + # config.vm.network "private_network", ip: "192.168.33.10" + + # Create a public network, which generally matched to bridged network. + # Bridged networks make the machine appear as another physical device on + # your network. + # config.vm.network "public_network" + + # Share an additional folder to the guest VM. The first argument is + # the path on the host to the actual folder. The second argument is + # the path on the guest to mount the folder. And the optional third + # argument is a set of non-required options. + #config.vm.synced_folder "../../..", "/home/vagrant/project" + config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", disabled: true + + + # Provider-specific configuration so you can fine-tune various + # backing providers for Vagrant. These expose provider-specific options. + # Example for VirtualBox: + # + # config.vm.provider "virtualbox" do |vb| + # # Display the VirtualBox GUI when booting the machine + # vb.gui = true + # + # # Customize the amount of memory on the VM: + # vb.memory = "1024" + # end + # + # View the documentation for the provider you are using for more + # information on available options. + + # Enable provisioning with a shell script. Additional provisioners such as + # Ansible, Chef, Docker, Puppet and Salt are also available. Please see the + # documentation for more information about their specific syntax and use. + # note: clang installed by default + config.vm.provision "env", type: "shell", inline:<<-SHELL + set -x + pkg update -f + pkg install -y git cmake + SHELL + + config.vm.provision "file", source: "../../../../CMakeLists.txt", destination: "$HOME/project/" + config.vm.provision "file", source: "../../../../cmake", destination: "$HOME/project/" + config.vm.provision "file", source: "../../../../ortools", destination: "$HOME/project/" + config.vm.provision "file", source: "../../../../examples/contrib", destination: "$HOME/project/examples/" + config.vm.provision "file", source: "../../../../examples/cpp", destination: "$HOME/project/examples/" + config.vm.provision "file", source: "../../../../examples/dotnet", destination: "$HOME/project/examples/" + config.vm.provision "file", source: "../../../../examples/java", destination: "$HOME/project/examples/" + config.vm.provision "file", source: "../../../../examples/python", destination: "$HOME/project/examples/" + config.vm.provision "file", source: "../../../../examples/tests", destination: "$HOME/project/examples/" + config.vm.provision "file", source: "../../../../patches", destination: "$HOME/project/" + config.vm.provision "file", source: "../../../../Version.txt", destination: "$HOME/project/" + + config.vm.provision "devel", type: "shell", inline:<<-SHELL + set -x + cd project + ls + SHELL + + config.vm.provision "configure", type: "shell", inline:<<-SHELL + set -x + cd project + cmake -S. -Bbuild -DBUILD_DEPS=ON + SHELL + + config.vm.provision "build", type: "shell", inline:<<-SHELL + set -x + cd project + cmake --build build -v + SHELL + + config.vm.provision "test", type: "shell", inline:<<-SHELL + set -x + cd project + cmake --build build --target test -v + SHELL +end diff --git a/cmake/vagrant/netbsd/dotnet/Vagrantfile b/cmake/vagrant/netbsd/dotnet/Vagrantfile new file mode 100644 index 00000000000..bceb231d8bb --- /dev/null +++ b/cmake/vagrant/netbsd/dotnet/Vagrantfile @@ -0,0 +1,118 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# All Vagrant configuration is done below. The "2" in Vagrant.configure +# configures the configuration version (we support older styles for +# backwards compatibility). Please don't change it unless you know what +# you're doing. +Vagrant.configure("2") do |config| + # The most common configuration options are documented and commented below. + # For a complete reference, please see the online documentation at + # https://docs.vagrantup.com. + + # Every Vagrant development environment requires a box. You can search for + # boxes at https://vagrantcloud.com/search. + config.vm.guest = :netbsd + config.vm.box = "generic/netbsd9" + config.vm.provider "virtualbox" do |v| + v.name = "ortools_netbsd_dotnet" + end + config.ssh.shell = "sh" + + # Disable automatic box update checking. If you disable this, then + # boxes will only be checked for updates when the user runs + # `vagrant box outdated`. This is not recommended. + # config.vm.box_check_update = false + + # Create a forwarded port mapping which allows access to a specific port + # within the machine from a port on the host machine. In the example below, + # accessing "localhost:8080" will access port 80 on the guest machine. + # NOTE: This will enable public access to the opened port + # config.vm.network "forwarded_port", guest: 80, host: 8080 + + # Create a forwarded port mapping which allows access to a specific port + # within the machine from a port on the host machine and only allow access + # via 127.0.0.1 to disable public access + # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1" + + # Create a private network, which allows host-only access to the machine + # using a specific IP. + # config.vm.network "private_network", ip: "192.168.33.10" + + # Create a public network, which generally matched to bridged network. + # Bridged networks make the machine appear as another physical device on + # your network. + # config.vm.network "public_network" + + # Share an additional folder to the guest VM. The first argument is + # the path on the host to the actual folder. The second argument is + # the path on the guest to mount the folder. And the optional third + # argument is a set of non-required options. + #config.vm.synced_folder "../../..", "/home/vagrant/project" + config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", disabled: true + + + # Provider-specific configuration so you can fine-tune various + # backing providers for Vagrant. These expose provider-specific options. + # Example for VirtualBox: + # + # config.vm.provider "virtualbox" do |vb| + # # Display the VirtualBox GUI when booting the machine + # vb.gui = true + # + # # Customize the amount of memory on the VM: + # vb.memory = "1024" + # end + # + # View the documentation for the provider you are using for more + # information on available options. + + # Enable provisioning with a shell script. Additional provisioners such as + # Ansible, Chef, Docker, Puppet and Salt are also available. Please see the + # documentation for more information about their specific syntax and use. + # note: clang installed by default + config.vm.provision "env", type: "shell", inline:<<-SHELL + set -x + pkg update -f + pkg install -y git cmake + kldload linux64 + pkg install -y swig linux-dotnet-sdk + SHELL + + config.vm.provision "file", source: "../../../../CMakeLists.txt", destination: "$HOME/project/" + config.vm.provision "file", source: "../../../../cmake", destination: "$HOME/project/" + config.vm.provision "file", source: "../../../../ortools", destination: "$HOME/project/" + config.vm.provision "file", source: "../../../../examples/contrib", destination: "$HOME/project/examples/" + config.vm.provision "file", source: "../../../../examples/cpp", destination: "$HOME/project/examples/" + config.vm.provision "file", source: "../../../../examples/dotnet", destination: "$HOME/project/examples/" + config.vm.provision "file", source: "../../../../examples/java", destination: "$HOME/project/examples/" + config.vm.provision "file", source: "../../../../examples/python", destination: "$HOME/project/examples/" + config.vm.provision "file", source: "../../../../examples/tests", destination: "$HOME/project/examples/" + config.vm.provision "file", source: "../../../../patches", destination: "$HOME/project/" + config.vm.provision "file", source: "../../../../Version.txt", destination: "$HOME/project/" + config.vm.provision "file", source: "../../../../tools/doc/orLogo.png", destination: "$HOME/project/tools/doc/" + + config.vm.provision "devel", type: "shell", inline:<<-SHELL + set -x + cd project + ls + SHELL + + config.vm.provision "configure", type: "shell", inline:<<-SHELL + set -x + cd project + cmake -S. -Bbuild -DBUILD_DOTNET=ON -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF + SHELL + + config.vm.provision "build", type: "shell", inline:<<-SHELL + set -x + cd project + cmake --build build -v + SHELL + + config.vm.provision "test", type: "shell", inline:<<-SHELL + set -x + cd project + cmake --build build --target test -v + SHELL +end diff --git a/cmake/vagrant/netbsd/java/Vagrantfile b/cmake/vagrant/netbsd/java/Vagrantfile new file mode 100644 index 00000000000..050e73496e8 --- /dev/null +++ b/cmake/vagrant/netbsd/java/Vagrantfile @@ -0,0 +1,119 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# All Vagrant configuration is done below. The "2" in Vagrant.configure +# configures the configuration version (we support older styles for +# backwards compatibility). Please don't change it unless you know what +# you're doing. +Vagrant.configure("2") do |config| + # The most common configuration options are documented and commented below. + # For a complete reference, please see the online documentation at + # https://docs.vagrantup.com. + + # Every Vagrant development environment requires a box. You can search for + # boxes at https://vagrantcloud.com/search. + config.vm.guest = :netbsd + config.vm.box = "generic/netbsd9" + config.vm.provider "virtualbox" do |v| + v.name = "ortools_netbsd_java" + end + config.ssh.shell = "sh" + + # Disable automatic box update checking. If you disable this, then + # boxes will only be checked for updates when the user runs + # `vagrant box outdated`. This is not recommended. + # config.vm.box_check_update = false + + # Create a forwarded port mapping which allows access to a specific port + # within the machine from a port on the host machine. In the example below, + # accessing "localhost:8080" will access port 80 on the guest machine. + # NOTE: This will enable public access to the opened port + # config.vm.network "forwarded_port", guest: 80, host: 8080 + + # Create a forwarded port mapping which allows access to a specific port + # within the machine from a port on the host machine and only allow access + # via 127.0.0.1 to disable public access + # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1" + + # Create a private network, which allows host-only access to the machine + # using a specific IP. + # config.vm.network "private_network", ip: "192.168.33.10" + + # Create a public network, which generally matched to bridged network. + # Bridged networks make the machine appear as another physical device on + # your network. + # config.vm.network "public_network" + + # Share an additional folder to the guest VM. The first argument is + # the path on the host to the actual folder. The second argument is + # the path on the guest to mount the folder. And the optional third + # argument is a set of non-required options. + #config.vm.synced_folder "../../..", "/home/vagrant/project" + config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", disabled: true + + + # Provider-specific configuration so you can fine-tune various + # backing providers for Vagrant. These expose provider-specific options. + # Example for VirtualBox: + # + # config.vm.provider "virtualbox" do |vb| + # # Display the VirtualBox GUI when booting the machine + # vb.gui = true + # + # # Customize the amount of memory on the VM: + # vb.memory = "1024" + # end + # + # View the documentation for the provider you are using for more + # information on available options. + + # Enable provisioning with a shell script. Additional provisioners such as + # Ansible, Chef, Docker, Puppet and Salt are also available. Please see the + # documentation for more information about their specific syntax and use. + # note: clang installed by default + config.vm.provision "env", type: "shell", inline:<<-SHELL + set -x + pkg update -f + pkg install -y git cmake + pkg install -y swig openjdk11 maven + mount -t fdescfs fdesc /dev/fd + mount -t procfs proc /proc + SHELL + + config.vm.provision "file", source: "../../../../CMakeLists.txt", destination: "$HOME/project/" + config.vm.provision "file", source: "../../../../cmake", destination: "$HOME/project/" + config.vm.provision "file", source: "../../../../ortools", destination: "$HOME/project/" + config.vm.provision "file", source: "../../../../examples/contrib", destination: "$HOME/project/examples/" + config.vm.provision "file", source: "../../../../examples/cpp", destination: "$HOME/project/examples/" + config.vm.provision "file", source: "../../../../examples/dotnet", destination: "$HOME/project/examples/" + config.vm.provision "file", source: "../../../../examples/java", destination: "$HOME/project/examples/" + config.vm.provision "file", source: "../../../../examples/python", destination: "$HOME/project/examples/" + config.vm.provision "file", source: "../../../../examples/tests", destination: "$HOME/project/examples/" + config.vm.provision "file", source: "../../../../patches", destination: "$HOME/project/" + config.vm.provision "file", source: "../../../../Version.txt", destination: "$HOME/project/" + + config.vm.provision "devel", type: "shell", inline:<<-SHELL + set -x + cd project + ls + SHELL + + config.vm.provision "configure", type: "shell", inline:<<-SHELL + set -x + cd project + export JAVA_HOME=/usr/local/openjdk11 + cmake -S. -Bbuild -DBUILD_JAVA=ON -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF + SHELL + + config.vm.provision "build", type: "shell", inline:<<-SHELL + set -x + cd project + cmake --build build -v + SHELL + + config.vm.provision "test", type: "shell", inline:<<-SHELL + set -x + cd project + cmake --build build --target test -v + SHELL +end diff --git a/cmake/vagrant/netbsd/python/Vagrantfile b/cmake/vagrant/netbsd/python/Vagrantfile new file mode 100644 index 00000000000..6cfb5783f6d --- /dev/null +++ b/cmake/vagrant/netbsd/python/Vagrantfile @@ -0,0 +1,122 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# All Vagrant configuration is done below. The "2" in Vagrant.configure +# configures the configuration version (we support older styles for +# backwards compatibility). Please don't change it unless you know what +# you're doing. +Vagrant.configure("2") do |config| + # The most common configuration options are documented and commented below. + # For a complete reference, please see the online documentation at + # https://docs.vagrantup.com. + + # Every Vagrant development environment requires a box. You can search for + # boxes at https://vagrantcloud.com/search. + config.vm.guest = :netbsd + config.vm.box = "generic/netbsd9" + config.vm.provider "virtualbox" do |v| + v.name = "ortools_netbsd_python" + end + config.ssh.shell = "sh" + + # Disable automatic box update checking. If you disable this, then + # boxes will only be checked for updates when the user runs + # `vagrant box outdated`. This is not recommended. + # config.vm.box_check_update = false + + # Create a forwarded port mapping which allows access to a specific port + # within the machine from a port on the host machine. In the example below, + # accessing "localhost:8080" will access port 80 on the guest machine. + # NOTE: This will enable public access to the opened port + # config.vm.network "forwarded_port", guest: 80, host: 8080 + + # Create a forwarded port mapping which allows access to a specific port + # within the machine from a port on the host machine and only allow access + # via 127.0.0.1 to disable public access + # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1" + + # Create a private network, which allows host-only access to the machine + # using a specific IP. + # config.vm.network "private_network", ip: "192.168.33.10" + + # Create a public network, which generally matched to bridged network. + # Bridged networks make the machine appear as another physical device on + # your network. + # config.vm.network "public_network" + + # Share an additional folder to the guest VM. The first argument is + # the path on the host to the actual folder. The second argument is + # the path on the guest to mount the folder. And the optional third + # argument is a set of non-required options. + #config.vm.synced_folder "../../..", "/home/vagrant/project" + config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", disabled: true + + + # Provider-specific configuration so you can fine-tune various + # backing providers for Vagrant. These expose provider-specific options. + # Example for VirtualBox: + # + # config.vm.provider "virtualbox" do |vb| + # # Display the VirtualBox GUI when booting the machine + # vb.gui = true + # + # # Customize the amount of memory on the VM: + # vb.memory = "1024" + # end + # + # View the documentation for the provider you are using for more + # information on available options. + + # Enable provisioning with a shell script. Additional provisioners such as + # Ansible, Chef, Docker, Puppet and Salt are also available. Please see the + # documentation for more information about their specific syntax and use. + # note: clang installed by default + config.vm.provision "env", type: "shell", inline:<<-SHELL + set -x + pkg update -f + pkg install -y git cmake + pkg install -y swig python39 py39-wheel py39-pip py39-pytest-virtualenv + pkg install -y py39-numpy py39-pandas py39-matplotlib + SHELL + + config.vm.provision "file", source: "../../../../CMakeLists.txt", destination: "$HOME/project/" + config.vm.provision "file", source: "../../../../cmake", destination: "$HOME/project/" + config.vm.provision "file", source: "../../../../ortools", destination: "$HOME/project/" + config.vm.provision "file", source: "../../../../examples/contrib", destination: "$HOME/project/examples/" + config.vm.provision "file", source: "../../../../examples/cpp", destination: "$HOME/project/examples/" + config.vm.provision "file", source: "../../../../examples/dotnet", destination: "$HOME/project/examples/" + config.vm.provision "file", source: "../../../../examples/java", destination: "$HOME/project/examples/" + config.vm.provision "file", source: "../../../../examples/python", destination: "$HOME/project/examples/" + config.vm.provision "file", source: "../../../../examples/tests", destination: "$HOME/project/examples/" + config.vm.provision "file", source: "../../../../patches", destination: "$HOME/project/" + config.vm.provision "file", source: "../../../../LICENSE", destination: "$HOME/project/" + config.vm.provision "file", source: "../../../../Version.txt", destination: "$HOME/project/" + + config.vm.provision "devel", type: "shell", inline:<<-SHELL + set -x + export PATH=${HOME}/.local/bin:"$PATH" + cd project + ls + SHELL + + config.vm.provision "configure", type: "shell", inline:<<-SHELL + set -x + export PATH=${HOME}/.local/bin:"$PATH" + cd project + cmake -S. -Bbuild -DBUILD_PYTHON=ON -DVENV_USE_SYSTEM_SITE_PACKAGES=ON -DBUILD_CXX_SAMPLES=OFF -DBUILD_CXX_EXAMPLES=OFF + SHELL + + config.vm.provision "build", type: "shell", inline:<<-SHELL + set -x + export PATH=${HOME}/.local/bin:"$PATH" + cd project + cmake --build build -v + SHELL + + config.vm.provision "test", type: "shell", inline:<<-SHELL + set -x + export PATH=${HOME}/.local/bin:"$PATH" + cd project + cmake --build build --target test -v + SHELL +end diff --git a/ortools/base/sysinfo.cc b/ortools/base/sysinfo.cc index bb019f1a4cb..4418c3dc0ed 100644 --- a/ortools/base/sysinfo.cc +++ b/ortools/base/sysinfo.cc @@ -17,7 +17,7 @@ #if defined(__APPLE__) && defined(__GNUC__) // MacOS #include #include -#elif (defined(__FreeBSD__) || defined(__OpenBSD__)) // FreeBSD or OpenBSD +#elif (defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)) // [Free,Net,Open]BSD #include #include // Windows @@ -48,7 +48,7 @@ int64_t GetProcessMemoryUsage() { int64_t resident_memory = t_info.resident_size; return resident_memory; } -#elif defined(__GNUC__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && \ +#elif defined(__GNUC__) && !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && \ !defined(__EMSCRIPTEN__) && !defined(_WIN32) // Linux int64_t GetProcessMemoryUsage() { unsigned size = 0; @@ -61,7 +61,7 @@ int64_t GetProcessMemoryUsage() { fclose(pf); return int64_t{1024} * size; } -#elif (defined(__FreeBSD__) || defined(__OpenBSD__)) // FreeBSD or OpenBSD +#elif (defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)) // [Free,Net,Open]BSD int64_t GetProcessMemoryUsage() { int who = RUSAGE_SELF; struct rusage rusage; diff --git a/ortools/python/setup.py.in b/ortools/python/setup.py.in index d750714e21d..2ffbce06758 100644 --- a/ortools/python/setup.py.in +++ b/ortools/python/setup.py.in @@ -149,6 +149,7 @@ setup( 'Operating System :: Unix', 'Operating System :: POSIX :: Linux', 'Operating System :: POSIX :: BSD :: FreeBSD', + 'Operating System :: POSIX :: BSD :: NetBSD', 'Operating System :: POSIX :: BSD :: OpenBSD', 'Operating System :: MacOS', 'Operating System :: MacOS :: MacOS X', diff --git a/ortools/util/fp_utils.h b/ortools/util/fp_utils.h index 34e0a0d8e70..88e962e1e1a 100644 --- a/ortools/util/fp_utils.h +++ b/ortools/util/fp_utils.h @@ -92,10 +92,16 @@ class ScopedFloatingPointEnv { fenv_.__control &= ~excepts; #elif (defined(__FreeBSD__) || defined(__OpenBSD__)) fenv_.__x87.__control &= ~excepts; +#elif defined(__NetBSD__) + fenv_.x87.control &= ~excepts; #else // Linux fenv_.__control_word &= ~excepts; #endif +#if defined(__NetBSD__) + fenv_.mxcsr &= ~(excepts << 7); +#else fenv_.__mxcsr &= ~(excepts << 7); +#endif CHECK_EQ(0, fesetenv(&fenv_)); #endif } diff --git a/ortools/util/zvector.h b/ortools/util/zvector.h index ec21520c70b..e5e51f71cac 100644 --- a/ortools/util/zvector.h +++ b/ortools/util/zvector.h @@ -14,7 +14,8 @@ #ifndef OR_TOOLS_UTIL_ZVECTOR_H_ #define OR_TOOLS_UTIL_ZVECTOR_H_ -#if (defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__)) && \ +#if (defined(__APPLE__) || \ + defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)) && \ defined(__GNUC__) #include #elif !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__MINGW64__)