August 20, 2010

collect2 and ld

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?

Click Here!