[racket] SunOS-5.10-amd64: Issue with lseek64 etc. functions in xform'ed source

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed May 30 12:19:16 EDT 2012

It looks like C pre-processing might be sensitive to the build mode. 
Does it help to put "-m64" in CPPFLAGS instead of CFLAGS?

At Wed, 30 May 2012 17:14:49 +0100, Tim Brown wrote:
> Folks,
> 
> I'm trying to build racket on SunOS 5.10 with gcc:
> gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath)
> (which is the system gcc)
> 
> I configure with:
> ../configure --prefix=/usr2/local/racket-master/SunOS-5.10-amd64 
> CFLAGS=-m64 LDFLAGS=-m64 --enable-shared
> (Oh, I'm in an architecture dependent subdirectory of src)
> 
> and my build fails as per the extract below.
> 
> I don't think that lseek64 (et al.) are available in the 64 bit libc
> libraries on solaris (at least according to nm):
> 
>  > nm /usr/lib/libc.so | grep lseek64
> [6606]  |    701088|      14|FUNC |GLOB |0    |11     |_lseek64
> [8121]  |    701088|      14|FUNC |WEAK |0    |11     |lseek64
>  > nm /usr/lib/64/libc.so | grep lseek64
>  >
> 
> According to the manual, these are "transitional" functions which
> allow 32 bit developers to access 64-bit sized files. And natively,
> on 64-bit, they are unnecessary (and therefore not provided).
> 
> The racketcgc builds fine. The issue comes when building racket3m.
> I have found in the transformed files (e.g.) ./racket/gc2/xsrc/fun.c
> 
> ----------------------------------------------------
> # 162 "/usr/include/sys/resource.h" 3
> ;
> 
> #pragma redefine_extname setrlimit setrlimit64
> 
> 
> #pragma redefine_extname getrlimit getrlimit64
> ----------------------------------------------------
> 
> which causes the not provided functions to be used.
> 
> At a glance, can anyone either give me a solution, or a pointer to help me
> out here; otherwise, I'll be delving into this a bit blind tomorrow.
> 
> Thanks,
> 
> Tim Brown
> 
> ../../../racket/gc2/../../utils/nicear 
> /usr2/other/tim-brown-racket-81dc927/src/SunOS-5.10-amd64/lt/libtool 
> --mode=link --tag=CC gcc -XCClinker -static-libgcc -release 5.3.0.9 -rpath 
> /usr2/local/racket-master/SunOS-5.10-amd64/lib -m64 -ldl -lm  -lsocket 
> -lnsl -lintl -o  ../libracket3m.la salloc.lo  bignum.lo  bool.lo 
> builtin.lo  char.lo  compenv.lo  compile.lo  complex.lo  dynext.lo  env.lo 
>   error.lo  eval.lo  file.lo  fun.lo  future.lo  hash.lo  jit.lo 
> jitalloc.lo  jitarith.lo  jitcall.lo  jitcommon.lo  jitinline.lo 
> jitprep.lo  jitstack.lo  jitstate.lo  list.lo  marshal.lo  module.lo 
> mzrt.lo  network.lo  numarith.lo  number.lo  numcomp.lo  numstr.lo 
> optimize.lo  place.lo  port.lo  portfun.lo  print.lo  rational.lo  read.lo 
>   regexp.lo  resolve.lo  sema.lo  setjmpup.lo  sfs.lo  string.lo  struct.lo 
>   symbol.lo  syntax.lo  thread.lo  type.lo  validate.lo  vector.lo 
> foreign.lo ../src/gmp.lo  ../src/unwind.lo 
> ../../foreign/libffi/libffi_convenience.la gc2.lo
> rm -fr  ../.libs/libracket3m-5.3.0.9.so ../.libs/libracket3m.la 
> ../.libs/libracket3m.lai ../.libs/libracket3m.so
> gcc -shared -Wl,-h -Wl,libracket3m-5.3.0.9.so -o 
> ../.libs/libracket3m-5.3.0.9.so  .libs/salloc.o .libs/bignum.o .libs/bool.o 
> .libs/builtin.o .libs/char.o .libs/compenv.o .libs/compile.o 
> .libs/complex.o .libs/dynext.o .libs/env.o .libs/error.o .libs/eval.o 
> .libs/file.o .libs/fun.o .libs/future.o .libs/hash.o .libs/jit.o 
> .libs/jitalloc.o .libs/jitarith.o .libs/jitcall.o .libs/jitcommon.o 
> .libs/jitinline.o .libs/jitprep.o .libs/jitstack.o .libs/jitstate.o 
> .libs/list.o .libs/marshal.o .libs/module.o .libs/mzrt.o .libs/network.o 
> .libs/numarith.o .libs/number.o .libs/numcomp.o .libs/numstr.o 
> .libs/optimize.o .libs/place.o .libs/port.o .libs/portfun.o .libs/print.o 
> .libs/rational.o .libs/read.o .libs/regexp.o .libs/resolve.o .libs/sema.o 
> .libs/setjmpup.o .libs/sfs.o .libs/string.o .libs/struct.o .libs/symbol.o 
> .libs/syntax.o .libs/thread.o .libs/type.o .libs/validate.o .libs/vector.o 
> .libs/foreign.o ../src/.libs/gmp.o ../src/.libs/unwind.o .libs/gc2.o -Wl,-z 
> -Wl,allextract ../../foreign/libffi/.libs/libffi_convenience.a -Wl,-z 
> -Wl,defaultextract  -ldl -lm -lsocket -lnsl -lintl -lc  -static-libgcc -m64
> (cd ../.libs && rm -f libracket3m.so && ln -s libracket3m-5.3.0.9.so 
> libracket3m.so)
> creating ../libracket3m.la
> (cd ../.libs && rm -f libracket3m.la && ln -s ../libracket3m.la libracket3m.la)
> : ../libracket3m.la
> cd ..; /usr2/other/tim-brown-racket-81dc927/src/SunOS-5.10-amd64/lt/libtool 
> --mode=link --tag=CC gcc -XCClinker -static-libgcc -rpath 
> /usr2/local/racket-master/SunOS-5.10-amd64/lib -o racket3m  gc2/main.lo 
> libracket3m.la -m64 -ldl -lm  -lsocket -lnsl -lintl
> gcc -static-libgcc -o .libs/racket3m gc2/.libs/main.o -m64 
> ./.libs/libracket3m.so -ldl -lm -lsocket -lnsl -lintl 
> -R/usr2/local/racket-master/SunOS-5.10-amd64/lib
> Undefined                       first referenced
>   symbol                             in file
> getrlimit64                         ./.libs/libracket3m.so
> lseek64                             ./.libs/libracket3m.so
> lstat64                             ./.libs/libracket3m.so
> _xmknod                             ./.libs/libracket3m.so
> mmap64                              ./.libs/libracket3m.so
> open64                              ./.libs/libracket3m.so
> stat64                              ./.libs/libracket3m.so
> readdir64                           ./.libs/libracket3m.so
> fseeko64                            ./.libs/libracket3m.so
> ftello64                            ./.libs/libracket3m.so
> fstat64                             ./.libs/libracket3m.so
> ld: fatal: Symbol referencing errors. No output written to .libs/racket3m
> collect2: ld returned 1 exit status
> *** Error code 1
> make: Fatal error: Command failed for target `../racket3m'
> Current working directory 
> /usr2/other/tim-brown-racket-81dc927/src/SunOS-5.10-amd64/racket/gc2
> *** Error code 1
> make: Fatal error: Command failed for target `all'
> ...
> 
> 
> -- 
> Tim Brown <tim.brown at cityc.co.uk>  | City Computing Limited            |
> T: +44 20 8770 2110                | City House, Sutton Park Road      |
> F: +44 20 8770 2130                | Sutton, Surrey, SM1 2AE, GB       |
> -----------------------------------------------------------------------|
> BEAUTY:  What's in your eye when you have a bee in your hand           |
> -----------------------------------------------------------------------'
> City Computing Limited registered in London No. 1767817.
> Registered Office: City House, Sutton Park Road, Sutton, Surrey, SM1 2AE
> VAT number 372 8290 34.
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Posted on the users mailing list.