SECTIONS seen after other input files;

Hi, I just run the first C example from
but I get the below error:

/usr/bin/ld: error: /home/john/.local/lib/pgi/linux86-64/13.1/lib/pgi.ld: SECTIONS seen after other input files; try -T/--script
/usr/bin/ld: internal error in input_sections_begin, at ../../gold/merge.h:269

Please tell me how to do it.

Hi John,

I had another user get the same thing, see: Error when compiling example code and from what I could tell it’s a problem with linker from the “binutils-gold” package. Can you try installing the standard binutils? (


Thanks Mat, I will give it a try now

Sorry the problem still there even I have installed the binutils lib.

But actually, I have some confuse on the installation, since the installed lib doesn’t have any merge.h file in it.

Any ideas?

Hi John,

I not sure but I suspect that you still have the ‘gold’ ld in your PATH. What’s the output from “ld --version”?

If this is the case, then either set your PATH so the new ld is picked up or add “LD=/path/to/binutils/bin” to your link line.

  • Mat

Hi Mat,

Yes!! You are right!

I just moved out original ld (gold) from the PATH, and the error is gone.

But some new come out:

/home/john/.local/lib/binutils/bin/ld: cannot find -ldl
/home/john/.local/lib/binutils/bin/ld: cannot find -lpthread
/home/john/.local/lib/binutils/bin/ld: cannot find -lm
/home/john/.local/lib/binutils/bin/ld: cannot find -lc

any idea? Thanks

Hmm, that means the linker doesn’t know where to look for the standard system libraries. There’s probably some configuration missing, but unfortunately I don’t know what needs to be done. Maybe it’s because you have it installed in your local directory?

Instead, try adding “-L/usr/lib” to your link line. If that doesn’t work, add the verbose flag (-v) to your link command, and post the fill output. Not sure it will help, but it may give us some ideas.

  • Mat