0

After installing an upgrade on my sabayon box (I can't recall what got upgraded) I'm getting a linking error on previously working code.

dmd  src/ast.o src/saturated.o src/queue.o src/operator.o src/tree.o src/heap.o src/bug.o src/levenshtein.o src/main.o src/lexer.o src/binary_tree.o src/sparse_vector.o src/stack.o src/integral_literal.o src/precedence_climbing.o src/traversal.o -ofmain
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../x86_64-pc-linux-gnu/bin/ld: src/ast.o: relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
src/ast.o: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
--- errorlevel 1
make: *** [main] Error 1

I don't know the inner workings of ld (or the object files for that matter) but the only issue I can think of is that ld doesn't understand some of the mangled syntax in the variable or function names in the object files.

Any ideas as to how to resolve this are greatly appreciated.

danba
  • 842
  • 11
  • 32

1 Answers1

0

This is a problem occurred on x86_64 systems.

Try to add -fPIC to your CFLAGS(CXXFLAGS) or your IDE's compiler flags.

This flag will make gcc(g++) to compile in 64 bit.

Tatsuyuki Ishi
  • 3,883
  • 3
  • 29
  • 41
  • In the meanwhile I changed over to a Debian build to fix that problem, so I can't test whether the flags solve the problem, but thanks! – danba Apr 07 '14 at 13:43