- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have a problem when linking my libraries, even if their a re shared or static ones...
the main program (a.f) is
program test
c
doubleprecision a, b
integer i
c
external somma, prodotto, divisione
c
write(6,*) ''
write(6,*) 'Routine Maths'
write(6,*) ''
write(6,*) 'Sum, type 1'
write(6,*) 'Product, type 2'
write(6,*) ''
read(5,*) i
c
a=10.0d0
b=20.0d0
c
if(i.eq.1) then
call somma(a, b, c)
else if (i.eq.2) then
call prodotto(a, b, c)
end if
c
write(6,*) c
c
end
while the subroutine (b.f90) is
subroutine somma(a,b,c)
!
doubleprecision a, b, c
!
c = a + b
end subroutine somma
!
!
!
subroutine prodotto(a,b,c)
!
doubleprecision a, b, c
!
c = a * b
!
end subroutine prodotto
If I run
ifort -o a.out a.f b.f90
all is okkey...
But, if I run
ifort -fpic -c b.f90
ifort -shared b.so b.o
ifort -o a.out a.f b.so
I find this exit (when i run ./a.out)
./a.out: error while loading shared libraries: lib.so: cannot open shared object file: No such file or directory
If I use the static library, when I link the main with the library I found
ifort -fpic -c b.f90
ar rc b.a b.o
ifort -o a.out a.f b.so
/tmp/ifortcOUaGn.o: In function `MAIN__':
a.f:(.text+0x235): undefined reference to `prodotto_'
a.f:(.text+0x24e): undefined reference to `somma_'
How I can resolve my problem???
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the static case, don't you want b.a rather than b.so?
Is your .so in a directory named in LD_LIBRARY_PATH?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
but, why I have to put the b.so in teh LD_LIBRARY_PATH, if it is in the same directory?
- 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