Compile using aligned_alloc() from Boost. - #11
Open
m000 wants to merge 3 commits into
Open
Conversation
m000
force-pushed
the
master
branch
2 times, most recently
from
July 19, 2020 18:11
0b5d07d to
693d8e9
Compare
Useful for MacOS < 10.15 (Catalina).
|
macos has posix_memalign(), much better than dragging in boost just for this. boost isn't exactly something you want... boost's aligned_alloc is just some tens of headers of complicated C++ that in the end just calls edit: |
Author
|
@sandsmark Didn't know about |
|
sorry for the less than cordial tone, btw, I just had some recent less-than-stellar run-ins with boost. :-) but yeah, posix_memalign is what boost uses as well, so the behavior should be identical. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some minor modifications to compile when
aligned_alloc()is not provided by the system libraries. A notable example of such systems are MacOS versions < 10.15.To resolve this, we link against Boost's implementation of aligned_alloc. A wrapper is used to link the Boost C++ library with the C code of jpeg2png. This behaviour is enabled by setting the
BOOSTbuild variable.After this, jpeg2png can be compiled on MacOS < 10.15 using:
CC=clang CXX=clang++ MACOS=1 BOOST=1 OPENMP=0 make(uses Boostaligned_alloc, and libjpeg from homebrew)For MacOS >= 10.15, this should work:
CC=clang CXX=clang++ MACOS=1 OPENMP=0 make(uses system'saligned_alloc, and libjpeg from homebrew)