A message for Linux.com registered users: We are in the process of making changes to the Linux forums. Starting Monday, 8/13/18 at 6:00 PM PT, you will be unable to access the forums. They will re-launch as soon as possible on Wednesday, 8/15/18 with new features and improved functionality. Thank you for your patience and stay tuned for the new improved forums.
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?