Skip to content

enable asset swap, IPFS, and related features for iOS builds#2046

Open
Maxnflaxl wants to merge 7 commits into
boost-1.90from
ios-enable-extras
Open

enable asset swap, IPFS, and related features for iOS builds#2046
Maxnflaxl wants to merge 7 commits into
boost-1.90from
ios-enable-extras

Conversation

@Maxnflaxl
Copy link
Copy Markdown
Member

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:

  • Asset swap (existing): 9eacb39 removes the BEAM_ASSET_SWAP_SUPPORT=OFF override from the iOS CMake block so the global option (default ON) applies. 2d6bab fixes the wallet_core propagation by changing if (NOT ANDROID AND NOT IOS) to if (NOT ANDROID) — without it, dex_board.cpp failed to compile because the BEAM_ASSET_SWAP_SUPPORT-guarded saveDexOffer/dropDexOffer declarations were hidden in the cpp's translation unit on iOS.
  • IPFS (new): 4aca35b flips -DBEAM_IPFS_SUPPORT=Off=On for both iOS device and simulator slices in .github/workflows/build.yml, and bumps 3rdparty/asio-ipfs to c7f2db2 — the tip of 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 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.a byte-identical to their _no_ipfs siblings — ipfs_get and friends return ApiError::NotSupported. With this branch the iOS slice matches the desktop and Android builds, so ipfs_get actually 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 into Frameworks/beam-ios-<version>/.

Maxnflaxl added 7 commits May 9, 2026 02:59
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.
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

Successfully merging this pull request may close these issues.

1 participant