Opened 13 years ago

Closed 13 years ago

#32285 closed defect (fixed)

hdf4 @4.2.6 +gcc45 compiling error - linking failure

Reported by: xt10@… Owned by: tenomoto (Takeshi Enomoto)
Priority: Normal Milestone:
Component: ports Version: 2.0.3
Keywords: Cc:
Port: hdf4

Description (last modified by ryandesign (Ryan Carsten Schmidt))

"h4fc" (the compiling command) fails to compile fortran77 program associated with hdf library. The command and error message is as below:

xxxx:xxx xxx$ h4fc sds_rd.f -o sds_rd.exe
   gfortran-mp-4.5: /opt/local/bin/gfortran-mp-4.5: linker input file       unused because linking not done
   ld: in /opt/local/bin/gfortran-mp-4.5, can't link with a main    executable
   collect2: ld returned 1 exit status

Change History (3)

comment:1 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)
Keywords: linking hdf4 library removed
Owner: changed from macports-tickets@… to takeshi@…
Priority: HighNormal

Please remember to preview before submitting so you can ensure you got your WikiFormatting right; Don't set Priority to High; Do Cc the maintainer of the affected port.

comment:2 in reply to:  description Changed 13 years ago by kgh03@…

the problem lies in /opt/local/bin/h4fc
$FFLAGS contains the compiler so it appears twice on the command.
passing -echo flag to h4fc reveals this:

 + eval /opt/local/bin/gfortran-mp-4.5 /opt/local/bin/gfortran-mp-4.5 -pipe -O2 -m32 -arch ppc -L/opt/local/lib -L/opt/local/lib sd_rd.o -L/opt/local/lib -lmfhdf -ldf -lsz -ljpeg -lz
++ /opt/local/bin/gfortran-mp-4.5 /opt/local/bin/gfortran-mp-4.5 -pipe -O2 -m32 -arch ppc -L/opt/local/lib -L/opt/local/lib sd_rd.o -L/opt/local/lib -lmfhdf -ldf -lsz -ljpeg -lz
ld: in /opt/local/bin/gfortran-mp-4.5, can't link with a main executable
collect2: ld returned 1 exit status
+ status=1
+ exit 1

removing gfortran from the FFLAGS seems to fix this.

# FFLAGS="/opt/local/bin/gfortran-mp-4.5 -pipe -O2 -m32 "
FFLAGS=" -pipe -O2 -m32 "

tian, if you want a work around for now,

cp /usr/local/bin/h4fc ~/
edit ~/h4fc as above.
then run h4fc as ~/h4fc sds_rd.f

thanks for all your hard work Takeshi.

kelly

Replying to xt10@…:

"h4fc" (the compiling command) fails to compile fortran77 program associated with hdf library. The command and error message is as below:

xxxx:xxx xxx$ h4fc sds_rd.f -o sds_rd.exe
   gfortran-mp-4.5: /opt/local/bin/gfortran-mp-4.5: linker input file       unused because linking not done
   ld: in /opt/local/bin/gfortran-mp-4.5, can't link with a main    executable
   collect2: ld returned 1 exit status

comment:3 Changed 13 years ago by tenomoto (Takeshi Enomoto)

Resolution: fixed
Status: newclosed

configure tries to extract additional flags by grep - from $F77. With gcc4x gfortran-mp-4.x has - within its name so it is regarded as an option. Fixed in r87614.

Note: See TracTickets for help on using tickets.