Skip to content
This repository has been archived by the owner on Jul 11, 2024. It is now read-only.

CMake can't find the versions of ar and ranlib that are part of miniconda build environment #303

Open
gavinreaney opened this issue May 15, 2019 · 1 comment

Comments

@gavinreaney
Copy link

This can be reproduced by running:

./gradlew :stubs:cpp:downloadConanDeps

after cloning this repo and doing the ./gradlew setup step:
https://github.com/infostellarinc/stellarstation-api

If you run the gradlew command on your machine it will probably work fine, but what is actually happening is that the 'ar' and 'ranlib' that CMake detects are the system installed ones rather than the ones that are part of the miniconda environment. This becomes a problem when trying to run the build inside a container that doesn't include these tools (e.g. curiostack/java-cloud-builder).

You can see the detected tools by checking the contents of this file (BLAH is replaced by some random looking long string):

~/.conan/data/c-ares/1.14.0/conan/stable/build//CMakeCache.txt

In that file look for 'AR:' and 'RANLIB:'. I see things like:

CMAKE_AR:FILEPATH=CMAKE_AR-NOTFOUND
CMAKE_CXX_COMPILER_RANLIB:FILEPATH=CMAKE_CXX_COMPILER_RANLIB-NOTFOUND

As a workaround (for our cloud build) I did an apt install binutils step, but that kind of defeats the purpose of trying to have everything be in miniconda. It must be possible to pass flags to cmake but I took the easiest path to get things working.

@chokoswitch
Copy link
Contributor

Ideally when running conda's cmake, it would be smart enough to not get tricked up like this. But apparently that isn't the case.

The relevant code for finding tools is

https://github.com/Kitware/CMake/blob/master/Modules/CMakeFindBinUtils.cmake#L77

It seems like there might be some holy grail variables to properly point cmake at the miniconda toolchain (an external toolchain)

CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN
CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants