[swift-dev] Build failure for Linux: "No such module: SwiftGlibc"

Karl Wagner springsupport at me.com
Sat Apr 30 01:46:56 CDT 2016

> On 22 Apr 2016, at 06:46, Timothy Wood <tjw at omnigroup.com> wrote:
>> On Apr 19, 2016, at 1:57 AM, Karl Wagner via swift-dev <swift-dev at swift.org <mailto:swift-dev at swift.org>> wrote:
>> I’m trying to cross-compile Swift for the Raspberry Pi. I’ve got the tools and most of the standard library compiling, but I’m getting stuck trying to build the platform components for Glibc. Swift is just complaining that the “SwiftGlibc” module doesn’t exist. I’d appreciate it if anybody could help trying to find out why.
>> I’ve been whittling down at the compile command, trying to figure out why it isn’t finding/building the module.
> In this message <http://article.gmane.org/gmane.comp.lang.swift.devel/1710 <http://article.gmane.org/gmane.comp.lang.swift.devel/1710>> there was a suggestion to make a symlink to work around this issue (but when building on Ubuntu x86_64, I think). Perhaps something similar would work?
> What steps are you using to get as far as you have? I’m not having a lot of luck so far…
> -tim

Well that seems to be trying to resolve the runtime issue; I’m still trying to compile the standard library.

My changes are here: https://github.com/karwa/swift

Then I’m building with:

../swift/utils/build-script -d \
	--install-prefix="/usr" \
	--install-symroot="${cc_files}/out/symroot" \
	-- \
	--cross-compile-tools-deployment-targets=linux-armv7 \
	--cross-compile-sysroot="${sysroot}" \

(I’m not sure about the install arguments; I’ve only been building for OSX, so I’ve never ‘installed’ a built swift besides Xcode toolchains.)

This builds for the host first, then uses the freshly baked clang and swift compilers to cross-compile to the target. I can compile the tools and what I believe is most of the standard library; it just flops at SwiftGlibc and I can’t understand it because glibc.modulemap exists where it should and looks good (headers pointing inside the cross-compiled sysroot). It’s not even complaining about the modulemap itself (like missing headers or whatever); it just appears unable to find it even though it’s in the swift compiler’s include path.

Is there some kind of extra flag to tell it to look inside that particular modulemap file, that perhaps isn’t being generated for me? I don’t know how that magic works, how Swift knows what to look for when it sees:

@_exported import SwiftGlibc

inside public/Platform/Glibc.swift
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20160430/49c5128a/attachment.html>

More information about the swift-dev mailing list