Election-Tech-Initiative/electionguard-cpp

iOS build on cmake 3.19 (Apple silicon)

eleanor-em opened this issue · 2 comments

Bug Report

Current Behavior
From the project root, make build-ios fails with the following message:

error: unable to attach DB: error: accessing build database "...": database is locked Possibly there are two concurrent builds running in the same filesystem location.

Expected behavior/code
The build should succeed.

Environment

  • OS: macOS 11.1 (Big Sur)
  • Architecture: arm64 (Apple silicon)
  • CMake version: 3.19

Possible Solution
This issue has been discussed at the cmake project repository. There is an easy fix: add the argument -T buildsystem=1 at the end of line 133 of the makefile.

I installed cmake 3.19.1 and Xcode 12.4 (12D4e) on my x64 mac and was able to reproduce this issue, but I then explicitly removed the -GXcode call and it appears to be working again. I don't have an M1 mac so I'm not sure this is a good test. Can you try with the below configuration and lmk if that works?

like so:

ifeq ($(OPERATING_SYSTEM),Darwin)
	cmake -S . -B $(ELECTIONGUARD_BUILD_LIBS_DIR)/ios/$(TARGET) \
		-DCMAKE_BUILD_TYPE=$(TARGET) \
		-DCPM_SOURCE_CACHE=$(CPM_SOURCE_CACHE) \
		-DCMAKE_SYSTEM_NAME=iOS \
		"-DCMAKE_OSX_ARCHITECTURES=arm64;arm64e;x86_64" \
		-DCMAKE_OSX_DEPLOYMENT_TARGET=12.4 \
		-DCMAKE_INSTALL_PREFIX=$(ELECTIONGUARD_BUILD_LIBS_DIR)/ios/$(TARGET) \
		-DCMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH=NO \
		-DCMAKE_IOS_INSTALL_COMBINED=YES
	cmake --build $(ELECTIONGUARD_BUILD_LIBS_DIR)/ios/$(TARGET) --config $(TARGET) --target install

Hey @AddressXception, yep I pulled the changes and it works great now. Thanks for this! Feel free to close if you're happy.