LeoHsiao1 / pyexiv2

Read and write image metadata, including EXIF, IPTC, XMP, ICC Profile.
GNU General Public License v3.0
197 stars 39 forks source link

Cannot compile library on arm macs #90

Closed chbndrhnns closed 2 years ago

chbndrhnns commented 2 years ago

I followed the instructions on how to compile the library myself and it fails on my ARM-based mac:

ld: warning: ignoring file /Users/jo/src/scratch/exiv2-0.27.4-Darwin/lib/libexiv2.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: can't open output file for writing: py3.-darwin/exiv2api.so, errno=2 for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Would you be able to let me know how to fix this? Thanks much!

LeoHsiao1 commented 2 years ago

This libexiv2.dylib in package, provided by Exiv2, supports amd64 only. Unfortunately, both exiv2 and pyexiv2 are built using Github Actions without ARM computers. Therefore, you need to compile exiv2 on ARM first to get libexiv2.dylib. Then compile pyexiv2, based on libexiv2.dylib.

chbndrhnns commented 2 years ago

Thanks much, this worked. Here is what I did:

mkdir -p ~/src/scratch
cd ~/src/scratch
git clone git@github.com:Exiv2/exiv2.git
cd exiv2
git checkout tags/v0.27.4 -b v0.27.4
mkdir build; cd build
cmake .. -G "Unix Makefiles" -DEXIV2_TEAM_PACKAGING=On
cmake --build . --target package
cp exiv2-0.27.4-Darwin.tar.gz ~/src/scratch
cd ~/src/scratch
tar -zxvf exiv2-0.27.4-Darwin.tar.gz

After this, I was able to follow these instructions.

LeoHsiao1 commented 2 years ago

Congratulations!