[R-SIG-Mac] Compiling 2.5.1 on OSX Panther (James Kyle)

Simon Urbanek simon.urbanek at r-project.org
Sat Aug 11 22:47:18 CEST 2007


Unfortunately I'm currently traveling without access to any Panther  
box, so I can help you only theoretically. The problem is that you're  
using static g2c and thus linking it more than once (libR and  
libRlapack) won't work. There are several work arounds:
1) use dynamic g2c (if available)
2) use --without-lapack (possibly --without-blas)
3) link libRlapack manually without g2c (it should be available  
through libR anyway)

Cheers,
Simon


On Aug 10, 2007, at 6:02 PM, James Kyle wrote:

> This seems to be the problem area:
>
>> ld: common symbols not allowed with MH_DYLIB output format with the
>> -multi_module option
>> /usr/local/lib/libg2c.a(err.o) definition of common _f__cblank
>> (size 4)
>> /usr/local/lib/libg2c.a(fmt.o) definition of common _f__cnt (size 40)
>> /usr/local/lib/libg2c.a(fmt.o) definition of common f(char,  *)
>> (size 4)
>> /usr/local/lib/libg2c.a(err.o) definition of common f(char, long *,
>> short __restrict) (size 4)
>> /usr/local/lib/libg2c.a(err.o) definition of common _f__cursor
>> (size 4)
>>
>
> It goes on to list the other common symbols found in libg2c.a.
> libg2c.a is a library provided by the g77 libraries.
>
> So I checked out "$ man ld" to find out about this pesky -
> multi_module option and also poked around and found some references
> to MH_DYLIB and some other interesting options like -undefined.
>
> Particularly, under the heading TWO-LEVEL AND FLAT NAMESPACES, three
> paragraphs down we see the default for static link editor is -
> twolevel_namespace which requires that all undefined references be
> satisfied at static link time. Also, the ability to suppress these
> errors is disabled (-undefined suppress).
>
> I assume that what's going on is some of the global variables in /usr/
> local/lib/libg2c.a are defined but not instantiated. So they need to
> be explicitly set as externs or set to some default value. Since the
> ability to suppress errors isn't available when compiling the
> libRlapack.dylib, then it must be changed in libg2c.a....that entails
> recompiling gfortran.
>
>
> I'm not clear on why the same code compiles on 10.4 unless gfortran
> 4.x. doesn't do this. Anyway, I downloaded the 3.4.2 gcc source and
> looked for err.c with f__cblank var declared (the first error):
>
>> /usr/local/lib/libg2c.a(err.o) definition of common _f__cblank
>> (size 4)
>
> It seems there were some major changes in fortran between 3.x and 4.x
> as the above variables don't exist and even directory structures are
> different. For example, f__cblank and f__cnt don't exist in 4.x. Nor
> does the libf2c directory where libg2c.a is compiled in 3.x.
>
> That's a wrap for  me today, but I'll try to compile a version of
> libg2c.a without the common symbol errors on Monday.
>
> As always, if any developers or those more familiar with the code
> base would like to chime in and direct, correct, refute, or suggest.
> It'd be very appreciated.
>
>
> -james kyle
> On Aug 10, 2007, at 7:14 AM, Ulf Martin wrote:
>
>> Hi
>>
>> James R. Milks schrieb:
>>> You can find the compiled version of R 2.5.1 for OS 10.4.4 or higher
>>> at http://cran.r-project.org/bin/macosx/.  I try not to get into
>>> compiling myself as I've had pretty bad luck with doing  
>>> compilations.
>>
>> I think the problem is, that the binaries are for OS 10.4.x =  
>> "Tiger",
>> they don't work on 10.3.y = "Panther". So this tip won't help. Two
>> month
>> ago I also tried to compile the new R version (2.5.0 then) on Panther
>> without success. So I am still hanging around with R 2.4.1. :-(
>>
>> Just a guess, as I have no idea what's really going on: The
>> compilation
>> fails making lapack stuff. Now, since lapack is a Fortran 77
>> package the
>> problem might have something to do with this?! (My compilation also
>> failed at this point.)
>>
>>> On Aug 9, 2007, at 3:04 PM, krunk7 at gmail.com wrote:
>>>>
>>>> I'm attempting to compile R 2.5.1 on OSX Panther and have run into
>>>> some issues. First off, if anyone has a link to a binary build of
>>>> 2.5.1 for Panther I have no issue going that route.
>>>>
>>>> -) gcc version 3.3 20030304 (Apple Computer, Inc. build 1666)
>>>> -) g77 version 3.4.2
>>>> -) ./configure --with-blas='-framework vecLib' --with-lapack
>>>> R_PAPERSIZE=letter F77=g77
>>>>
>>>> When first seeing the build issues, I wanted to verify that I have
>>>> the necessary basic environment. I grabbed the 2.2.1 sources, which
>>>> are the latest version available with a binary for Panther, and  
>>>> they
>>>> compiled without a hitch.
>>>>
>>>> The error appears in the lapack module when building
>>>> libRlapack.dylib. Error output is:
>>>>
>>>>> make[4]: Entering directory `/opt/sandbox/R-2.5.1/src/modules/
>>>>> lapack'
>>>>> gcc -std=gnu99 -dynamiclib -L/sw/lib -L/usr/local/lib -o
>>>>> libRlapack.dylib dlamch.o dlapack0.o dlapack1.o dlapack2.o
>>>>> dlapack3.o dlapack4.o cmplx.o -install_name libRlapack.dylib -
>>>>> compatibility_version 2.5.0 -current_version 2.5.1  -
>>>>> headerpad_max_install_names  -L/usr/local/lib/gcc/powerpc-apple-
>>>>> darwin6.8/3.4.2 -lg2c -L../../../lib -lR
>>>>> /usr/bin/libtool: internal link edit command failedld: warning
>>>>> multiple definitions of symbol _z_abs/usr/local/lib/libg2c.a
>>>>> (z_abs.o) definition of _z_abs in section (__TEXT,__text)../../../
>>>>> lib/libR.dylib(z_abs.o) definition of _z_absld: warning multiple
>>>>> definitions of symbol _f__cabs/usr/local/lib/libg2c.a(cabs.o)
>>>>> definition of _f__cabs in section (__TEXT,__text)../../../lib/
>>>>> libR.dylib(cabs.o) definition of _f__cabsld: common symbols not
>>>>> allowed with MH_DYLIB output format with the -multi_module option/
>>>>> usr/local/lib/libg2c.a(err.o) definition of common _f__cblank  
>>>>> (size
>>>>> 4)/usr/local/lib/libg2c.a(fmt.o) definition of common _f__cnt  
>>>>> (size
>>>>> 40)/usr/local/lib/libg2c.a(fmt.o) definition of common f(char,  *)
>>>>> (size 4)/usr/local/lib/libg2c.a(err.o) definition of common f 
>>>>> (char,
>>>>> long *, short __restrict) (size 4)/usr/local/lib/libg2c.a(err.o)
>>>>> definition of common _f__cursor (size 4)/usr/local/lib/libg2c.a
>>>>> (err.o) definition of common _f__doed (size 4)/usr/local/lib/
>>>>> libg2c.a(err.o) definition of common _f__doend (size 4)/usr/local/
>>>>> lib/libg2c.a(err.o) definition of common _f__doned (size 4)/usr/
>>>>> local/lib/libg2c.a(err.o) definition of common _f__dorevert (size
>>>>> 4)/usr/local/lib/libg2c.a(err.o) definition of common _f__elist
>>>>> (size 4)/usr/local/lib/libg2c.a(err.o) definition of common
>>>>> _f__fmtbuf (size 4)/usr/local/lib/libg2c.a(err.o) definition of
>>>>> common _f__fmtlen (size 4)/usr/local/lib/libg2c.a(err.o)  
>>>>> definition
>>>>> of common _f__init (size 4)/usr/local/lib/libg2c.a(fmt.o)
>>>>> definition of common _f__nonl (size 4)/usr/local/lib/libg2c.a
>>>>> (fmt.o) definition of common _f__parenlvl (size 4)/usr/local/lib/
>>>>> libg2c.a(fmt.o) definition of common f(char *) (size 4)/usr/local/
>>>>> lib/libg2c.a(fmt.o) definition of common _f__ret (size 40)/usr/
>>>>> local/lib/libg2c.a(fmt.o) definition of common _f__revloc (size  
>>>>> 4)/
>>>>> usr/local/lib/libg2c.a(fmt.o) definition of common f(long double,
>>>>> *) (size 4)/usr/local/lib/libg2c.a(err.o) definition of common
>>>>> _f__scale (size 4)/usr/local/lib/libg2c.a(fmt.o) definition of
>>>>> common _f__workdone (size 4)/usr/local/lib/libg2c.a(err.o)
>>>>> definition of common _f__units (size 4800)/usr/local/lib/libg2c.a
>>>>> (err.o) definition of common f(char, float) (size 4)/usr/local/ 
>>>>> lib/
>>>>> libg2c.a(err.o) definition of common _f__curunit (size 4)/usr/
>>>>> local/
>>>>> lib/libg2c.a(err.o) definition of common _f__donewrec (size 4)/ 
>>>>> usr/
>>>>> local/lib/libg2c.a(err.o) definition of common _f__external (size
>>>>> 4)/usr/local/lib/libg2c.a(err.o) definition of common  
>>>>> _f__formatted
>>>>> (size 4)/usr/local/lib/libg2c.a(err.o) definition of common
>>>>> _f__hiwater (size 4)/usr/local/lib/libg2c.a(err.o) definition of
>>>>> common _f__putn (size 4)/usr/local/lib/libg2c.a(err.o) definition
>>>>> of common _f__reading (size 4)/usr/local/lib/libg2c.a(err.o)
>>>>> definition of common _f__recpos (size 4)/usr/local/lib/libg2c.a
>>>>> (err.o) definition of common _f__sequential (size 4)/usr/local/ 
>>>>> lib/
>>>>> libg2c.a(err.o) definition of common _f__getn (size 4)/usr/local/
>>>>> lib/libg2c.a(err.o) definition of common _f__icptr (size 4)/usr/
>>>>> local/lib/libg2c.a(err.o) definition of common f(short, void, int,
>>>>> char) (size 4)
>>>>> make[4]: *** [libRlapack.dylib] Error 1  make[4]: Leaving  
>>>>> directory
>>>>> `/opt/sandbox/R-2.5.1/src/modules/lapack'make[3]: *** [R] Error
>>>>> 2make[3]: Leaving directory `/opt/sandbox/R-2.5.1/src/modules/
>>>>> lapack'make[2]: *** [R] Error 1make[2]: Leaving directory `/opt/
>>>>> sandbox/R-2.5.1/src/modules'make[1]: *** [R] Error 1make[1]:
>>>>> Leaving directory `/opt/sandbox/R-2.5.1/src'make: *** [R] Error 1
>>
>> _______________________________________________
>> R-SIG-Mac mailing list
>> R-SIG-Mac at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>
>



More information about the R-SIG-Mac mailing list