collect2 and ld

Link to this post 20 Aug 10

collect2 is, AFAICT, a front-end for ld. I am having trouble linking some of my programs for Intel platforms, and the culprit is a -Bstatic switch added in the command line for collect2 (which I determined by adding a --verbose to the ld command that my development environment actually generates. The -Bstatic is put after all the -L switches before the -l switches. This causes ld to look for .a files instead of .so, and since I only have .so files, it doesn't find anything. I want a dynamic link and the switches to ld include -shared. Oddly, after all the -l switches, the collect2 command line has a -Bdynamic switch. What should I be looking for to figure out why the -Bstatic switch is being added?

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board