question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Linker error on ArchLinux

See original GitHub issue

I’m getting a linker error when running make (Additionally I’ve tried adding -fPIC to the compilation options however this hasn’t solved the issue.)

See below command output and versions. From commit dff63246fed84d90118441b8ba5b5d3bdd094427 make output:

cc  -c injector.c -o injector.o -Wall                                                                                                                                                        
injector.c:321:93: warning: excess elements in array initializer                                                                                                                             
  .start={.bytes={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, .len=0},                                                                                 
                                                                                             ^~~~                                                                                            
injector.c:321:93: note: (near initialization for ‘total_range.start.bytes’)                                                                                                                 
injector.c:322:91: warning: excess elements in array initializer                                                                                                                             
  .end={.bytes={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, .len=0},                                                                                   
                                                                                           ^~~~                                                                                              
injector.c:322:91: note: (near initialization for ‘total_range.end.bytes’)                                                                                                                   
cc  injector.o -O3 -Wall -l:libcapstone.a -o injector -pthread                                                                                                                               
/usr/bin/ld: injector.o: relocation R_X86_64_32S against undefined symbol `dummy_stack' can not be used when making a shared object; recompile with -fPIC                                    
/usr/bin/ld: final link failed: Nonrepresentable section on output                                                                                                                           
collect2: error: ld returned 1 exit status
make: *** [Makefile:35: injector] Error 1 

cc --version : cc (GCC) 7.1.1 20170630

ld --version: GNU ld (GNU Binutils) 2.28.0.20170506

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:9

github_iconTop GitHub Comments

2reactions
rigredcommented, Jul 31, 2017

I simply compiled the injector as static which solved the problem of

/usr/bin/ld: injector.o: relocation R_X86_64_32S against undefined symbol `dummy_stack' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
cc injector.o -O3 -Wall -l:libcapstone.a -o injector -pthread -static

however --no-pie also works on gcc7

1reaction
NanXiaocommented, Jul 28, 2017

I come across similar issue when building other software in Arch Linux, and hope my post can help you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[SOLVED] Linker related issued when making c packages ...
Tried to build pam_ssh and rasdaemon, and I get the same type of code error messages. Smells like a gcc regression, right? Arch...
Read more >
OpenGL on Arch Linux - Linker Error: Undefined Reference
Your compilation is not complete, you only try to compile one file, whereas there is several. You can use theses command to compile...
Read more >
[SOLVED] linker error (glibc bug) - Arch Linux
As for the glibc issue, I;ve narrowed down the offending upgrade to glibc-2.29-1.26 -> glibc-2.29-1.27. There were 3 changes made to the glibc ......
Read more >
Linker errors when building audio application on Arch Linux
Hi, I'm getting a various different linker errors when trying to build a new audio application on linux. when trying to build with...
Read more >
T56540 install_deps.sh issues on arch linux
Arch. Blender Version All. Short description of error ... [ 7%] Linking CXX static library . ... ERROR! LLVM-3.4.2 failed to compile, exiting....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found