fix linker issue on travis ubuntu

This commit is contained in:
Hanzhou Shi 2017-05-13 17:00:27 -07:00
parent e8962dad7e
commit 77eddc8e76
4 changed files with 30 additions and 17 deletions

View File

@ -38,9 +38,7 @@ matrix:
env: TARGET=swift
- os: linux
compiler: clang
env:
- TARGET=swift
- SWIFT_VERSION=swift-3.1.1
env: TARGET=swift
- os: osx
osx_image: xcode8.2
env: TARGET=dotnet

View File

@ -1,9 +1,5 @@
set -euo pipefail
# download swift
mkdir swift
curl https://swift.org/builds/$SWIFT_VERSION-release/ubuntu1404/$SWIFT_VERSION-RELEASE/$SWIFT_VERSION-RELEASE-ubuntu14.04.tar.gz -s | tar xz -C swift &> /dev/null
# make sure we use trusty repositories (travis by default uses precise)
curl https://repogen.simplylinux.ch/txt/trusty/sources_c4aa56bd26c0f54f391d8fae3e687ef5f6e97c26.txt | sudo tee /etc/apt/sources.list
@ -14,8 +10,6 @@ curl https://repogen.simplylinux.ch/txt/trusty/sources_c4aa56bd26c0f54f391d8fae3
sudo apt-get update
sudo apt-get install clang libicu-dev libxml2 sqlite3
# check swift
export SWIFT_HOME=$(pwd)/swift/$SWIFT_VERSION-RELEASE-ubuntu14.04/usr/bin/
export PATH=${SWIFT_HOME):$PATH
swift --version
swift build --version
# This would fix a know linker issue mentioned in:
# https://bugs.swift.org/browse/SR-2299
sudo ln -sf ld.gold /usr/bin/ld

View File

@ -1,4 +1,20 @@
#!/bin/bash
# only test swift as we develop on os x so likely well tested and its dog slow on travis
# linux specific setup, those setup have to be
# here since environment variables doesn't pass
# across scripts
if [ $TRAVIS_OS_NAME == "linux" ]; then
export SWIFT_VERSION=swift-3.1.1
export SWIFT_HOME=$(pwd)/swift/$SWIFT_VERSION-RELEASE-ubuntu14.04/usr/bin/
export PATH=$SWIFT_HOME:$PATH
# download swift
mkdir swift
curl https://swift.org/builds/$SWIFT_VERSION-release/ubuntu1404/$SWIFT_VERSION-RELEASE/$SWIFT_VERSION-RELEASE-ubuntu14.04.tar.gz -s | tar xz -C swift &> /dev/null
fi
# check swift
swift --version
swift build --version
mvn -q -Dtest=swift.* test

View File

@ -194,10 +194,15 @@ public class BaseSwiftTest implements RuntimeTestSupport {
try {
String dylibPath = ANTLR_RUNTIME_PATH + "/.build/debug/";
runProcess(projectDir, SWIFT_CMD, "build",
Pair<String, String> buildResult = runProcess(projectDir, SWIFT_CMD, "build",
"-Xswiftc", "-I"+dylibPath,
"-Xlinker", "-L"+dylibPath,
"-Xlinker", "-lAntlr4");
"-Xlinker", "-lAntlr4",
"-Xlinker", "-rpath",
"-Xlinker", dylibPath);
if (buildResult.b.length() > 0) {
throw new RuntimeException("unit test build failed: " + buildResult.b);
}
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
@ -259,7 +264,7 @@ public class BaseSwiftTest implements RuntimeTestSupport {
ST outputFileST = new ST(
"import Antlr4\n" +
"import Foundation\n" +
"setbuf(__stdoutp, nil)\n" +
"setbuf(stdout, nil)\n" +
"class TreeShapeListener: ParseTreeListener{\n" +
" func visitTerminal(_ node: TerminalNode){ }\n" +
" func visitErrorNode(_ node: ErrorNode){ }\n" +
@ -320,7 +325,7 @@ public class BaseSwiftTest implements RuntimeTestSupport {
"import Antlr4\n" +
"import Foundation\n" +
"setbuf(__stdoutp, nil)\n" +
"setbuf(stdout, nil)\n" +
"let args = CommandLine.arguments\n" +
"let input = ANTLRFileStream(args[1])\n" +
"let lex = <lexerName>(input)\n" +