mirror of
https://github.com/jmcnamara/libxlsxwriter.git
synced 2026-05-15 14:15:54 -06:00
[GH-ISSUE #315] Compile libxlsxwriter for arm64 on macOS #255
Labels
No labels
awaiting user feedback
bug
cmake
cmake
docs
feature request
in progress
long term
medium term
medium term
pull-request
question
question
ready to close
short term
under investigation
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/libxlsxwriter#255
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Dirk- on GitHub (Nov 11, 2020).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/315
Originally assigned to: @jmcnamara on GitHub.
What do I have to do in order to use libxlsxwriter.a in an universal (arm64 and x86_64) macOS app? I do have Xcode 12.2 Release Candidate available, so I should have the right tools, but I am not sure where and how to mess with the makefile.
Apple Developer Documentation gives some hints, but I will probably break things when trying to adapt this.
@jmcnamara commented on GitHub (Nov 11, 2020):
I don't know but you could try something like this:
If you figure it out please post an update to leave people know.
@Dirk- commented on GitHub (Nov 11, 2020):
Thanks for the quick reply! The commands work, I just had to move
libxlsxwriter_x86_64.asomewhere else before the secondmake clean.I got some warnings about third_party files being ignored, I will look into this and post my findings.
@jmcnamara commented on GitHub (Nov 12, 2020):
Thanks. I've modified the instruction above to account for that. Could you post the warnings from the compilation.
I'm stuck on macOS 10.14 so I'm not sure if I can compile the arm64-apple-macos11 target. I'll download Xcode 12.2 and check in a few days.
@Dirk- commented on GitHub (Nov 12, 2020):
I get these warnings:
Since they all refer to shared object library files and
libxlsxwriter.dylibI think I can ignore them for my needs (only need the static library).According to the release notes, Xcode 12 requires macOS 10.15.4 or later, so I am afraid it will not work on your system.
@jmcnamara commented on GitHub (Nov 14, 2020):
When I tried to upgrade to Catalina I remembered why I hadn't done it previously. I use Excel 2011 for Mac to generate the screenshots for the docs and that is a 32bit app which isn't compatible with new versions of macOS. So I created a VM with macOS11 and Xcode 12.3 and used that to debug the issue.
Anyway, I've pushed a fix to the main branch with a new make target called
universal_binary:You can try it and let me know how you get on.
@Dirk- commented on GitHub (Nov 15, 2020):
It builds on my system without a warning and the universal binary lib works in my project for the x86_64 side. I cannot tell if the arm64 version works since I do not have an Apple Silicon Mac yet.
Thank you very much!
@Dirk- commented on GitHub (Nov 15, 2020):
@jmcnamara I reopened the issue for information. Feel free to close it, I do not know what you normally do with questions.
@jmcnamara commented on GitHub (Nov 15, 2020):
I'll leave it open until I add some corresponding documentation and then I'll close it. Thanks for the report and the testing.
@evanmiller commented on GitHub (Nov 17, 2020):
With CMake it is sufficient to set
in your CMakeCache.txt. This will ensure that all builds are universal binaries. Lipo etc are unnecessary.
@jmcnamara commented on GitHub (Nov 17, 2020):
@evanmiller Thanks That's much cleaner. I'll add that to the docs.
I could put the x86 part in the CMakeLists.txt file and users could add the arm64 part as needed:
Do you see any issue with that?
@evanmiller commented on GitHub (Nov 17, 2020):
@jmcnamara At this point I'd actually make
x86_64;arm64the default. The newest non-beta Xcode supports it, and it appears that all future Apple hardware will be ARM. Universal binaries are backwards compatible, so this setting won't affect deployment to older operating systems.The only downside I see is it might result in complaints and confusion from people who haven't updated to Xcode 12.2 yet.
@jmcnamara commented on GitHub (Nov 18, 2020):
@evanmiller I think the warnings/errors with Xcode < 12.2 would be too confusing for users so I probably won't add this to the CMakeLists.txt file.
Instead I'll document it as follows:
@jmcnamara commented on GitHub (Mar 22, 2021):
Added docs on how to compile a universal binary version of libxlsxwriter: https://libxlsxwriter.github.io/getting_started.html#gsg_universal
@Whaat commented on GitHub (Dec 31, 2021):
Using 'make universal_binary' with current version gives a fatal error:
lib/libxlsxwriter_x86_64.dylib and lib/libxlsxwriter_arm64.dylib have the same architectures (arm64) and can't be in the same fat output file.
After seeing this error, I tried building the universal binary using cmake and it appears to have worked.
@jmcnamara commented on GitHub (Jan 1, 2022):
@Whaat Thanks for the report. I can see the issue and will fix it soon.
@jmcnamara commented on GitHub (Jan 3, 2022):
@Whaat I've pushed a fix to main.