Skip to content
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

[package] cmake does not build without... cmake #4334

Closed
madebr opened this issue Jan 22, 2021 · 6 comments
Closed

[package] cmake does not build without... cmake #4334

madebr opened this issue Jan 22, 2021 · 6 comments
Labels
bug Something isn't working

Comments

@madebr
Copy link
Contributor

madebr commented Jan 22, 2021

While trying #2463 on my raspi2,
I added cmake/3.19.2 to the build requirements of the default recipe.
Building it fails with the following error because I didn't have cmake installed on my system.
Of course apt-get install cmake works, but that might not always be the case.
I think the cmake conan package should be the only package that can expect cmake to not be present on the system.

Conan profile

[settings]
os=Linux
os_build=Linux
arch=armv7
arch_build=armv7
compiler=gcc
compiler.version=6
compiler.libcxx=libstdc++
build_type=Release
[options]
[build_requires]
cmake/3.19.2@
[env]

Steps to reproduce (Include if Applicable)

conan install cmake/3.19.2@ --build missing

Logs (Include/Attach if Applicable)

conan install cmake/3.19.2@ --build missing
maarten@maarten-pi:~ $ conan install cmake/3.19.2@ --build missing
Configuration:
[settings]
arch=armv7
arch_build=armv7
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++
compiler.version=6
os=Linux
os_build=Linux
[options]
[build_requires]
*: cmake/3.19.2
[env]

Installing package: cmake/3.19.2
Requirements
    cmake/3.19.2 from 'conan-center' - Cache
    openssl/1.1.1i from 'conan-center' - Cache
Packages
    cmake/3.19.2:df3070f2eab8556b318b95ef61db52ea89c7530f - Build
    openssl/1.1.1i:ac873a00fd3cd4fa2dbdb9efe7d318532afae973 - Cache

Installing (downloading, building) binaries...
openssl/1.1.1i: Already installed!
cmake/3.19.2: WARN: Build folder is dirty, removing it: /home/maarten/.conan/data/cmake/3.19.2/_/_/build/df3070f2eab8556b318b95ef61db52ea89c7530f
cmake/3.19.2: Copying sources to build folder
cmake/3.19.2: Building your package in /home/maarten/.conan/data/cmake/3.19.2/_/_/build/df3070f2eab8556b318b95ef61db52ea89c7530f
cmake/3.19.2: Generator cmake created conanbuildinfo.cmake
cmake/3.19.2: Calling build()
/bin/sh: 1: cmake: not found
cmake/3.19.2: 
cmake/3.19.2: ERROR: Package 'df3070f2eab8556b318b95ef61db52ea89c7530f' build failed
cmake/3.19.2: WARN: Build folder /home/maarten/.conan/data/cmake/3.19.2/_/_/build/df3070f2eab8556b318b95ef61db52ea89c7530f
ERROR: cmake/3.19.2: Error in build() method, line 92
	cmake = self._configure_cmake()
while calling '_configure_cmake', line 80
	self._cmake.configure(source_folder=self._source_subfolder)
	ConanException: Error 127 while executing cd '/home/maarten/.conan/data/cmake/3.19.2/_/_/build/df3070f2eab8556b318b95ef61db52ea89c7530f' && cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Release" -DCONAN_IN_LOCAL_CACHE="ON" -DCONAN_COMPILER="gcc" -DCONAN_COMPILER_VERSION="6" -DCONAN_LIBCXX="libstdc++" -DCMAKE_INSTALL_PREFIX="/home/maarten/.conan/data/cmake/3.19.2/_/_/package/df3070f2eab8556b318b95ef61db52ea89c7530f" -DCMAKE_INSTALL_BINDIR="bin" -DCMAKE_INSTALL_SBINDIR="bin" -DCMAKE_INSTALL_LIBEXECDIR="bin" -DCMAKE_INSTALL_LIBDIR="lib" -DCMAKE_INSTALL_INCLUDEDIR="include" -DCMAKE_INSTALL_OLDINCLUDEDIR="include" -DCMAKE_INSTALL_DATAROOTDIR="share" -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY="ON" -DCONAN_EXPORTED="1" -DCMAKE_CXX_STANDARD="11" -DCMAKE_BOOTSTRAP="False" -DCMAKE_USE_OPENSSL="True" -DOPENSSL_USE_STATIC_LIBS="True" -Wno-dev '/home/maarten/.conan/data/cmake/3.19.2/_/_/build/df3070f2eab8556b318b95ef61db52ea89c7530f/source_subfolder'
@madebr madebr added the bug Something isn't working label Jan 22, 2021
@Croydon
Copy link
Contributor

Croydon commented Jan 22, 2021

Yes, that is more a missing feature than a bug.

I think the way to go is to add an option bootstrap and if it is True then use the bootstrapping possibility with make. If bootstrap is False assume that a CMake version is around to build CMake.

What I think should be avoided is dynamically flipping bootstrap on/off because this can lead to unwanted surprises and reproducibility issues.

Where I'm not entirely sure yet is if bootstrap should be True or False by default. The advantage for True is clear, you don't need a CMake around, but specifically on Windows you will need to pull in more dependencies

@Croydon
Copy link
Contributor

Croydon commented Jan 22, 2021

If someone wants to pick this up I would appreciate it, if not I will eventually come back to this as it ties in with my work at conan-io/conan-docker-tools#241 and a few other things

@madebr
Copy link
Contributor Author

madebr commented Jan 22, 2021

How about the following?

options = {
    `bootstrap`: [True, False, "auto"],
}
default_options = {
    `bootstrap`: "auto",
}
def configure(self):
    if self.options.bootstrap == "auto":
        self.options.bootstrap = tools.which("cmake") is None

The bootstrap option is set automatically by default, but can be forced to a value.
And I think full reproducibility can be achieved.

t-8ch added a commit to t-8ch/conan-center-index that referenced this issue Aug 1, 2022
@t-8ch
Copy link
Contributor

t-8ch commented Aug 1, 2022

I created a PR for the bootstrap functionality at #11996.
It intentionally does no auto-detection however.

t-8ch added a commit to t-8ch/conan-center-index that referenced this issue Aug 1, 2022
t-8ch added a commit to t-8ch/conan-center-index that referenced this issue Aug 2, 2022
t-8ch added a commit to t-8ch/conan-center-index that referenced this issue Aug 10, 2022
t-8ch added a commit to t-8ch/conan-center-index that referenced this issue Aug 10, 2022
conan-center-bot pushed a commit that referenced this issue Aug 11, 2022
* cmake: clean up whitespace

* cmake: prepare for conan v2

* cmake: add bootstrap option

See #4334
@t-8ch
Copy link
Contributor

t-8ch commented Aug 11, 2022

The option bootstrap has been merged.

@uilianries
Copy link
Member

Implemented by #11996

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants