[swift-dev] Build Error: Relocation R_X86_64_PC32

Michael Buckley michael at buckleyisms.com
Wed Mar 2 12:13:18 CST 2016


I have been trying to compile on a fresh Ubuntu 15.10 image since the 27th,
and have been unable to succeed, even when using the gold linker. Any
chance this is the same issue?

I installed the OS, and ran the following command.

sudo apt-get install git cmake ninja-build clang python uuid-dev
libicu-dev icu-devtools libbsd-dev libedit-dev libxml2-dev
libsqlite3-dev swig libpython-dev libncurses5-dev pkg-config

Then I ran

git clone https://github.com/apple/swift.git
cd swift
./utils/update-checkout --clone


Finally, I ran

cd ..
./swift/utils/build-script -c -R --llbuild --swiftpm --xctest --foundation
-- --reconfigure --use-gold-linker

Relevant output below.

Manually-specified variables were not used by the project:

    LLVM_TOOL_SWIFT_BUILD


-- Build files have been written to:
/home/buckley/swift/build/Ninja-ReleaseAssert/llvm-linux-x86_64
++ cmake_config_opt llvm
++ product=llvm
++ [[ Ninja == \X\c\o\d\e ]]
+ /usr/bin/cmake --build
/home/buckley/swift/build/Ninja-ReleaseAssert/llvm-linux-x86_64 -- -j4 all
[1484/2025] Building CXX object
tools/clang/lib/ASTMatchers/Dynamic/CMakeFiles/clangDynamicASTMatchers.dir/Registry.cpp.o
FAILED: /usr/bin/clang++   -DCLANG_ENABLE_ARCMT
-DCLANG_ENABLE_OBJC_REWRITER -DCLANG_ENABLE_STATIC_ANALYZER
-DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS
-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fno-stack-protector -fPIC
-fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings
-Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long
-Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor
-std=c++11 -fcolor-diagnostics -ffunction-sections -fdata-sections
-fno-common -Woverloaded-virtual -Wno-nested-anon-types -O3
-Itools/clang/lib/ASTMatchers/Dynamic
-I/home/buckley/swift/llvm/tools/clang/lib/ASTMatchers/Dynamic
-I/home/buckley/swift/llvm/tools/clang/include -Itools/clang/include
-Iinclude -I/home/buckley/swift/llvm/include    -UNDEBUG  -fno-exceptions
-fno-rtti -MMD -MT
tools/clang/lib/ASTMatchers/Dynamic/CMakeFiles/clangDynamicASTMatchers.dir/Registry.cpp.o
-MF
tools/clang/lib/ASTMatchers/Dynamic/CMakeFiles/clangDynamicASTMatchers.dir/Registry.cpp.o.d
-o
tools/clang/lib/ASTMatchers/Dynamic/CMakeFiles/clangDynamicASTMatchers.dir/Registry.cpp.o
-c /home/buckley/swift/llvm/tools/clang/lib/ASTMatchers/Dynamic/Registry.cpp
clang: error: unable to execute command: Killed
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
Ubuntu clang version 3.6.2-1 (tags/RELEASE_362/final) (based on LLVM 3.6.2)
Target: x86_64-pc-linux-gnu
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
http://bugs.debian.org/ and include the crash backtrace, preprocessed
source, and associated run script.
clang: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/Registry-1ff941.cpp
clang: note: diagnostic msg: /tmp/Registry-1ff941.sh
clang: note: diagnostic msg:

********************
[1484/2025] Building CXX object
tools/clang/lib/ASTMatchers/CMakeFiles/clangASTMatchers.dir/ASTMatchFinder.cpp.o
ninja: build stopped: subcommand failed.
./swift/utils/build-script: command terminated with a non-zero exit status
1, aborting


On Mon, Feb 29, 2016 at 8:16 PM, Dmitri Gribenko via swift-dev <
swift-dev at swift.org> wrote:

> IIRC there is no issue in the bug tracker, please feel free to file one!
>
> Also, if you are familiar with binutils internals, it might be helpful
> to bisect the linker.
>
> Meador Inge has also mentioned this bug:
> https://llvm.org/bugs/show_bug.cgi?id=26580
>
> Right now, it does not seem clear to me that we have an understanding
> what the issue is, which component is broken (LLVM, Swift's IRGen, or
> binutils), and if the breakage was accidental or intentional (e.g., to
> fix something else).
>
> Previous thread on this topic:
>
>
> https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20160215/001176.html
>
> https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20160222/001190.html
>
> Dmitri
>
> On Mon, Feb 29, 2016 at 8:04 PM, Ryan Lovelett
> <swift-dev at ryan.lovelett.me> wrote:
> > Perfect.
> >
> > That corresponds with what I am seeing. On the morning of the 22nd (when
> > it built fine) it used binutils-2.25.1-3 and then on the morning of the
> > 23rd (when it failed) it used binutils-2.26-1.
> >
> > I'll look into the build flag for the gold linker
> >
> > Out of curiosity is there a issue in the bug tracker for this that I
> > could follow; or should I file one?
> >
> > Thanks again for the quick response.
> >
> > On Mon, Feb 29, 2016, at 10:55 PM, Dmitri Gribenko wrote:
> >> On Mon, Feb 29, 2016 at 7:51 PM, Ryan Lovelett via swift-dev
> >> <swift-dev at swift.org> wrote:
> >> > I have a daily build of Swift that I make on a Arch Linux box. On the
> >> > morning of February 23rd the build starting failing with the following
> >> > error:
> >> >
> >> > /usr/bin/ld: stdlib/public/core/linux/x86_64/Swift.o: relocation
> >> > R_X86_64_PC32 against protected symbol `_TMPSa' can not be used when
> >> > making a shared object
> >> > /usr/bin/ld: final link failed: Bad value
> >> > clang-3.7: error: linker command failed with exit code 1 (use -v to
> see
> >> > invocation)
> >>
> >> Hi Ryan,
> >>
> >> If you are running binutils 2.26, this is a known issue.  A workaround
> >> is to use the gold linker (build-script-impl has an option for this).
> >>
> >> Dmitri
> >>
> >> --
> >> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> >> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
>
>
>
> --
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
> _______________________________________________
> swift-dev mailing list
> swift-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20160302/715d94a3/attachment.html>


More information about the swift-dev mailing list