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

Any thoughts on how to force compilation for x86_64 on macOS? #43

Closed
beaugunderson opened this issue Feb 20, 2023 · 3 comments
Closed

Comments

@beaugunderson
Copy link

Get this when compiling:

image

I don't mind compiling for x86_64 but am unsure how to ask cmake to do so.

@dbaston
Copy link
Member

dbaston commented Feb 20, 2023

This looks related to isciences/exactextractr#79. I don't have access to a machine to troubleshoot it.

@beaugunderson
Copy link
Author

I did a little more research and figured out that I can force x86_64 using this incantation:

cmake \
  -DCMAKE_OSX_ARCHITECTURES=x86_64 \
  -DCMAKE_BUILD_TYPE=Release \
  ..

The build completes but now I get this:

$ ./exactextract

dyld[57743]: Library not loaded: /usr/local/pgsql-12/lib/libpq.5.dylib
  Referenced from: <7E2C5AE7-94FF-311B-B475-92F15948B296> /Library/Frameworks/GDAL.framework/Versions/3.1/GDAL
  Reason: tried: '/libpq.5.dylib' (no such file), '/usr/local/pgsql-12/lib/libpq.5.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/pgsql-12/lib/libpq.5.dylib' (no such file), '/usr/local/pgsql-12/lib/libpq.5.dylib' (no such file), '/usr/local/lib/libpq.5.dylib' (no such file), '/usr/lib/libpq.5.dylib' (no such file, not in dyld cache)
Abort trap: 6

The only usable copies of the dylib I have are installed as part of arm64 homebrew:

/opt/homebrew/Cellar/libpq/15.4/lib/libpq.5.dylib
/opt/homebrew/Cellar/postgresql@14/14.9/lib/postgresql@14/libpq.5.dylib

@beaugunderson
Copy link
Author

beaugunderson commented Sep 12, 2023

Oh, I see what happened! I had old versions of GEOS and GDAL in /Library/Frameworks. I removed those, re-ran cmake WITHOUT specifying CMAKE_OSX_ARCHITECTURES and it picked up the homebrew versions I have installed and succeeded in building an arm64 version. Awesome!

$  ./exactextract --help

Zonal statistics using exactextract: version 0.1.0 (f14e007)
Usage: ./exactextract [OPTIONS]

Options:
  -h,--help                   Print this help message and exit
  -p,--polygons TEXT REQUIRED polygon dataset
  -r,--raster TEXT ... REQUIRED
                              raster dataset
  -f,--fid TEXT REQUIRED      id from polygon dataset to retain in output
  -o,--output TEXT REQUIRED   output filename
  -s,--stat TEXT ... REQUIRED statistics
  --max-cells UINT=30         maximum number of raster cells to read in memory at once, in millions
  --strategy TEXT=feature-sequential
                              processing strategy
  --id-type TEXT              override type of id field in output
  --id-name TEXT              override name of id field in output
  --progress
  --config TEXT               Read an ini file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants