Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to build Google's V8 on FreeBSD 9.1 using clang and running into the following error:

/usr/bin/ld: final link failed: Nonrepresentable section on output
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[1]: *** [/root/v8/out/x64.release/cctest] Error 1
gmake[1]: Leaving directory `/root/v8/out'
gmake: *** [x64.release] Error 2

I needed to use gmake rather than make, and I added the following to use clang:

setenv CC /usr/bin/clang
setenv CXX /usr/bin/clang++
setenv GYP_DEFINES "clang=1"

Some version info:

# clang -v
FreeBSD clang version 3.1 (branches/release_31 156863) 20120523
Target: x86_64-unknown-freebsd9.0
Thread model: posix
# gmake -v
GNU Make 3.82
Built for amd64-portbld-freebsd9.1

command used to checkout v8 code:

# svn checkout v8
# uname -a
FreeBSD thug 9.1-RC3 FreeBSD 9.1-RC3 #0 r242324: Tue Oct 30 00:58:57 UTC 2012  amd64

What is causing this linking error?

share|improve this question

FreeBSD has version 3.18.5 available in the ports system.

If that isn't new enough for you, at least look at /usr/ports/lang/v8/Makefile. It seems v8 needs some special options, see the following excerpt from the port Makefile:

ALL_TARGET=     native
MAKE_ARGS=      library=shared

.include <>
.if ${CC:T:Mclang} == "clang" || ${CXX:T:Mclang++} == "clang++" || ${OSVERSION} >= 1000024
_CLANG!=        clang --version | ${HEAD} -1 | ${SED} -e 's/.*clang version \([0-9]\)\.\([0-9]\).*/\1\2/'
MAKE_ENV+=      LINK=clang++
CFLAGS+=        -Wno-unused-private-field
.if ${_CLANG} >= 33
CFLAGS+=        -Wno-nested-anon-types -Wno-unused-function
MAKE_ARGS+=     strictaliasing=off
USE_GCC=        any

For your version of clang, it seems you need to add -Wno-unused-private-field to CFLAGS. And you'll need to specify a couple of extra arguments to make; library=shared and strictaliasing=off

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .