crevice icon indicating copy to clipboard operation
crevice copied to clipboard

Fails to compile with glam enabled

Open petar-andrejic opened this issue 6 months ago • 0 comments

Using the library in a project fails to compile if the glam feature is enabled, with errors of the form "error[E0599]: no function or associated item named div_euclid found for type f64 in the current scope", and so on for all the other std math functions

The most likely culprit is that the cargo configuration for this library uses

glam = { version = "^0.27", default-features = false, features = ["mint"], optional = true }

Since no default features are used, std is not used as its the only default feature. However, if std is not used, its necessary for glam to use the libm feature instead to provide the math functions, which is not provided

This doesn't seem to be caught in testing because the testing configures

test-all-math-libraries = ["cgmath", "glam", "glam/std", "nalgebra"]

and therefore pulls in the standard library for glam, and wouldn't raise the issue.

I'm not very familiar with cargo so I don't know much about enabling features conditionally, but somehow the solution would be that if std is enabled for this crate, its also passed in for glam, and if not, glam/libm is requested.

Steps to reproduce:

cargo init some_proj
cd some_proj
cargo add crevice -F glam
cargo run

Will fail to compile

petar-andrejic avatar Aug 20 '24 07:08 petar-andrejic