- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I want to link static and dynamic libraries. I want to do it using ifort.
For example we have several source code test1.F and test2.F and we compile by the meaning of:
/opt/intel/Compiler/11.1/069/bin/intel64/ifort -fpic -assume 2underscore -I/ansys_inc/v121/CFX/include -I/home/user/lib -o linux-amd64//test1.o -c test1.F
/opt/intel/Compiler/11.1/069/bin/intel64/ifort -fpic -assume 2underscore -I/ansys_inc/v121/CFX/include -I/home/user/lib -o linux-amd64//test2.o -c test2.F
Once these are compiled I want to link them with static libraries, in this case PVM libraries (libfpvm3.a, libpvm3.a, libpvmtrc.a, libgpvm3.a):
ifort -shared -L/usr/lib -lpvm3 -lgpvm3 -lfpvm3 -lpvmtrc -o ./linux-amd64//libtest.so linux-amd64//test1.o linux-amd64//test2.o
This was doesn't seem to work since the needed functions remained like undefined symbol.
Thanks in advance.
FP
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Probably the static libraries need to be searched multiple times. 'ld' only makes one pass by default. To force multiple passes try adding the highlighted start-group/end-group options:
ifort -shared -L/usr/lib -Wl,--start-group -lpvm3 -lgpvm3 -lfpvm3 -lpvmtrc -Wl,--end-group-o ./linux-amd64//libtest.so linux-amd64//test1.o linux-amd64//test2.o
There's an alternative syntax using -Xlinker, that would be something like:
ifort -shared -L/usr/lib -Xlinker --start-group -Xlinker $(LIBS) -Xlinker --end-group-o ./linux-amd64//libtest.so linux-amd64//test1.o linux-amd64//test2.o
Where you would need to define $(LIBS) inside a makefile or script to be the list of libraries. Outside of a makefile/script,youwould specify each library with a leading -Xlinker option.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

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