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] joltphysics/5.2.0: minimal working example doesn't work out of the box #26561

Open
cuppajoeman opened this issue Feb 8, 2025 · 2 comments · May be fixed by #26594
Open

[package] joltphysics/5.2.0: minimal working example doesn't work out of the box #26561

cuppajoeman opened this issue Feb 8, 2025 · 2 comments · May be fixed by #26594
Labels
bug Something isn't working

Comments

@cuppajoeman
Copy link
Contributor

cuppajoeman commented Feb 8, 2025

Description

Hi there,

I'm testing out the new joltphysics package, joltphysics provides a minimal hello world example here, when I create the following three files:

conanfile.txt

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

CMakeLists.txt

cmake_minimum_required(VERSION 3.10)
project(jtest) 
add_executable(${PROJECT_NAME} main.cpp)
find_package(Jolt)
target_link_libraries(${PROJECT_NAME} Jolt::Jolt)

main.cpp

and then run

conan install .
cmake --preset conan-default
cmake --build --preset conan-release
./build/Release/jtest

I get the following output:

$ ./build/Release/jtest.exe
Version mismatch, make sure you compile the client code with the same Jolt version and compiler definitions!
Mismatching define JPH_FLOATING_POINT_EXCEPTIONS_ENABLED.

I believe the above error occurs when the client code doesn't have JPH_FLOATING_POINT_EXCEPTIONS_ENABLED defined, but the compiled library did have it enabled when it was compiled.

Note that we can reconcile this by creating this define, by doing:
CMakeLists.txt

cmake_minimum_required(VERSION 3.10)
project(jtest) 

add_definitions(-DJPH_FLOATING_POINT_EXCEPTIONS_ENABLED)

add_executable(${PROJECT_NAME} main.cpp)
find_package(Jolt)
target_link_libraries(${PROJECT_NAME} Jolt::Jolt)

I spoke with the creator of joltphysics and he told me that this is expected behavior as the defines must match between the client code and whatever defines were used when joltphysics was built or else you get the "mismatched defines" error. Even though this is expected behavior it might be nice to either document this so that new users trying to use joltphysics from conan can get things working properly.

Package and Environment Details

  • Package Name/Version: joltphysics/5.2.0
  • Operating System+version: Windows 10
  • Compiler+version: MVSC 194
  • Conan version: conan 2.10.1
  • Python version: Python 3.12.7

Conan profile

[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=20
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=194
os=Windows

Steps to reproduce

Follow the steps highlighted in the initial report.

Logs

No required logs currently.

@cuppajoeman cuppajoeman added the bug Something isn't working label Feb 8, 2025
@cuppajoeman cuppajoeman changed the title [package] joltphysics/5.2.0: minimal working example doesn't work (Mismatching define or Segfault) [package] joltphysics/5.2.0: minimal working example doesn't work out of the box Feb 9, 2025
@melak47
Copy link
Contributor

melak47 commented Feb 11, 2025

The JPH_FLOATING_POINT_EXCEPTIONS_ENABLED macro is controlled by the FLOATING_POINT_EXCEPTIONS_ENABLED option in Jolt's CMakeLists.txt which defaults to on,
so the conan recipe should define the macro as well when building with MSVC.

@uilianries uilianries linked a pull request Feb 14, 2025 that will close this issue
3 tasks
@uilianries
Copy link
Member

@cuppajoeman Thank you for providing this detailed issue, including a nice example.

I'm able to reproduce your case on Windows. As @melak47 commented, it's the result of a missing compiler definition.

I just opened the PR #26594 with a hotfix for your case. Regards.

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

Successfully merging a pull request may close this issue.

3 participants