enable asset swap, IPFS, and related features for iOS builds#2046
Open
Maxnflaxl wants to merge 7 commits into
Open
enable asset swap, IPFS, and related features for iOS builds#2046Maxnflaxl wants to merge 7 commits into
Maxnflaxl wants to merge 7 commits into
Conversation
Without this, dex_board.cpp fails to compile because the BEAM_ASSET_SWAP_SUPPORT-guarded saveDexOffer/dropDexOffer declarations on IWalletDB are hidden in the cpp's translation unit even when the option is ON, since the macro never reaches wallet_core (and therefore its transitive consumers) on iOS.
Turn on BEAM_IPFS_SUPPORT for the iOS device and simulator workflow slices so libwallet_api.a / libwallet_client.a are built with ipfs_get / ipfs_add wired up (matching the desktop and Android builds instead of returning ApiError::NotSupported). Bump 3rdparty/asio-ipfs to the feat/ios-support tip (BeamMW/asio-ipfs#feat/ios-support), which adds CMAKE_SYSTEM_NAME=iOS cross-compilation paths for libipfs-bindings.a + libasio-ipfs.a. Without that submodule update the workflow flip would FATAL_ERROR at configure time on "Unsupported host platform iOS".
Pulls in BeamMW/asio-ipfs@beded1b which moves the iOS cross-compile flags from CC into CGO_CFLAGS / CGO_LDFLAGS so they reach Go's std-library cgo compiles (net, os/user, plugin). Previous run on this PR errored at those packages with `<netdb.h>` / `<unistd.h>` / `<dlfcn.h>` file not found.
asio-ipfs's cgo build leaves intermediate package archives scattered through 3rdparty/asio-ipfs/go-workspace/pkg/... (one per Go package, e.g. bidirule.a, golang_x_text_...). These aren't Mach-O — they're Go's own ar-archive format used for package caching — so the lipo step that fuses device + simulator slices choked on the first one it hit with `archive with no architecture specification`. Limit the find to non-go-workspace paths; the real iOS static libs (libwallet_api.a, libwallet_client.a, libipfs-bindings.a, etc.) live elsewhere under ./build and ./build-simulator.
The previous filter excluded `*/go-workspace/*` but bidirule.a still slipped through — Go writes some cross-compiled package archives into $GOROOT/pkg/<plat>/ (under ./build/3rdparty/asio-ipfs/golang/...) and $GOCACHE locations that aren't under go-workspace. Matching on the lib*.a prefix instead is a cleaner discriminator: every Beam C++ target produces lib<name>.a, while Go's package archives don't have the prefix, so the filter catches the real iOS static libs and rejects the cgo intermediates regardless of where Go drops them.
Investigation: extracted the Go 1.16.10 tarball asio-ipfs downloads and found ~400 .a files inside, all under the toolchain root: - go/pkg/darwin_arm64/*.a (prebuilt host std-lib — net.a, bidirule.a) - go/src/**/testdata/*.a (test fixtures — libimportsar.a, etc.) At build time the toolchain extracts into ./build/3rdparty/asio-ipfs/golang/ and uses ./build/3rdparty/asio-ipfs/go-workspace/ as GOPATH. The previous name-based filters (lib*.a, then path-based for go-workspace only) both let some of these through. `lipo -info` looked tempting as a content filter but isn't safe either: Go's net.a in pkg/darwin_arm64/ is a valid arm64-darwin Mach-O archive that lipo happily accepts — combining it into the device slice would silently produce a corrupt library mixing iOS and Darwin objects. Surgical fix: prune both ./build/3rdparty/asio-ipfs/golang/ and ./build/3rdparty/asio-ipfs/go-workspace/ from the find. The two artifacts we actually want from asio-ipfs — libipfs-bindings.a (Go c-archive) and libasio-ipfs.a (C++ wrapper) — live one level above those dirs, so they're still collected. Verified the find expression locally against a synthetic tree mirroring the real layout.
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.
Re-rolling #2045 under a more general name now that the branch covers IPFS as well as asset swap.
What's in this branch
On top of
boost-1.90:9eacb39removes theBEAM_ASSET_SWAP_SUPPORT=OFFoverride from the iOS CMake block so the global option (default ON) applies.2d6babfixes thewallet_corepropagation by changingif (NOT ANDROID AND NOT IOS)toif (NOT ANDROID)— without it,dex_board.cppfailed to compile because theBEAM_ASSET_SWAP_SUPPORT-guardedsaveDexOffer/dropDexOfferdeclarations were hidden in the cpp's translation unit on iOS.4aca35bflips-DBEAM_IPFS_SUPPORT=Off→=Onfor both iOS device and simulator slices in.github/workflows/build.yml, and bumps3rdparty/asio-ipfstoc7f2db2— the tip of BeamMW/asio-ipfs#feat/ios-support, which adds CMAKE_SYSTEM_NAME=iOS cross-compilation paths forlibipfs-bindings.a+libasio-ipfs.a. Without that submodule bump the workflow flip would FATAL_ERROR at configure time on "Unsupported host platform iOS".Why
iOS builds currently produce
libwallet_api.a/libwallet_client.abyte-identical to their_no_ipfssiblings —ipfs_getand friends returnApiError::NotSupported. With this branch the iOS slice matches the desktop and Android builds, soipfs_getactually fetches from Beam's private IPFS swarm (used by the on-chain DApp Store).Dependency
Depends on BeamMW/asio-ipfs#feat/ios-support — please review/merge that first, then I can re-pin the submodule to
BeamMW/asio-ipfs:master.Verification
CI on this PR exercises both iOS slices end-to-end (device arm64 + simulator x86_64). The resulting
beam-ios-*/beam-ios-simulator-*/beam-ios-combined-*artifacts are what the iOS wallet drops intoFrameworks/beam-ios-<version>/.