- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, everyone!
Suppose we have three different static libs, namely one.a, two.a, three.a.
If the executable is linked as the command below:
[bash]ifort -o main one.a two.a three.a[/bash]
It may not work. However, if I change the sequence of the statlic libraries on the command line, e.g.
[bash]ifort -o main three.a one.a two.a[/bash]
It would work.
So, here is my question. Is there a sequence dependence of static libs on ifort command line?
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The list of libraries you specify is just passed to ld as-is. ld may not go back to an earlier library if a later one adds a reference to a routine in an earlier library. You may want to add the set of libraries twice to the command line.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The list of libraries you specify is just passed to ld as-is. ld may not go back to an earlier library if a later one adds a reference to a routine in an earlier library. You may want to add the set of libraries twice to the command line.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For recent versions of gnu ld, you may pass the group directives from the compiler, e.g.
-Wl,--start-group *.a -Wl,--end-group
so as to request re-scanning for circular dependencies among those .a files.
The MKL documentation includes examples of this.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page