Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[g77] Il compilatore g77 non linka le librerie [risolto]
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian)
View previous topic :: View next topic  
Author Message
Cazzantonio
Bodhisattva
Bodhisattva


Joined: 20 Mar 2004
Posts: 4514
Location: Somewere around the world

PostPosted: Thu May 22, 2008 11:44 am    Post subject: [g77] Il compilatore g77 non linka le librerie [risolto] Reply with quote

Uso come compilatore il g77 incluso in gcc-3.4.6-r2, tuttavia ho dei problemi a linkare delle librerie esterne al programma. Il seguente comando:
Code:
g77 -L/usr/lib -lfftw3 -I/usr/include -Isubroutines/ -Wall -Wsurprising -Wimplicit -Wno-globals -fno-f2c -fno-ugly -finit-local-zero -O2 -ffloat-store -march=i686 -pipe -fomit-frame-pointer programs/main.F -o lyvect

produce il seguente errore:
Code:
/tmp/cc5inS8x.o: In function `forfttw_':
ccoMzwy4.f:(.text+0x990f): undefined reference to `dfftw_plan_dft_r2c_1d__'
ccoMzwy4.f:(.text+0x991a): undefined reference to `dfftw_execute__'
collect2: ld returned 1 exit status

in pratica non mi trova le subroutine incluse nella libreria fftw3 che avevo linkato con il comando precedente.

Se invece del g77 uso il gfortran incluso in gcc-4.1.2 le librerie vengono linkate correttamente. Un problema del g77 direte voi? Beh ma su ubuntu il g77 (versione 3.4.6) funziona correttamente e il programma gira che è una meraviglia (stessa versione di librerie fftw).

Visto che vorrei continuare ad usare il g77 per motivi prestazionali, e che non vorrei migrare ad ubuntu, come posso risolvere questo inconveniente?
Switchare il profilo con gcc-config non cambia niente...
_________________
Any mans death diminishes me, because I am involved in Mankinde; and therefore never send to know for whom the bell tolls; It tolls for thee.
-John Donne


Last edited by Cazzantonio on Sun Jun 01, 2008 1:49 pm; edited 1 time in total
Back to top
View user's profile Send private message
randomaze
Bodhisattva
Bodhisattva


Joined: 21 Oct 2003
Posts: 9985

PostPosted: Thu May 22, 2008 11:56 am    Post subject: Re: [g77] Il compilatore g77 sotto gentoo non linka le libre Reply with quote

Cazzantonio wrote:
in pratica non mi trova le subroutine incluse nella libreria fftw3 che avevo linkato con il comando precedente.


Che sia un problema di formato e/o compilazione della libreria? Non hai nessun messaggio/warning relativo a quella?
_________________
Ciao da me!
Back to top
View user's profile Send private message
djinnZ
Advocate
Advocate


Joined: 02 Nov 2006
Posts: 4831
Location: somewhere in L.O.S.

PostPosted: Thu May 22, 2008 12:28 pm    Post subject: Reply with quote

ma sei sicuro che fftw sia in /usr/lib?
Anche se mi pare, a naso, il solito problema dei percorsi sballati che affligge da sempre il gcc 3.4.6 (in pratica alcuni pathname sono impostati come /var/tmp/portage/sys-deve/gcc-3.4.6/vattelappesca).
_________________
scita et risus abundant in ore stultorum sed etiam semper severi insani sunt:wink:
mala tempora currunt...mater stultorum semper pregna est :evil:
Murpy'sLaw:If anything can go wrong, it will - O'Toole's Corollary:Murphy was an optimist :wink:
Back to top
View user's profile Send private message
TwoMinds
Tux's lil' helper
Tux's lil' helper


Joined: 14 Jul 2004
Posts: 146
Location: Italy

PostPosted: Thu May 22, 2008 12:44 pm    Post subject: Reply with quote

...banalita': compilato fftw con la USE=fortran?...
Back to top
View user's profile Send private message
Cazzantonio
Bodhisattva
Bodhisattva


Joined: 20 Mar 2004
Posts: 4514
Location: Somewere around the world

PostPosted: Tue May 27, 2008 9:37 am    Post subject: Reply with quote

Scusate il ritardo nella reazione ma sono tornato a lavoro oggi.

@randomaze
Purtroppo quello è il solo errore che riesco ad ottenere, penso sia un problema di PATH male impostati... solo che non so dove impostarli.
@djinnZ
Si ne sono sicuro. Proverò a guardare nei path di gcc...
@TwoMinds
Ovviamente si :-)

Per ora la soluzione tampone è di montare in chroot una partizione ubuntu e compilare lì dentro... solo che è un po' scomodo...
_________________
Any mans death diminishes me, because I am involved in Mankinde; and therefore never send to know for whom the bell tolls; It tolls for thee.
-John Donne
Back to top
View user's profile Send private message
djinnZ
Advocate
Advocate


Joined: 02 Nov 2006
Posts: 4831
Location: somewhere in L.O.S.

PostPosted: Tue May 27, 2008 5:41 pm    Post subject: Reply with quote

ehm... ho dimenticato di specificare che il problema riguarda i pathname inclusi nei file di libreria ed in particolare nei file .la (da cui l'eterno errore di revdep-rebuild e gcj)
_________________
scita et risus abundant in ore stultorum sed etiam semper severi insani sunt:wink:
mala tempora currunt...mater stultorum semper pregna est :evil:
Murpy'sLaw:If anything can go wrong, it will - O'Toole's Corollary:Murphy was an optimist :wink:
Back to top
View user's profile Send private message
Cazzantonio
Bodhisattva
Bodhisattva


Joined: 20 Mar 2004
Posts: 4514
Location: Somewere around the world

PostPosted: Tue May 27, 2008 6:22 pm    Post subject: Reply with quote

Non capisco bene cosa dovrei cambiare in /usr/lib/libfftw3.la:
Code:
# The name that we can dlopen(3).
dlname='libfftw3.so.3'

# Names of this library.
library_names='libfftw3.so.3.1.2 libfftw3.so.3 libfftw3.so'

# The name of the static archive.
old_library='libfftw3.a'

# Libraries that this one depends upon.
dependency_libs=' -lm'

# Version information for libfftw3.
current=4
age=1
revision=2

# Is this an already installed library?
installed=yes

# Should we warn about portability when linking against -modules?
shouldnotlink=no

# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''

# Directory that this library needs to be installed in:
libdir='/usr/lib'
:?:
Il problema è in qualche libreria del gcc? In quale? Come faccio a capirlo?
Scusate la mia ignoranza in materia... :oops:
_________________
Any mans death diminishes me, because I am involved in Mankinde; and therefore never send to know for whom the bell tolls; It tolls for thee.
-John Donne
Back to top
View user's profile Send private message
djinnZ
Advocate
Advocate


Joined: 02 Nov 2006
Posts: 4831
Location: somewhere in L.O.S.

PostPosted: Wed May 28, 2008 1:39 pm    Post subject: Reply with quote

Quello che hai postato va bene gli altri non so. Per capirci potevi trovarti libdir impostat come /var/tmp/portage/vattelappesca/fftw-nonsoche/vattelappesca/usr/lib invece di /usr/lib non so se è questo il problema ma è possibile.
_________________
scita et risus abundant in ore stultorum sed etiam semper severi insani sunt:wink:
mala tempora currunt...mater stultorum semper pregna est :evil:
Murpy'sLaw:If anything can go wrong, it will - O'Toole's Corollary:Murphy was an optimist :wink:
Back to top
View user's profile Send private message
Cazzantonio
Bodhisattva
Bodhisattva


Joined: 20 Mar 2004
Posts: 4514
Location: Somewere around the world

PostPosted: Thu May 29, 2008 8:25 am    Post subject: Reply with quote

Forse sto arrivando a qualcosa...
Quando compilo il programma con il gfortran (gcc-4.1.2) queste sono le librerie linkate
Code:
ale@heavensdoor ~/Dati/Fisica/Lyvect/lyvect_1.0 $ ldd lyvect_8-6
        linux-gate.so.1 =>  (0xb7f07000)
        libfftw3_threads.so.3 => /usr/lib/libfftw3_threads.so.3 (0xb7ef0000)
        libfftw3.so.3 => /usr/lib/libfftw3.so.3 (0xb7e03000)
        libgfortran.so.1 => /usr/lib/gcc/i686-pc-linux-gnu/4.1.2/libgfortran.so.1 (0xb7d88000)
        libm.so.6 => /lib/libm.so.6 (0xb7d5f000)
        libpthread.so.0 => /lib/libpthread.so.0 (0xb7d47000)
        libgcc_s.so.1 => /usr/lib/gcc/i686-pc-linux-gnu/4.1.2/libgcc_s.so.1 (0xb7d3b000)
        libc.so.6 => /lib/libc.so.6 (0xb7be8000)
        /lib/ld-linux.so.2 (0xb7f08000)

Mentre con il g77 (gcc-3.4.6) le librerie sono queste:
Code:
ale@heavensdoor /mnt/ubuntu/home/ale/lyvect_1.0 $ ldd lyvect_8-6
   linux-gate.so.1 =>  (0xb7fc6000)
   libfftw3_threads.so.3 => /usr/lib/libfftw3_threads.so.3 (0xb7faf000)
   libfftw3.so.3 => /usr/lib/libfftw3.so.3 (0xb7ec2000)
   libg2c.so.0 => /usr/lib/gcc/i686-pc-linux-gnu/3.4.6/libg2c.so.0 (0xb7e9d000)
   libm.so.6 => /lib/libm.so.6 (0xb7e74000)
   libpthread.so.0 => /lib/libpthread.so.0 (0xb7e5c000)
   libgcc_s.so.1 => /usr/lib/gcc/i686-pc-linux-gnu/4.1.2/libgcc_s.so.1 (0xb7e50000)
   libc.so.6 => /lib/libc.so.6 (0xb7cfd000)
   /lib/ld-linux.so.2 (0xb7fc7000)

La libreria libgcc_s.so.1 utilizzata è quella del gcc 4.1.2, invece che del 3.4.6... può essere questo il problema? Come posso istruire il compilatore ad utilizzare /usr/lib/gcc/i686-pc-linux-gnu/3.4.6/libgcc_s.so.1 ?

In ubuntu le librerie linkate sono le seguenti:
Code:
   linux-gate.so.1 =>  (0xb7f36000)
   libfftw3_threads.so.3 => /usr/lib/libfftw3_threads.so.3 (0xb7f1d000)
   libfftw3.so.3 => /usr/lib/libfftw3.so.3 (0xb7e37000)
   libg2c.so.0 => /usr/lib/libg2c.so.0 (0xb7e0f000)
   libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7dea000)
   libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb7dd2000)
   libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7dc7000)
   libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7c78000)
   /lib/ld-linux.so.2 (0xb7f37000)

Ovvero riporta pathname diversi per libg2c.so.0, libgcc_s.so.1 e libc.so.6
_________________
Any mans death diminishes me, because I am involved in Mankinde; and therefore never send to know for whom the bell tolls; It tolls for thee.
-John Donne


Last edited by Cazzantonio on Thu May 29, 2008 8:35 am; edited 1 time in total
Back to top
View user's profile Send private message
TwoMinds
Tux's lil' helper
Tux's lil' helper


Joined: 14 Jul 2004
Posts: 146
Location: Italy

PostPosted: Sat May 31, 2008 7:00 am    Post subject: Reply with quote

...ciao... non ho capito perfettamente il problema ma mi sembra di poter dire che sia il seguente: hai tutto il sistema compilato con gcc4 mentre vuoi usare gcc34... le fftw sono compilate con gcc4... con gfortran non esiste piu' la libg2c, sostituita da libgfortran (e non solo)... quindi: o usi gfortran invece di g77 e lasci tutto cosi'... o ti installi su un tuo path privato nella tua home fttw compilate usando gcc34 (g77) e poi linki a questa, dovrebbe bastare...
...non ho capito perche' poi devi usare g77 a tutti i costi...

OT: cosa fai di bello che hai un programma in fortran in un path che comprende la parola "Fisica"?
Back to top
View user's profile Send private message
Cazzantonio
Bodhisattva
Bodhisattva


Joined: 20 Mar 2004
Posts: 4514
Location: Somewere around the world

PostPosted: Sat May 31, 2008 10:31 am    Post subject: Reply with quote

TwoMinds wrote:
o ti installi su un tuo path privato nella tua home fttw compilate usando gcc34 (g77) e poi linki a questa, dovrebbe bastare...
Grazie del consiglio! Proverò sicuramente.
Quote:
...non ho capito perche' poi devi usare g77 a tutti i costi...
Perché è moolto più veloce... e nel mio caso la velocità e una componente di assoluta importanza! :)
Quote:
FOT: cosa fai di bello che hai un programma in fortran in un path che comprende la parola "Fisica"?
Mi hai scoperto... :lol: Faccio simulazioni numeriche, e uso un misto di C e Fortran(77) perché nel mio gruppo di ricerca conoscono tutti soltanto il fortran... :x
Siccome molte di queste simulazioni durano tempi geologici (anche un mese su un quad-xeon 3ghz) capisci bene che anche un 10% in più di velocità mi cambia parecchio la vita... e il g77, per il fatto che è più vecchio, è molto più veloce del suo corrispettivo del gcc-4.1.2.
Vorrei passare tutto il codice verso il fortran95, ma purtroppo questo tipo di considerazioni me lo impedisce.
_________________
Any mans death diminishes me, because I am involved in Mankinde; and therefore never send to know for whom the bell tolls; It tolls for thee.
-John Donne
Back to top
View user's profile Send private message
Cazzantonio
Bodhisattva
Bodhisattva


Joined: 20 Mar 2004
Posts: 4514
Location: Somewere around the world

PostPosted: Sun Jun 01, 2008 1:48 pm    Post subject: Reply with quote

Ho risolto compilando le librerie fftw in locale con la stessa versione di gcc utilizzata per il programma originario (gcc-3.4.6). Grazie a TwoMinds per avermi fatto notare la semplice soluzione :-)
_________________
Any mans death diminishes me, because I am involved in Mankinde; and therefore never send to know for whom the bell tolls; It tolls for thee.
-John Donne
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum