Closed
Description
I am trying to build a custom SDK that targets ubuntu on x86_64
and contains the package glib-2.0
. My host is arm64-apple-macosx14.0
, (swiftlang-5.10.0.13 clang-1500.3.9.4)
I created a Dockerfile
which contains glib-2.0
:
FROM swift:5.10-jammy
RUN apt update && apt -y install libglib2.0-dev && apt -y clean
Then build the image using the target platform
docker build -t swift-5.10-glib:amd64 --platform=linux/amd64 -f Dockerfile .
Then build the SDK (using my fix/workaround from #88):
swift run swift-sdk-generator make-linux-sdk --target x86_64-unknown-linux-gnu \
--swift-version 5.10-RELEASE \
--with-docker \
--from-container-image swift-5.10-glib:amd64 \
--sdk-name 5.10-RELEASE_ubuntu_jammy_x86_64_glib
Then I use swift experimental-sdk install
to install the SDK.
Unfortunately, the build fails:
swift build -c release --experimental-swift-sdk 5.10-RELEASE_ubuntu_jammy_x86_64_glib
[...]
ld.lld: error: undefined symbol: g_list_alloc
>>> referenced by swift_glib_test.swift:14 (/Users/tobias/Developing/swift-glib-test/Sources/swift-glib-test/swift_glib_test.swift:14)
>>> /Users/tobias/Developing/swift-glib-test/.build/x86_64-unknown-linux-gnu/release/swift_glib_test.build/swift_glib_test.swift.o:($s15swift_glib_testAAV14ArgumentParser15ParsableCommandAacDP3runyyKFTW)
The example repo is up here: https://github.com/t089/swift-glib-test
The generated SDK seems to contain the required lib:
$ ls -l /Users/tobias/Library/org.swift.swiftpm/swift-sdks/5.10-RELEASE_ubuntu_jammy_x86_64_glib.artifactbundle/5.10-RELEASE_ubuntu_jammy_x86_64_glib/x86_64-unknown-linux-gnu/ubuntu-jammy.sdk/lib/x86_64-linux-gnu | grep glib
glib-2.0
libglib-2.0.a
libglib-2.0.so -> libglib-2.0.so.0
libglib-2.0.so.0 -> libglib-2.0.so.0.7200.4
libglib-2.0.so.0.7200.4
Am I doing something wrong? What could I try to debug this further?
Interestingly, if I run the build inside Docker using the same image as used for building the SDK from above, the build succeeds:
docker run -it --rm --platform linux/amd64 -v (pwd):/app -w /app swift-5.10-glib:amd64 swift run
Building for debugging...
[57/57] Linking swift-glib-test
Build complete! (38.85s)
Hello, world!
Metadata
Metadata
Assignees
Labels
No labels