Giter Club home page Giter Club logo

swift-mac2arm-x-compile-toolchain's Introduction

AlwaysRightInstitute

swift-mac2arm-x-compile-toolchain's People

Contributors

helje5 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swift-mac2arm-x-compile-toolchain's Issues

ld: unknown option: -rpath=$ORIGIN

The command
swift build --destination /tmp/cross-toolchain/arm64v8-ubuntu-bionic-destination.json
Results in:

ld: unknown option: -rpath=$ORIGIN
<unknown>:0: error: link command failed with exit code 1 (use -v to see invocation)

Using the -v option, the result is:

xcrun --sdk macosx --find xctest
xcrun --sdk macosx --show-sdk-path
xcrun --sdk macosx --show-sdk-platform-path
xcrun --sdk macosx --find xctest
/private/tmp/cross-toolchain/swift.xctoolchain/usr/bin/swiftc -sdk /private/tmp/cross-toolchain/arm64v8-ubuntu-bionic.sdk -use-ld=gold -tools-directory /private/tmp/cross-toolchain/swift.xctoolchain/usr/bin -g -L /Users/freeksanders/helloworld/.build/aarch64-unknown-linux/debug -o /Users/freeksanders/helloworld/.build/aarch64-unknown-linux/debug/helloworld -module-name helloworld -emit-executable -Xlinker '-rpath=$ORIGIN' @/Users/freeksanders/helloworld/.build/aarch64-unknown-linux/debug/helloworld.product/Objects.LinkFileList
ld: unknown option: -rpath=$ORIGIN
<unknown>:0: error: link command failed with exit code 1 (use -v to see invocation)

This can be 'solved' by changing the '-rpath=$ORIGIN' to -rpath $ORIGIN, i.o.w.:
/private/tmp/cross-toolchain/swift.xctoolchain/usr/bin/swiftc -sdk /private/tmp/cross-toolchain/arm64v8-ubuntu-bionic.sdk -use-ld=gold -tools-directory /private/tmp/cross-toolchain/swift.xctoolchain/usr/bin -g -L /Users/freeksanders/helloworld/.build/aarch64-unknown-linux/debug -o /Users/freeksanders/helloworld/.build/aarch64-unknown-linux/debug/helloworld -module-name helloworld -emit-executable -Xlinker -rpath $ORIGIN @/Users/freeksanders/helloworld/.build/aarch64-unknown-linux/debug/helloworld.product/Objects.LinkFileList

However, that creates the following error:
ld: library not found for -lobjc

Seems the issue might be related to this:
https://stackoverflow.com/a/7388525/2500428

Not sure how to proceed here, but any pointers would be nice.

Not getting past "gold" build on Mojave.

The script runs the build of binutils fine but just stops at:
Configuring gold (~11s)..
.. building gold (~1m)..

The xt-gold-make.log shows as first error:
gold-threads.cc:288:13: error: expected expression
: once_(PTHREAD_ONCE_INIT)
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/pthread.h:216:27: note: expanded from macro 'PTHREAD_ONCE_INIT'
#define PTHREAD_ONCE_INIT {_PTHREAD_ONCE_SIG_init, {0}}

Any insights in how to get past this ?

Using referenced pre-built binaries, executable won't run

UPDATE: I just realized my supposedly 64-bit Raspberry Pi is actually 32-bit (I think). Seems the Raspbian releases are still 32-bit. Lame.

$ arch
armv7l
$ cat /proc/cpuinfo
processor	: 0
model name	: ARMv7 Processor rev 3 (v7l)
BogoMIPS	: 108.00
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xd08
CPU revision	: 3
.
.
.

I followed your link to the pre-built toolchain. I'd open an issue at that fork, but they haven't enabled Github Issues for the repo (https://github.com/CSCIX65G/SwiftCrossCompilers).

I ran through the steps to build the helloworld example, but it won't run on RPi 4 with Debian Buster:

$ ./helloworld 
-bash: ./helloworld: cannot execute binary file: Exec format error
$ file ./helloworld 
./helloworld: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, with debug_info, not stripped

As you can see, the file format is slightly different from the LSB shared object type your README mentions. I built it using:

$ swift build --destination /Library/Developer/Destinations/arm64-5.0-RELEASE.json

which contains

{
    "version": 1,
    "sdk": "/Library/Developer/SDKs/arm64-5.0-RELEASE.sdk",
    "sysroot-flag": "/Library/Developer/Toolchains/arm64-5.0-RELEASE.xctoolchain",
    "toolchain-bin-dir": "/Library/Developer/Toolchains/arm64-5.0-RELEASE.xctoolchain/usr/bin",
    "target": "aarch64-unknown-linux",
    "dynamic-library-extension": "so",
    "extra-cc-flags": [
        "-I", "/Library/Developer/SDKs/arm64-5.0-RELEASE.sdk/usr/include/aarch64-linux-gnu",
        "-I", "/Library/Developer/SDKs/arm64-5.0-RELEASE.sdk/usr/include",
        "-fPIC"
    ],
    "extra-swiftc-flags": [
        "-target", "aarch64-unknown-linux",
        "-use-ld=gold", "-tools-directory", "/Library/Developer/Toolchains/arm64-5.0-RELEASE.xctoolchain/usr/bin"
    ],
    "extra-cpp-flags": [
        "-I", "/Library/Developer/SDKs/arm64-5.0-RELEASE.sdk/usr/include/aarch64-linux-gnu",
        "-I", "/Library/Developer/SDKs/arm64-5.0-RELEASE.sdk/usr/include"
    ]
}

I am not using Docker because there are no obvious instructions on how to do that with the pre-built toolchain (or even if it’s necessary).

I realize this is probably not directly your responsibility, but I’d sure appreciate any help. Thanks!

Not running on RPi B3+ with Ubuntu Bionic

After patching gold-threads.cc line 288, I was able to build the complete toolchain.
I checked everything including the file format which my Mac with Mojave said was:

"ELF 64-bit LSB pie executable ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, with debug_info, not stripped"

Copied it to an RPi 3B+ with Ubuntu Bionic but ./helloworld would not start with bash error:
"./helloworld: cannot execute binary file: Exec format error"

Any idea why that might be the case ?
(RPi running Linux 4.14.34-hypriotos-v7+ armv71 GNU/Linux)

unknown argument: '-color-diagnostics'

When I run swift build --destination /tmp/cross-toolchain/arm64v8-ubuntu-bionic-destination.json

I get the following error message:

<unknown>:0: error: unknown argument: '-color-diagnostics'

Does anyone know how to fix this issue?

If I just run swift build then everything works correctly, so it's only an issue when trying to use the cross-toolchain.

I've tried this on two macs, one using Xcode 12 and the other using Xcode 11.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.