My CMake build on Github Actions can't find Boost. So I enable policy CMP0074 and set variable Boost_ROOT. After that CMake finds Boost, but emits this warning:
CMake Warning (dev) at myproject/CMakeLists.txt:14 (find_package):
Policy CMP0074 is not set: find_package uses <PackageName>_ROOT
variables. Run "cmake --help-policy CMP0074" for policy details.
Use the cmake_policy command to set the policy and suppress this
warning.
Environment variable Boost_ROOT is set to:
C:\local\boost
For compatibility, CMake is ignoring the variable.
So that seems contradictory to me. Without CMP0074 it does not work. With CMP0074 it works but complains.
Details
I am trying to get a build running on Github Actions using the "windows-2022" platform which includes cmake version 3.25.1.
I have one step to install boost and another to build my code. On my first attempt, the build of my code failed because it could not find boost. So I made two changes:
I edited my CMakeLists.txt file and added this line:
cmake_policy(SET CMP0074 NEW)
I set environment variable Boost_ROOT equal to C:\local\boost (the path to which I install boost on the server).
Now, my build finds the boost header files and progresses further. (It fails at the linking stage because it can't find the boost lib files and I am working on that). But the build emits the warning mentioned above. This seems contradictory to me:
Without CMP0074/Boost_ROOT, it does not find the Boost header files
With CMP0074/Boost_ROOT, it finds the Boost header files, while also emitting a warning to say that Boost_ROOT is ignored
This makes no sense to me and I am unable to recreate the problem locally (I am running cmake version 3.25.1, same as the windows-2022 container on Github Actions.) Any idea what I'm doing wrong?
This is how my yaml file looks like so far:
name: Test
on: workflow_dispatch
jobs:
job1:
runs-on: windows-2022
steps:
- uses: actions/checkout#v3
- name: Setup MSBuild
uses: microsoft/setup-msbuild#v1.1
- name: Setup Boost
run: |
$Url = "https://boostorg.jfrog.io/artifactory/main/release/1.81.0/binaries/boost_1_81_0-msvc-14.2-64.exe"
(New-Object System.Net.WebClient).DownloadFile($Url, "$env:TEMP\boost.exe")
Start-Process -Wait -FilePath "$env:TEMP\boost.exe" "/SILENT","/SP-","/SUPPRESSMSGBOXES","/DIR=C:\local\boost"
- name: Build Myproject
env:
Boost_ROOT: C:\local\boost
run: |
Expand-Archive -Path Myproject.zip -DestinationPath C:\local
cd C:\local\Myproject
mkdir build
cd build
cmake -G "Visual Studio 17 2022" -A x64 ..
cmake --build . --config Release
With CMP0074/Boost_ROOT, it finds the Boost header files, while also emitting a warning to say that Boost_ROOT is ignored.
Actually, there is no contradiction in such behavior, because Boost headers are found via ... BOOST_ROOT variable (case insensitive!).
Details:
When a project specifies (with cmake_minimum_required) that it is written for CMake 3.11 (or older), CMake doesn't set policy CMP0074.
When such project calls find_package(Boost) and CMake observes, that environment variable Boost_ROOT is set, it emits the warning and does not add this variable implicitly to find_path and find_library calls, performed by module FindBoost.cmake.
However, the module FindBoost.cmake explicitly adds environment variable BOOST_ROOT to its find_path and find_library calls, so the directory specified by the variable is actually searched.
On Windows environment variables are case-insensitive. (Unlike to Linux variables, unlike to CMake variables). So Boost_ROOT and BOOST_ROOT are actually refer to the same variable.
There is some specific about FindBoost.cmake module: it supports (and documents!) using BOOST_ROOT environment variable as a hint for search. Such decision could look strange assuming CMake automatically adds Boost_ROOT variable to the search paths. But FindBoost.cmake has been written long before CMake 3.12 (see e.g. FindBoost documentation for CMake 3.1), so Boost developers couldn't be aware that CMake will introduce such feature at the system level.
That is, you could ignore such warning. The warning will disappear when the project migrates to CMake 3.12 or newer (as a minimum requirement).
Alternatively, instead of Boost_ROOT you could set BOOSTROOT environment variable as a hint: such variable is not checked by CMake itself, but used in FindBoost.cmake module.
Related
I've downloaded the binaries: or-tools_VisualStudio2022-64bit_v9.3.10497
I'm using vs2022 on win10. My shell has cygwin in the path if it's related.
I ran
%comspec% /k "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
cl.exe is in the path, and which.exe finds it.
I ran make test_cc, but it complained
the cl command was not found in your PATH
exit 127
make: *** [Makefile:271: test_cc] Error 127
The var CXX_BIN was empty even though which cl returned the correct path. I set it manually to cl.
Then, there was a complaint about echo and a newline, which I commented out. Then, it couldn't find md, so I created manually md objs.
A few of the examples were built, but then it stopped with another error. For now, I just got what I want:
make run SOURCE=examples/cpp/solve.cc
but probably there was an easier way to get it?
I tried to build it from the source using cmake. Doesn't work off-the-shelf as well:
Build abseil-cpp: OFF
...
CMake Error at C:/prj-external-libs/vcpkg/scripts/buildsystems/vcpkg.cmake:824 (_find_package):
By not providing "Findabsl.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "absl", but
CMake did not find one.
Could not find a package configuration file provided by "absl" with any of
the following names:
abslConfig.cmake
absl-config.cmake
Add the installation prefix of "absl" to CMAKE_PREFIX_PATH or set
"absl_DIR" to a directory containing one of the above files. If "absl"
provides a separate development package or SDK, be sure it has been
installed.
Call Stack (most recent call first):
cmake/deps.cmake:33 (find_package)
CMakeLists.txt:304 (include)
If finds gurobi95.dll, but it can't find the function GRBtunemodeladv.
On failure, solve.exe crashes with (unknown) names in the stack trace. Need to add debug symbols and graceful error handling.
cmake looks more promising, and I was missing dependencies. Should give it a flag -DBUILD_DEPS:BOOL=ON.
OR-Tools depends on few external dependencies so CMake build will try to find them using the idiomatic find_package() => your distro/env(vcpkg ?) must provide them, just regular CMake stuff here.
ref: https://cmake.org/cmake/help/latest/command/find_package.html
note: we provide few findFoo.cmake here https://github.com/google/or-tools/tree/main/cmake
We also provide a meta option to build statically all our dependencies, simply pass -DBUILD_DEPS=ON cmake option at configure time.
You can also build only some of them, please take a look at
https://github.com/google/or-tools/tree/main/cmake#dependencies
Concerning Gurobi and GRBtunemodeladv symbol, this one has been removed by last version of Gurobi so we fix it in v9.4/main/stable branch...
see: https://github.com/google/or-tools/commit/d6e0feb8ae96368523deb99fe4318d32e80e8145
I'm creating Conda create environment from yml I generated on Windows' Miniconda install. I need to create same environment on OS X. Following the advise found here on SO I used the --no-builds option.
Also, the names of some packages under section ResolvePackageNotFound are clearly (many if not all) specific to Windows:
- m2w64-gmp=6.1.0
- m2w64-gcc-libs-core=5.3.0
- m2w64-gcc-libs=5.3.0
- vc=14.1
- vs2015_runtime=15.5.2
- msys2-conda-epoch=20160418
- menuinst=1.4.14
- icc_rt=2019.0.0
- m2w64-libwinpthread-git=5.0.0.4634.697f757
- pywinpty=0.5.5
- wincertstore=0.2
- m2w64-gcc-libgfortran=5.3.0
- win_inet_pton=1.1.0
- winpty=0.4.3
I removed all of these from the yml file. Even then it's stalled at the following screen:
(base) MacBook-Air:Anaconda.d xtian$ conda env create -f 32b-qb-2019-10-05.yml
Collecting package metadata (repodata.json): done
Solving environment: \
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abor|
Examining openssl: 10%|█████████▍ | 29/279 [00:00<00:00, 3729.87it- ]
Comparing specs that have this dependency: 16%|██████████▉ | 16/101 [05:53<31:19, 22.11s/it]
Finding shortest conflict path for openssl[version='>=1.0.2p,<1.0.3a']: 38%|███████████████▊ | 6/16 [02:39<06:23, 38.32s/it]
This process is progressing at an astonishingly slow pace, and hasn't got past openssl ... 29/279. Should I wait and trust Conda can figure this all out?
Or,
Do I need another strategy--
I'm wondering if I can't remove the offending packages, each in turn, and create a series of yml files to install in order using, $ conda env update --prefix ./env --file environment.yml --prune, because whatever finally works here I know I'm going to need to use it on another machine so I can share the project env with a colleague.
Any other suggestions?
Short answer: Try deleting the packages that your system is getting stuck on from the .yml file. i.e., remove "openssl" from .yml file.
I have been running into the same issue trying to install a .yml file created in a Windows system to a Mac system. I basically followed the same procedure you did:
-Created yml file using the --no-builds option.
-Attempted to create environment on Mac system and had several windows specific packages left under ResolvePackageNotFound section (listed below)
m2w64-libwinpthread-git=5.0.0.4634.697f757
pyreadline=2.1
pywinpty=0.5.5
m2w64-gcc-libgfortran=5.3.0
vc=14
m2w64-gcc-libs-core=5.3.0
m2w64-gmp=6.1.0
wincertstore=0.2
icc_rt=2019.0.0
m2w64-gcc-libs=5.3.0
vs2015_runtime=14.15.26706
winpty=0.4.3
msys2-conda-epoch=20160418
-Deleted those from the yml file
-Attempted to create environment from updated yml file and received the following conflicts:
- Found conflicts! Looking for incompatible packages.
My system also got stuck trying to solve the "openssl" conflict along with a "_tflow_select". I ended up deleting those and was able to create my environment and run the code without too much trouble.
I'm trying to integrate cmake into a project that contains a Unity3D project. I want to bypass checks for languages, as the CMakeLists.txt file really just houses a custom command that calls Unity3D's build process. I'm aware of the LANGUAGES NONE setting in the project() command, and also a similar setting in the set_target_properties() command. However, neither seem to be working. My complete CMakeLists.txt file is pasted below:
cmake_minimum_required (VERSION 3.8)
project (
"Test-App"
VERSION
1.0
LANGUAGES
NONE
)
# For the custom command to be marked as not actually creating a file,
# you need to set the symbolic property on it
#set_property (
# SOURCE
# UNITY_OUTPUT
# PROPERTY
# SYMBOLIC
#)
add_custom_command (
OUTPUT
UNITY_OUTPUT
COMMAND
/Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -buildOSXUniversalPlayer ${CMAKE_SOURCE_DIR}/Builds/Test-Build.app
COMMENT
"Building application..."
)
add_executable (
Test-Build
UNITY_OUTPUT
)
set_target_properties (
Test-Build
PROPERTIES
LINKER_LANGUAGE
NONE
)
However, in my tereminal output cmake is still complaining that an internal variable has not been set. I get the following output:
-- Configuring done
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_NONE_LINK_EXECUTABLE
-- Generating done
-- Build files have been written to: XXX
Note that the Makefile is still generated and I can still build stuff. I simply want to get rid of this annoying error, to be sure that I fully understand how CMake is operating.
First I have installed all the dependent packages including atk 2.18.
Then, I have added them to path.
# echo $LD_LIBRARY_PATH
/opt/gtk_+3.12-RHEL6/dependencies/at-spi2-atk/lib:/opt/gtk_+3.12-RHEL6/dependencies/gobject-introspection/lib:/opt/gtk_+3.12-RHEL6/dependencies/pango/lib:/opt/gtk_+3.12-RHEL6/dependencies/harfbuzz/lib:/opt/gtk_+3.12-RHEL6/dependencies/freetype/lib:/opt/gtk_+3.12-RHEL6/dependencies/icu4c/lib:/opt/gtk_+3.12-RHEL6/dependencies/cairo/lib:/opt/gtk_+3.12-RHEL6/dependencies/fontconfig/lib:/opt/gtk_+3.12-RHEL6/dependencies/libpng/lib:/opt/gtk_+3.12-RHEL6/dependencies/pixman/lib:/opt/gtk_+3.12-RHEL6/dependencies/atk/lib:/opt/gtk_+3.12-RHEL6/dependencies/gdk-pixbuf/lib:/opt/gtk_+3.12-RHEL6/dependencies/GLib/lib:
# echo $PATH
/opt/gtk_+3.12-RHEL6/dependencies/gobject-introspection/bin:/opt/gtk_+3.12-RHEL6/dependencies/pango/bin:/opt/gtk_+3.12-RHEL6/dependencies/harfbuzz/bin:/opt/gtk_+3.12-RHEL6/dependencies/freetype/bin:/opt/gtk_+3.12-RHEL6/dependencies/which/bin:/opt/gtk_+3.12-RHEL6/dependencies/icu4c/sbin:/opt/gtk_+3.12-RHEL6/dependencies/icu4c/bin:/opt/gtk_+3.12-RHEL6/dependencies/cairo/bin:/opt/gtk_+3.12-RHEL6/dependencies/fontconfig/bin:/opt/gtk_+3.12-RHEL6/dependencies/libpng/bin:/opt/gtk_+3.12-RHEL6/dependencies/gdk-pixbuf/bin:/opt/gtk_+3.12-RHEL6/dependencies/GLib/bin:/opt/python_2_7_11/bin:/usr/lib64/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
# echo $PKG_CONFIG_PATH
/opt/gtk_+3.12-RHEL6/dependencies/at-spi2-atk/lib/pkgconfig:/opt/gtk_+3.12-RHEL6/dependencies/gobject-introspection/lib/pkgconfig:/opt/gtk_+3.12-RHEL6/dependencies/pango/lib/pkgconfig:/opt/gtk_+3.12-RHEL6/dependencies/harfbuzz/lib/pkgconfig:/opt/gtk_+3.12-RHEL6/dependencies/freetype/lib/pkgconfig:/opt/gtk_+3.12-RHEL6/dependencies/icu4c/lib/pkgconfig:/opt/gtk_+3.12-RHEL6/dependencies/cairo/lib/pkgconfig:/opt/gtk_+3.12-RHEL6/dependencies/fontconfig/lib/pkgconfig:/opt/gtk_+3.12-RHEL6/dependencies/libpng/lib/pkgconfig:/opt/gtk_+3.12-RHEL6/dependencies/pixman/lib/pkgconfig:/opt/gtk_+3.12-RHEL6/dependencies/atk/lib/pkgconfig:/opt/gtk_+3.12-RHEL6/dependencies/gdk-pixbuf/lib/pkgconfig:/opt/gtk_+3.12-RHEL6/dependencies/GLib/lib/pkgconfig:/opt/gtk_+3.12-RHEL6/dependencies
But, when I try to run ./configure, I am getting the following error:
checking for ATK... no
configure: error: Package requirements (atk atk-bridge-2.0) were not met:
No package 'atk-bridge-2.0' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables ATK_CFLAGS
and ATK_LIBS to avoid the need to call pkg-config.
atk 2.18 is cleary added in the PKG_CONFIG_PATH and also LD_LIBRARY_PATH.
So, I though atk-bridge-2.0 is separate and found the packag: at-spi2-atk and at-spi2-core. But, no atk-bridge-2.0 is installed.
Please help.
The atk-bridge-2.0 API is provided by at-spi2-atk, not by ATK.
Your build environment is fairly broken, and it seems you're installing each component into its own prefix. You shouldn't. Create a temporary build root, and add that to $PATH, $PKG_CONFIG_PATH, $LD_LIBRARY_PATH, and $XDG_DATA_DIRS. Then, use the same prefix for every component.
You should look at how jhbuild works.
My Scala project (Maven-managed) is failing to build on Travis, throwing a GC overhead limit exceeded error despite compiling fine locally with the same MAVEN_OPTS=-Xmx3g -XX:MaxPermSize=512m. I suspect that Travis is somehow ignoring my MAVEN_OPTS: When I try to test against Oracle JDK 8, Travis logs:
$ Setting environment variables from .travis.yml
$ export MAVEN_OPTS="-XX:MaxPermSize=512m -Xmx3g"
which looks good. However, soon after it logs:
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=192m; support was removed in 8.0
which is troubling since NOWHERE am I specifying -XX:MaxPermSize=192m, only 512m. (This leads me to believe my -Xmx3g is also being ignored, causing the compilation failure.)
I tried specifying the MAVEN_OPTS in many additional places in my pom, to no avail. For example, for the maven-scala-plugin, I have:
<configuration>
...
<jvmArgs>
<jvmArg>-Xmx3g</jvmArg>
<jvmArg>-XX:MaxPermSize=512m</jvmArg>
</jvmArgs>
</configuration>
And I also have the following under the maven-surefire-plugin and scalatest plugin, though the build is failing during compilation not tests:
<configuration>
<argLine>-Xmx3g -XX:MaxPermSize=512m</argLine>
</configuration>
The following is the entirety of my .travis.yml:
language: java
env:
global:
- MAVEN_OPTS="-XX:MaxPermSize=512m -Xmx3g"
script: mvn clean install
jdk:
- oraclejdk8
- oraclejdk7
I'm using Scala 2.11.2 and scala-maven-plugin 3.2.0.
UPDATE (11/2/15):
This was finally fully resolved here. Quoting:
If you want to use container-based builds (not relying on sudo), you can echo what you want into a $HOME/.mavenrc file and that will take precedence over /etc/mavenrc, like so:
in .travis.yml:
before_script:
- echo "MAVEN_OPTS='-Xmx2g -XX:MaxPermSize=512m'" > ~/.mavenrc
(you could also put this in before_install depending on your setup).
Old answer:
I finally found the answer here, which references this (closed but not resolved) issue on the Travis CI github.
It seems like Travis exports a MAVEN_OPTS environment variable as root via the file /etc/mavenrc, which then does not get overridden by any other MAVEN_OPTS definitions (e.g. via env/global settings in the travis config). The workaround is to delete /etc/mavenrc before setting custom MAVEN_OPTS.
I was able to set custom MAVEN_OPTS and build successfully using the following in my .travis.yml:
script:
- sudo rm /etc/mavenrc
- export MAVEN_OPTS="-Xmx2469m -XX:MaxPermSize=512m"
- mvn clean install
Note that I am NOT using language: java in my travis config, just calling maven directly via the script directive.
export MAVEN_SKIP_RC=true is the recommended way of doing this when dealing with a system that has an /etc/mavenrc. This will make it ignore the defaults and read the MAVEN_OPTS variable.
While it is possible to set -Xmx3g in Travis CI builds, its servers have limited memory to be free for JVM heap in forked surefire tests.
Here is project that use -Xmx2560m for max speed on Travis CI:
https://github.com/plokhotnyuk/actors/blob/8f22977981e0c4d21b67beee994b339eb787ee9a/pom.xml#L151
You can check available memory by - sudo cat /proc/meminfo line added to .travis.yml. Here is output from some Travis CI build: https://travis-ci.org/plokhotnyuk/actors/jobs/55013090#L923
If your project requires bigger heap size then try https://www.shippable.com
Or it is better to use Wercker (much faster builds and without waiting in queue at all) http://wercker.com
This is what finally worked for me.
language: java
sudo: false
jdk:
- oraclejdk8
install: MAVEN_SKIP_RC=true MAVEN_OPTS="-Xss4M" mvn install -DskipTests=true
script: MAVEN_SKIP_RC=true MAVEN_OPTS="-Xss4M" mvn
The MAVEN_SKIP_RC is needed as #adam says and the MAVEN_OPTS are what I needed to get javac to stop blowing out the stack.