-
Notifications
You must be signed in to change notification settings - Fork 50
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 source build on aarch64/homebrew #95
Conversation
On apple platforms, libtiff is not installed by the operating system. If the user has it installed, likely it was installed by homebrew. Previously, on x86, homebrew installed libs into /usr/lib which is in the default search path, but since aarch64, homebrew has moved libs to /opt/homebrew/lib. So now we use pkg-config to find the library. Potential problems: - Not everyone has pkg-config (e.g windows users, a few mac users) - Not everyone actually needs libtiff, only the network geotiff users, but we assume everyone needs it since most system installations include it. Note that proj enables tiff support by defeault, provided libtiff is found (using pkg-config? or something else?)
proj-sys/build.rs
Outdated
// in some default search path. | ||
eprintln!("Failed to find libtiff with pkg-config: {}", err); | ||
} | ||
} | ||
println!("cargo:rustc-link-lib=dylib=tiff"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm having second thoughts about some of my changes in 9aca22c 😬
Assuming that the system proj has tiff was a nice way to avoid building from src in more circumstances, but we're now also requiring libtiff whenever building from source.
With a little work we might be able to accommodate all these cases...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After typing it out, I was motivated to just address this. With b0f4474 we only require tiff when using the network
feature, which I've now forwarded from proj to proj/sys.
It's almost like the old bunled_proj_tiff, except that we'll still allow a system proj to satisfy the requirement, assuming that it has tiff support.
We could add some kind of check to build.rs to make sure the linked libproj supports tiff, but I'm inclined to wait and see if it's actually a problem.
If we wanted to require pkg-config, one (not very impressive) approach would be parsing the output of pkg-config --libs --static proj
for libtiff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC, kornel's Rust -sys library guide notes that pkg-config can be quite fussy. Homebrew's proj installs pkg-config but of course we can't make that assumption w/r/t/ Linux, so if we can do without it that's great.
bors try I'm curious if the failing tests are just an aarch64 thing... |
Oh yeah! Looks like tests have passed. I'm inclined to propose merging this as is, and leave the 3 failing tests as a separate change. I notice that I get different results when linking against proj 8.2 vs building proj 8.1 from source. |
tryBuild succeeded: |
It's reasonable to assume that it's a db update causing NaN values (as has been the case in the past) due to bounding box updates. |
Oh! For some reason I assumed all the linux distros relied on pkg-config and that it was just the mac and windows people that might be missing it. Here's my proposal, if you're OK with it:
|
That sounds good to me! |
bors r=urschrei |
Build succeeded: |
Slightly improves the situation at #57
On apple platforms, libtiff is not installed by the operating system. If
the user has it installed, likely it was installed by homebrew.
Previously, on x86, homebrew installed libs into /usr/lib which is in
the default search path, but since aarch64, homebrew has moved libs to
/opt/homebrew/lib.
So now we use pkg-config to find the library.
Potential problems:
but we assume everyone needs it since most system installations
include it.
Note that proj enables tiff support by defeault, provided libtiff is
found (using pkg-config? or something else?)
This is a draft because some tests are currently failing for me on aarch64. I'm looking into it now...
failing test output