macworld Posted October 15, 2007 Report Share Posted October 15, 2007 Ho un programma scritto in Fortran 77.Ho scaricato i binaries per il compilatore g77 da questo sito:http://hpc.sourceforge.net/Il g77 mi funziona per tutti i programmini scritti in fortran 77 salvo che per un programma specifico che mi interessa far girare. Quando lancio l'eseguibile del programma in questione sul terminal mi appare la scritta:bash: ./nomeeseguibile: cannot execute binary filePremetto che su computer al di fuori del mio mac, col sistema operativo linux, tale programma gira. Premetto che ho tentato di lanciare anche da terminal sh e tcsh, e comunque non gira.Che devo fare? Dove vado ad operare? E' un problema di makefile?thanks!!! Link to comment Share on other sites More sharing options...
DarwinNE Posted October 15, 2007 Report Share Posted October 15, 2007 Se fai ls -l da terminale, il file in questione è nella directory corrente? Ha i permessi corretti, in particolare è un eseguibile? Link to comment Share on other sites More sharing options...
macworld Posted October 15, 2007 Author Report Share Posted October 15, 2007 Se fai ls -l da terminale, il file in questione è nella directory corrente? Ha i permessi corretti, in particolare è un eseguibile?Il file è un eseguibile, è mi parte tranquillamente in linnux.Il file eseguibile è nella directory da dove lancio l'eseguibile stesso.P.s.Io faccio semplicemente "ls", ed il file dell'eseguidile è nella directory corrente. Link to comment Share on other sites More sharing options...
DarwinNE Posted October 15, 2007 Report Share Posted October 15, 2007 Il file è un eseguibile, è mi parte tranquillamente in linnux.Si, ma Linux .NE. MacOSX. Hai ricompilato il programma con il Mac? Lo so che è banale, ma... Vi sono degli errori? Il comando ls -l dà in più delle informazioni sui permessi. Sono corretti? Link to comment Share on other sites More sharing options...
macworld Posted October 15, 2007 Author Report Share Posted October 15, 2007 Si, ma Linux .NE. MacOSX. Hai ricompilato il programma con il Mac? Lo so che è banale, ma... Vi sono degli errori? Il comando ls -l dà in più delle informazioni sui permessi. Sono corretti?Dunque:Io ho un proframma main.f che chiama una serie di programmi *.f. Il programma globalmente include un 40ina di file *.f. Ora ti spiego come sono organizzati:I file *.f sono in una loro sotto-directory.I file dati, di input ed il file eseguibile sono in un'altra sotto-directory.i file delle common sono in una loro sotto-directoryA monte di queste c'è una directory che le racchiude (che è la directory root), ove c'è il makefile.Io faccio il "makefile" tramite comando "make" e mi dice "nothing to be done for 'build'. Ma questo credo sia normale, lo fa anche su Lynux, in quanto io non ho modificato nulla nei file *.f.Poi vado nella directory dell'eseguibile, lo lancio e mi si blocca.Il problema può essere nel come è fatto il "makefile"? Link to comment Share on other sites More sharing options...
DarwinNE Posted October 15, 2007 Report Share Posted October 15, 2007 Io faccio il "makefile" tramite comando "make" e mi dice "nothing to be done for 'build'. Ma questo credo sia normale, lo fa anche su Lynux, in quanto io non ho modificato nulla nei file *.f.Poi vado nella directory dell'eseguibile, lo lancio e mi si blocca.Linux...Allora, forse ho capito. Il makefile si sbaglia, perché vede un sacco di file già compilati, nonché l'eseguibile che pero' non è per MacOSX, ma che proviene dalla vecchia compilazione fatta precedentemente sotto Linux. Come ti dicevo, dato che Linux .NE. MacOSX, quest'ultimo risponde picche se cerchi di eseguire un eseguibile per un altro sistema operativo. C'è da fare un po' di pulizia.Prova a fare qualcosa del tipo:make cleanmake all Link to comment Share on other sites More sharing options...
macworld Posted October 15, 2007 Author Report Share Posted October 15, 2007 Ok ho provato a dare questi comandi nella cartella principale, quella dove c'è il makefile. Riporto cosa mi scrive: se faccio "make": REBUILDING PROGRAM make[1]: Nothing to be done for `build'. se faccio "make all": REBUILDING PROGRAM make[1]: Nothing to be done for `build'. se faccio "make clean": make: *** No rule to make target `clean'. Stop. Quindi quando lancio l'eseguibile "./nome_eseguibile", mi scrive come prima: bash: ./aermod_ff_fw: cannot execute binary file Immagino che sia il makefile a fare problemi... Link to comment Share on other sites More sharing options...
macworld Posted October 15, 2007 Author Report Share Posted October 15, 2007 Linux...Allora, forse ho capito. Il makefile si sbaglia, perché vede un sacco di file già compilati, nonché l'eseguibile che pero' non è per MacOSX, ma che proviene dalla vecchia compilazione fatta precedentemente sotto Linux.Infatti: il fatto che scrive "nothing done to be built", me lo fa anche su linux quando non modifico nulla. Quello è del tutto normale, in quanto il programmino è gia compilato ed il make non deve far nulla. Il problema è che però qui su mac non mi parte l'eseguibile....forse un problema di incompatibilità tra eseguibile e versione del g77 che ho scaricato...? Link to comment Share on other sites More sharing options...
DarwinNE Posted October 15, 2007 Report Share Posted October 15, 2007 ...forse un problema di incompatibilità tra eseguibile e versione del g77 che ho scaricato...?Quello che ha scritto il makefile non ha previsto il clean... Cancella a mano l'eseguibile ed i file temporanei. Rilancia il make.Fai una copia di sicurezza prima di cancellare alcunché.Non è un problema dovuto a MacOSX. Almeno, non credo. Non inizia neppure a compilare perché trova dei file con data corretta e crede che sia tutto già compilato.Magari metti uno spazio in qualche sorgente, tanto per forzare un rebuild. Link to comment Share on other sites More sharing options...
macworld Posted October 15, 2007 Author Report Share Posted October 15, 2007 Allora: ho preso il codice cosi come è: gli ho buttato via l'eseguibile, ho fatto il make; ed è uscita fuori sta cosa strana, in cui mi ero già imbattuto in passato. REBUILDING PROGRAM g77 -p -o ../RUN/aermod_ff_fw main.o geo_rot.o mode.o coef.o tdsl_ff.o struct_hb.o strcoef.o -L. -lbem -lm /usr/bin/ld: main.o bad magic number (not a Mach-O file) /usr/bin/ld: geo_rot.o bad magic number (not a Mach-O file) /usr/bin/ld: mode.o bad magic number (not a Mach-O file) /usr/bin/ld: coef.o bad magic number (not a Mach-O file) /usr/bin/ld: tdsl_ff.o bad magic number (not a Mach-O file) /usr/bin/ld: struct_hb.o bad magic number (not a Mach-O file) /usr/bin/ld: strcoef.o bad magic number (not a Mach-O file) /usr/bin/ld: archive: ./libbem.a has no table of contents, add one with ranlib(1) (can't load from it) collect2: ld returned 1 exit status make[1]: *** [../RUN/aermod_ff_fw] Error 1 make: *** [all] Error 2 non ha creato l'eseguibile. Dopodichè: ho modificato un file.f, mettendo uno spazietto. Ho ridato il make, ed ho una cosa simile: REBUILDING PROGRAM g77 -c -O -fno-automatic -w -I../INCLUDE ../SOURCES/tdsl_ff.f g77 -p -o ../RUN/aermod_ff_fw main.o geo_rot.o mode.o coef.o tdsl_ff.o struct_hb.o strcoef.o -L. -lbem -lm /usr/bin/ld: main.o bad magic number (not a Mach-O file) /usr/bin/ld: geo_rot.o bad magic number (not a Mach-O file) /usr/bin/ld: mode.o bad magic number (not a Mach-O file) /usr/bin/ld: coef.o bad magic number (not a Mach-O file) /usr/bin/ld: struct_hb.o bad magic number (not a Mach-O file) /usr/bin/ld: strcoef.o bad magic number (not a Mach-O file) /usr/bin/ld: archive: ./libbem.a has no table of contents, add one with ranlib(1) (can't load from it) collect2: ld returned 1 exit status make[1]: *** [../RUN/aermod_ff_fw] Error 1 make: *** [all] Error 2 ...questo è quanto... Link to comment Share on other sites More sharing options...
macworld Posted October 17, 2007 Author Report Share Posted October 17, 2007 Nessun modo di uscrine che tu sappia? Link to comment Share on other sites More sharing options...
DarwinNE Posted October 17, 2007 Report Share Posted October 17, 2007 Nessun modo di uscrine che tu sappia?Si, cancellare tutti i file temporanei .o creati dalla compilazione. Stesso problema di prima, ma sui file contenenti il codice oggetto (*.o) e che non possono essere processati dal linker.Guarda qui:http://it.wikipedia.org/wiki/Compilatorehttp://it.wikipedia.org/wiki/Codice_oggettohttp://it.wikipedia.org/wiki/Linker Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now