conan-io / conan-center-index

Recipes for the ConanCenter repository
https://conan.io/center
MIT License
971 stars 1.79k forks source link

[package] joltphysics/3.0.1: Compilation Fails due to Missing <cstdint> Include #24664

Open cuppajoeman opened 4 months ago

cuppajoeman commented 4 months ago

Description

By creating the following conanfile.txt:

[requires]
joltphysics/3.0.1
[generators]
CMakeDeps
CMakeToolchain
[layout]
cmake_layout

then running conan install . --build=missing on my system, it starts the build process and we get the following:

(ins)[ccn@ccn-20k5s16a25 conan_jolt]$ conan install . --build=missing

======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=17
compiler.libcxx=libstdc++11
compiler.version=14
os=Linux

Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=17
compiler.libcxx=libstdc++11
compiler.version=14
os=Linux

======== Computing dependency graph ========
Graph root
    conanfile.txt: /home/ccn/temp/conan_jolt/conanfile.txt
Requirements
    joltphysics/3.0.1#3f0ab4e3593371b937e239bdc22702c3 - Cache
Build requirements
    cmake/3.30.0#b93985853f6298c398c76dd4c2ac02a2 - Cache
Resolved version ranges
    cmake/[>=3.16 <4]: cmake/3.30.0

======== Computing necessary packages ========
joltphysics/3.0.1: Compatible package ID 4212fd540c92342a9ae4cf4fb0d056086e17df05 equal to the default package ID: Skipping it.
joltphysics/3.0.1: Checking 5 compatible configurations
joltphysics/3.0.1: Compatible configurations not found in cache, checking servers
joltphysics/3.0.1: '21580b4da4678c97dbf252a2cb8bafcae92d2dd5': compiler.cppstd=gnu17
joltphysics/3.0.1: '4d2979f76d3d796fca50b8e8affe5d2061ce715e': compiler.cppstd=20
joltphysics/3.0.1: '1348bffc3401f2edbe9c0f2e400a167955288b4b': compiler.cppstd=gnu20
joltphysics/3.0.1: '099b633a03b62ad904227cdf347917bb77acc5ef': compiler.cppstd=23
joltphysics/3.0.1: '66864d61b670f4f8e4f1ec2cae355d5f4a9701da': compiler.cppstd=gnu23
Requirements
    joltphysics/3.0.1#3f0ab4e3593371b937e239bdc22702c3:4212fd540c92342a9ae4cf4fb0d056086e17df05 - Build
Build requirements
    cmake/3.30.0#b93985853f6298c398c76dd4c2ac02a2:63fead0844576fc02943e16909f08fcdddd6f44b#d7d754a5f57bf0f76caef273545cfd89 - Cache

======== Installing packages ========
cmake/3.30.0: Already installed! (1 of 2)
cmake/3.30.0: Appending PATH environment variable: /home/ccn/.conan2/p/cmakeb7d33a9d18caf/p/bin

-------- Installing package joltphysics/3.0.1 (2 of 2) --------
joltphysics/3.0.1: Building from source
joltphysics/3.0.1: Package joltphysics/3.0.1:4212fd540c92342a9ae4cf4fb0d056086e17df05
joltphysics/3.0.1: Copying sources to build folder
joltphysics/3.0.1: Building your package in /home/ccn/.conan2/p/b/joltpa5ae17f142cff/b
joltphysics/3.0.1: Calling generate()
joltphysics/3.0.1: Generators folder: /home/ccn/.conan2/p/b/joltpa5ae17f142cff/b/build/Release/generators
joltphysics/3.0.1: CMakeToolchain generated: conan_toolchain.cmake
joltphysics/3.0.1: CMakeToolchain generated: /home/ccn/.conan2/p/b/joltpa5ae17f142cff/b/build/Release/generators/CMakePresets.json
joltphysics/3.0.1: Generating aggregated env files
joltphysics/3.0.1: Generated aggregated env files: ['conanbuild.sh', 'conanrun.sh']
joltphysics/3.0.1: Calling build()
joltphysics/3.0.1: Apply patch (conan): Fix CMakeLists: no warnings as errors, allow shared, add install target, and add profile & debug_renderer options
joltphysics/3.0.1: Running CMake.configure()
joltphysics/3.0.1: RUN: cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="/home/ccn/.conan2/p/b/joltpa5ae17f142cff/p" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Release" "/home/ccn/.conan2/p/b/joltpa5ae17f142cff/b/src/Build"
-- Using Conan toolchain: /home/ccn/.conan2/p/b/joltpa5ae17f142cff/b/build/Release/generators/conan_toolchain.cmake
-- Conan toolchain: Setting CMAKE_POSITION_INDEPENDENT_CODE=ON (options.fPIC)
-- Conan toolchain: C++ Standard 17 with extensions OFF
-- Conan toolchain: Setting BUILD_SHARED_LIBS = OFF
-- The CXX compiler identification is GNU 14.1.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (0.6s)
-- Generating done (0.0s)
-- Build files have been written to: /home/ccn/.conan2/p/b/joltpa5ae17f142cff/b/build/Release

joltphysics/3.0.1: Running CMake.build()
joltphysics/3.0.1: RUN: cmake --build "/home/ccn/.conan2/p/b/joltpa5ae17f142cff/b/build/Release" -- -j4
[  0%] Building CXX object CMakeFiles/Jolt.dir/home/ccn/.conan2/p/b/joltpa5ae17f142cff/b/src/Jolt/AABBTree/AABBTreeBuilder.cpp.o
[  1%] Building CXX object CMakeFiles/Jolt.dir/home/ccn/.conan2/p/b/joltpa5ae17f142cff/b/src/Jolt/Core/Color.cpp.o
[  2%] Building CXX object CMakeFiles/Jolt.dir/home/ccn/.conan2/p/b/joltpa5ae17f142cff/b/src/Jolt/Core/Factory.cpp.o
[  3%] Building CXX object CMakeFiles/Jolt.dir/home/ccn/.conan2/p/b/joltpa5ae17f142cff/b/src/Jolt/Core/IssueReporting.cpp.o
In file included from /home/ccn/.conan2/p/b/joltpa5ae17f142cff/b/src/Build/../Jolt/Jolt.h:8,
                 from /home/ccn/.conan2/p/b/joltpa5ae17f142cff/b/src/Jolt/Core/IssueReporting.cpp:5:
/home/ccn/.conan2/p/b/joltpa5ae17f142cff/b/src/Build/../Jolt/Core/Core.h:310:15: error: ‘uint8_t’ does not name a type
  310 | using uint8 = uint8_t;
      |               ^~~~~~~

In the above logs we can see that uint8_t does not define a type, indeed this is noted by the mainter of joltphysics: https://github.com/jrouwe/JoltPhysics/commit/ddd5b5e36d247115367cbf5544f59ae732cc95e9

Also I looked at cached binaries on conancenter to see what kind of build setup was used to actually compile this and noted that we have the following one:

            98320a964d7997d7c2d1bd07b4d59da8947ac0a8
              info
                settings
                  arch: x86_64
                  build_type: Release
                  compiler: gcc
                  compiler.cppstd: 17
                  compiler.libcxx: libstdc++11
                  compiler.version: 11
                  os: Linux
                options
                  debug_renderer: False
                  fPIC: True
                  profile: False
                  shared: False
                  simd: sse42

So noting that the only differece between that and my settings were that I had compiler.version: 14, I changed my compiler settings and still got the above error. Specifically when I force build it with the settings:

Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=17
compiler.libcxx=libstdc++11
compiler.version=11
os=Linux

I still get the uint8_t does not name a type error, I think this error comes up on specific linux distributions that don't automatically include <cstdint> but I honestly don't fully understand why this occurs because it seems like the build settings are identical, so this seems to be a linux distribution specific thing, specifically occurs on manjaro.

Sometime after joltphysics v3.0.1 this was fixed and is now fixed in version 5.0.0. In such a scenario is the package still fine to keep up even though it won't build on some systems? I'm willing to learn how to package and then update this to version 5.0.0, but I'm curious what we do with package versions that don't build on certain systems...

Package and Environment Details

Conan profile

[settings] arch=x86_64 build_type=Release compiler=gcc compiler.cppstd=17 compiler.libcxx=libstdc++11 compiler.version=14 os=Linux

Steps to reproduce

As specified in the original post.

Logs

As specified in the original post.

cuppajoeman commented 4 months ago

I have been trying to package v5.0.0 and noticed another bug, which is that it by default assumes your CPU has some simd features:

https://github.com/conan-io/conan-center-index/blob/2d8c1487659a85c2949ac404c9f9a7ed3eb7790e/recipes/joltphysics/all/conanfile.py#L36

This compilation of the library still works, but then when you try to use it in your own project you get errors about missing instructions because of this.

danimtb commented 4 months ago

Hi @cuppajoeman!

First off, thanks for the detailed report.

Yes, as you pointed out, this might be an issue that arises or not depending on the distribution you are compiling. I will have a try soon on my end.

Sometime after joltphysics v3.0.1 this was fixed and is now fixed in version 5.0.0. In such a scenario is the package still fine to keep up even though it won't build on some systems? I'm willing to learn how to package and then update this to version 5.0.0, but I'm curious what we do with package versions that don't build on certain systems...

Regarding this, yes, we are willing to update on new versions of the library that fixes the issue. In the case the old versions fall too far behind, we even remove them from the index and prioritize new versions. Also, if you just want to indicate that the recipe is still not valid for some configurations it's perfectly fine, we just add a validate() method with the condition there just like this: https://docs.conan.io/2/reference/conanfile/methods/validate.html

danimtb commented 4 months ago

I have been trying to package v5.0.0 and noticed another bug, which is that it by default assumes your CPU has some simd features:

https://github.com/conan-io/conan-center-index/blob/2d8c1487659a85c2949ac404c9f9a7ed3eb7790e/recipes/joltphysics/all/conanfile.py#L36

This compilation of the library still works, but then when you try to use it in your own project you get errors about missing instructions because of this.

Sorry, I replied and did not read you latest comment. I think in this case we will need to ask the author of the library and give some details of the issue upstream. Maybe they can help us with this. Thanks!

cuppajoeman commented 4 months ago

I have been trying to package v5.0.0 and noticed another bug, which is that it by default assumes your CPU has some simd features: https://github.com/conan-io/conan-center-index/blob/2d8c1487659a85c2949ac404c9f9a7ed3eb7790e/recipes/joltphysics/all/conanfile.py#L36

This compilation of the library still works, but then when you try to use it in your own project you get errors about missing instructions because of this.

Sorry, I replied and did not read you latest comment. I think in this case we will need to ask the author of the library and give some details of the issue upstream. Maybe they can help us with this. Thanks!

Hey I think you misread this, I was just trying to say that in the conanfile.py that was a default setting, and that it should probably be not, because assuming so means that if you try to compile and your CPU doesn't have this instruction, then we would get the problem that I described, Joltphysics on it's own works fine, I think this was just an assumption made by the previous packager.

danimtb commented 4 months ago

@cuppajoeman I think I did not give the details - Having a look at https://github.com/jrouwe/JoltPhysics/blob/4084c13b676a2e7ebf9662b47dcb949179b8c4a1/Build/CMakeLists.txt#L40 I saw the options of the recipe and it was covering the same as in the CMakeLists but it is not quite right, so, definitely, it seems there was an incorrect assumption of default option there as you pointed out