Problem compiling v5.32.00 on Mac lion 10.7.2

I’m new in Mac systems.

I’m having a problem in compiling the root cern v5.32.00 on mac lion. What i did:

First. I installed Xcode 4.2 from appstore.
Second. I installed gfortran via Homebrew.

After write:

cd /opt/local/root_v5-32-00
./configure --with-f77=/usr/local/bin/gfortran
make -j 3

I got de following error:

==> lib/libRLDAP.so done
clang++ -dynamiclib -single_module -Wl,-dead_strip_dylibs -install_name @rpath/libminicern.so -O2 -m64 -mmacosx-version-min=10.7 -o lib/libminicern.so misc/minicern/src/cernlib.o -ldl misc/minicern/src/hbook.o misc/minicern/src/kernlib.o misc/minicern/src/zebra.o /usr/local/Cellar/gfortran/4.2.4-5666.3/bin/…/lib/gcc/i686-apple-darwin11/4.2.1/x86_64/libgfortranbegin.a
Undefined symbols for architecture x86_64:
"__gfortran_st_write", referenced from:
hgntf in hbook.o
hnbuff in hbook.o
hldirt in hbook.o
hldir in hbook.o
hpath in hbook.o
hnhdwr in hbook.o
hnbfwr in hbook.o

"__gfortran_transfer_character", referenced from:
hgntf in hbook.o
hnbuff in hbook.o
hldirt in hbook.o
hldir in hbook.o
hpath in hbook.o
hnhdwr in hbook.o
hnbfwr in hbook.o

"__gfortran_st_write_done", referenced from:
hgntf in hbook.o
hnbuff in hbook.o
hldirt in hbook.o
hldir in hbook.o
hpath in hbook.o
hnhdwr in hbook.o
hnbfwr in hbook.o

"__gfortran_compare_string", referenced from:
hrend in hbook.o
hldir in hbook.o
hpath in hbook.o
hnhdwr in hbook.o
hnbfwr in hbook.o
hntrd in hbook.o
hnbufr in hbook.o

"__gfortran_transfer_integer", referenced from:
hnbuff in hbook.o
hldirt in hbook.o
hnmset in hbook.o
hntvar in hbook.o
hspace in hbook.o
hntrd in hbook.o
hnbufr in hbook.o

"__gfortran_concat_string", referenced from:
hldir in hbook.o
hpaff in hbook.o
hbnam in hbook.o
hrfile in hbook.o
hntvar2 in hbook.o
rzpaff in zebra.o
"__gfortran_internal_malloc", referenced from:
hpaff in hbook.o
hrfile in hbook.o
hntvar2 in hbook.o
rzpaff in zebra.o
"__gfortran_internal_free", referenced from:
hpaff in hbook.o
hrfile in hbook.o
hntvar2 in hbook.o
rzpaff in zebra.o
"__gfortran_pow_i4_i4", referenced from:
hmachi in hbook.o
"__gfortran_string_index", referenced from:
hbnam in hbook.o
hrfile in hbook.o
hropen in hbook.o
uoptc in kernlib.o
cfopen in kernlib.o
rzfdir in zebra.o
rzopen in zebra.o

"__gfortran_st_close", referenced from:
hropen in hbook.o
rzopen in zebra.o
"__gfortran_string_len_trim", referenced from:
cfstat in kernlib.o
cfopen in kernlib.o
"__gfortran_transfer_array", referenced from:
mzlink in zebra.o
rziodo in zebra.o
"__gfortran_st_read", referenced from:
rziodo in zebra.o
rzopen in zebra.o
"__gfortran_st_read_done", referenced from:
rziodo in zebra.o
rzopen in zebra.o
"__gfortran_st_open", referenced from:
rzopen in zebra.o
"__gfortran_st_inquire", referenced from:
rzopen in zebra.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [lib/libminicern.so] Error 1

Please, help me with this error.

      Thank you in advance,

Renato.

The problem seems to be due to the homebrew distribution of gfortran distributing only static libraries. If you look at the root source in config/Makefile.(macosx|macosx64), it looks for the gfortran libraries by doing:

F77LIBS := $(shell $(F77) -m64 -print-file-name=libgfortran.dylib 2>&1 | grep /)
F77LIBS += $(shell $(F77) -m64 -print-file-name=libgfortranbegin.a 2>&1 | grep /)

For some reason, the homebrew gfortran distribution gives a static libgfortran (libgfortran.a), so the first line effectively prints does nothing, and F77LIBS ends up with only libgfortranbegin.a.

I’m not sure what the best way to go about handling this is. If you just modify the config file and replace “libgfortran.dylib” with “libgfortran.a” the build completes normally. I think a simple conditional check on the format of libgfortran could solve the problem. I’ve reported a bug here:

https://savannah.cern.ch/bugs/?91832

In the mean time, I’ve written a homebrew formula that installs the prebuilt-binaries (since they include all the features that most anybody would want). I’ve submitted a pull-request for the formula that you can see here:

https://github.com/mxcl/homebrew/pull/10426

-Jacob

Dear ROOTers,

I have just tried to compile root v5.32.00 on mac lion, too, and I get the same error message.

In my case I have also installed Xcode 4.2, but I have installed “gcc-42-5666.3-darwin11.pkg”, which includes gfortran from r.research.att.com/tools/

In principle I could also install dynamic “libgfortran-4.2.4-5646.tar.gz” from r.research.att.com/tools/.

However, please note that I could successfully compile root v5.30.06 on the same machine w/o any problems.

Will there be a patched version root v5.32.02 which eliminates this problem and when?

Best regards
Christian

The trunk contains a patch for this issue. Please try it to see if it solves your problem.

Cheers, Fons.

Dear Fons,

Thank you, yes the trunk version solves the problem.

However, my problem is that in order to use the newest version I would need patched binaries which Biocondictor users can download from ROOT. This week the Biocondictor people released the time schedule for the new release, which means that I would need a patched version until March 9, otherwise I need to stick with version root 5.30.06 (which, btw, would be no problem).

Best regards
Christian

The fix will be part of v5-32-01 that will come out early next week.

Cheers, Fons.

Thank you,
Christian