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

fix gmp/6.3.0:ctest:command not found issue #22980

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

crstzh
Copy link

@crstzh crstzh commented Mar 5, 2024

For gmp/6.3.0, it might show the below error if CMake is not present in the run environment.

======== Testing the package: Executing test ========
gmp/6.3.0 (test package): Running test()
gmp/6.3.0 (test package): RUN: ctest --output-on-failure -C Release
/bin/sh: line 1: ctest: command not found

we can bypass this by using the conanbuild environment on non-Windows platforms.

Specify library name and version: gmp/6.3.0

@conan-center-bot
Copy link
Collaborator

Conan v1 pipeline ✔️

All green in build 1 (764f4dc349ae8f1b0a09dd9d13b15087a6f7f2e9):

  • gmp/6.3.0:
    All packages built successfully! (All logs)

  • gmp/6.1.2:
    All packages built successfully! (All logs)

  • gmp/6.2.0:
    All packages built successfully! (All logs)

  • gmp/6.2.1:
    All packages built successfully! (All logs)


Conan v2 pipeline ✔️

Note: Conan v2 builds are now mandatory. Please read our discussion about it.

All green in build 1 (764f4dc349ae8f1b0a09dd9d13b15087a6f7f2e9):

  • gmp/6.2.0:
    All packages built successfully! (All logs)

  • gmp/6.3.0:
    All packages built successfully! (All logs)

  • gmp/6.1.2:
    All packages built successfully! (All logs)

  • gmp/6.2.1:
    All packages built successfully! (All logs)

@jcar87
Copy link
Contributor

jcar87 commented Mar 6, 2024

Hi @crstzh - a bit confused by this.

Recipes in Conan Center (and by extension the test package) are free to assume that CMake is installed at the system level.

Under what scenarios is this failing? Could you provide a reproducible example.

Copy link
Contributor

@jcar87 jcar87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waiting for user to provide reproducible example

@crstzh
Copy link
Author

crstzh commented Mar 6, 2024

Hi @crstzh - a bit confused by this.

Recipes in Conan Center (and by extension the test package) are free to assume that CMake is installed at the system level.

Under what scenarios is this failing? Could you provide a reproducible example.

It's easy to reproduce.

  1. git clone git@github.com:conan-io/conan-center-index.git
  2. cd conan-center-index\recepies\gmp
  3. conan create all --version=6.3.0 -pr windows-msvc17.6.0-x86_64 -s build_type=Debug --build=missing
======== Testing the package: Executing test ========
gmp/6.3.0 (test package): Running test()
gmp/6.3.0 (test package): RUN: ctest --output-on-failure -C Release
/bin/sh: line 1: ctest: command not found

@crstzh crstzh requested a review from jcar87 March 6, 2024 12:28
@jcar87
Copy link
Contributor

jcar87 commented Mar 6, 2024

Thanks @crstzh

What are the contents of your windows-msvc17.6.0-x86_64 ? Is CMake not installed at a global level? What terminal/console are you using?

Please bear in mind that we do assume but all of conan center that CMake (and by extension, ctest) are installed and discoverable in PATH.

@crstzh
Copy link
Author

crstzh commented Mar 7, 2024

windows-msvc17.6.0-x86_64
my windows-msvc17.6.0-x86_64 is this:

{% set arch="x86_64" %}
{% set runtime="dynamic" %}

{% include "windows-msvc17.6.0" %}

and the windows-msvc17.6.0 content:

[settings]
os=Windows
arch={{arch}}

{% if build_type is defined %}
build_type={{build_type}}
{% else %}
build_type=Release
{% endif %}

compiler=msvc
compiler.cppstd=20
compiler.version=193
compiler.runtime={{runtime}}


[tool_requires]
!msvc_desktop|msvc_redists|windows_redists|toolchain|windows_toolchain: msvc_desktop/17.6.0-sdk22h2.755
!msvc_desktop|msvc_redists|windows_redists|toolchain|windows_toolchain: msvc_redists/17.6.0
!msvc_desktop|msvc_redists|windows_redists|toolchain|windows_toolchain: windows_redists/17.6.0-sdk22h2.755
!msvc_desktop|msvc_redists|windows_redists|toolchain|windows_toolchain|cmake|ninja: cmake/3.27.1
!msvc_desktop|msvc_redists|windows_redists|toolchain|windows_toolchain|cmake|ninja: ninja/1.11.1

[options]
{% if build_profile is defined %}
*:shared = False
{% endif %}

[conf]
# Target Windows 7
tools.build:defines += ["NTDDI_VERSION=0x06010000", "WIN32_WINNT=0x0601"]

{% if build_profile is defined %}

{% else %}

# If any of the below compiler flags are modified we must update this
# flags_version variable to ensure that all conan recipes are compiled again
# with the new flags and that the flags_version contributes to package_id.
user.windows_msvc:flags_version=3
tools.info.package_id:confs=["user.windows_msvc:flags_version"]

# Note: please use the - prefix instead of / for all compile flags to ensure
# compatibility with bash/msys2/autotools/gnu builds on windows

# -EHsc - exception handling model
# -Zi - generate debug information in a .pdb file
# -Qspectre - security: spectre mitigations
# -guard:cf - security: control flow guard
tools.build:cflags += ["-EHsc", "-Zi", "-Qspectre", "-guard:cf"]
tools.build:cxxflags += ["-EHsc", "-Zi", "-Qspectre", "-guard:cf"]

# -DEBUG: Always generate debug information
# -guard:cf: security: Control flow guard
tools.build:sharedlinkflags += ["-DEBUG", "-guard:cf"]
tools.build:exelinkflags += ["-DEBUG", "-guard:cf"]

{% endif %}

@jcar87 jcar87 self-assigned this Mar 7, 2024
Copy link
Author

@crstzh crstzh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, cmake.ctest() does not work. Will you follow up this?

@@ -30,4 +30,5 @@ def test(self):
if not can_run(self):
return
with chdir(self, self.folders.build_folder):
self.run(f"ctest --output-on-failure -C {self.settings.build_type}", env="conanrun")
cmake = CMake(self)
cmake.ctest()
Copy link
Contributor

@valgur valgur Mar 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cmake.ctest()
self.run(f"ctest --output-on-failure -C {self.settings.build_type}", env="conanbuild")

Since Conan v1 does not have cmake.ctest().

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

Successfully merging this pull request may close these issues.

4 participants