Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux build #53

Merged
merged 16 commits into from
Feb 17, 2022
Merged

Linux build #53

merged 16 commits into from
Feb 17, 2022

Conversation

Alexander-Ignition
Copy link
Collaborator

@Alexander-Ignition Alexander-Ignition commented Feb 14, 2022

On Linux, URLSession and URLRequest are not in Foundation, but in FoundationNetworking.
FoundationNetworking has transitive dependencies that prevent compiling a static binary.
Catbird uses only models from CatbirdAPI, so URLSession was removed from the Linux build.

Swift Server Guides Packaging Applications for Deployment

@Alexander-Ignition Alexander-Ignition added the enhancement New feature or request label Feb 14, 2022
@Alexander-Ignition Alexander-Ignition self-assigned this Feb 14, 2022
@Alexander-Ignition
Copy link
Collaborator Author

./catbird-2: error while loading shared libraries: libswift_Concurrency.so: cannot open shared object file: No such file or directory
Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-94-generic x86_64)

@Alexander-Ignition Alexander-Ignition changed the title [WIP]: test linux build Linux build Feb 16, 2022
@modestman
Copy link
Collaborator

Couldn't build on M1 Macbook with Docker, got a random errors or freezes 😞
Maybe it has something to do with cross-compilation from arm to amd64.

Dockerfile

#------- build -------
FROM swift:5.5.1-focal as builder

# set up the workspace
RUN mkdir /workspace
WORKDIR /workspace

# copy the source to the docker image
COPY . /workspace

RUN .github/scripts/linux-build.sh

#------- package -------
FROM ubuntu:focal
# copy executables
COPY --from=builder /workspace/catbird-linux /

# set the entry point (application name)
CMD ["catbird-linux"]
docker build . -t catbird:1.0 --platform linux/amd64

@Alexander-Ignition
Copy link
Collaborator Author

@modestman сatbird is currently being built for x86. To compile to fat binary, you need to pass ...

swift build --arch arm64 --arch x86_64

@subdan has already added this, but had to roll back because the release build was falling on GitHub Actions

It would be a great next step to have Catbird run on arm 👍

@Alexander-Ignition Alexander-Ignition merged commit 3a93bf2 into master Feb 17, 2022
@Alexander-Ignition Alexander-Ignition deleted the test-linux-build branch February 17, 2022 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants