madler / zlib

A massively spiffy yet delicately unobtrusive compression library.
http://zlib.net/
Other
5.46k stars 2.41k forks source link

compiling zlib-1.2.11 for SunOS 5.11-SPARC 64 bit. #948

Closed hicham65 closed 4 months ago

hicham65 commented 4 months ago

I want to generate 64bit library.

It seems the command below builds for 32 bit.

CC="cc -D_REENTRANT -D_TS_ERRNO -D_XPG_4_2" CFLAGS="-Xa -xO4"\
    ./configure --shared --prefix=$zlib_install_dir 

The usage below shows I can pass the [--64], is this the way to do it?

configure -help usage: configure [--const] [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX] [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR] [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]

Lwisce commented 4 months ago

One way may be make sense: You can make a test with configure --64 and modify the makefile with adding -E to compiler flag and then run make test. After doing that, read the gzlib.o file and search fopen to see if there is *fopen or *fopen64. If you find it is *fopen64 that means you have compiled 64bit library.

hicham65 commented 4 months ago

thanks.

I tried this

    CC="cc -O4" \
        ./configure --64 --shared --prefix=$zlib_install_dir > configure.out

I added as you suggested the -E to the compiler flag.

CFLAGS=-fast -m64 -E -D_LARGEFILE64_SOURCE=1 the make failed

cc -O4 -fast -m64 -E -D_LARGEFILE64_SOURCE=1 -I. -c -o example.o test/example.c
cc: Warning: "-c" redefines goal from "preprocessed source (stdout)" to "object file"
cc -O4 -fast -m64 -E -D_LARGEFILE64_SOURCE=1  -c -o adler32.o adler32.c
cc: Warning: "-c" redefines goal from "preprocessed source (stdout)" to "object file"
cc -O4 -fast -m64 -E -D_LARGEFILE64_SOURCE=1  -c -o crc32.o crc32.c
cc: Warning: "-c" redefines goal from "preprocessed source (stdout)" to "object file"
cc -O4 -fast -m64 -E -D_LARGEFILE64_SOURCE=1  -c -o deflate.o deflate.c
cc: Warning: "-c" redefines goal from "preprocessed source (stdout)" to "object file"
cc -O4 -fast -m64 -E -D_LARGEFILE64_SOURCE=1  -c -o infback.o infback.c
cc: Warning: "-c" redefines goal from "preprocessed source (stdout)" to "object file"
cc -O4 -fast -m64 -E -D_LARGEFILE64_SOURCE=1  -c -o inffast.o inffast.c
cc: Warning: "-c" redefines goal from "preprocessed source (stdout)" to "object file"
cc -O4 -fast -m64 -E -D_LARGEFILE64_SOURCE=1  -c -o inflate.o inflate.c
cc: Warning: "-c" redefines goal from "preprocessed source (stdout)" to "object file"
cc -O4 -fast -m64 -E -D_LARGEFILE64_SOURCE=1  -c -o inftrees.o inftrees.c
cc: Warning: "-c" redefines goal from "preprocessed source (stdout)" to "object file"
cc -O4 -fast -m64 -E -D_LARGEFILE64_SOURCE=1  -c -o trees.o trees.c
cc: Warning: "-c" redefines goal from "preprocessed source (stdout)" to "object file"
cc -O4 -fast -m64 -E -D_LARGEFILE64_SOURCE=1  -c -o zutil.o zutil.c
cc: Warning: "-c" redefines goal from "preprocessed source (stdout)" to "object file"
cc -O4 -fast -m64 -E -D_LARGEFILE64_SOURCE=1  -c -o compress.o compress.c
cc: Warning: "-c" redefines goal from "preprocessed source (stdout)" to "object file"
cc -O4 -fast -m64 -E -D_LARGEFILE64_SOURCE=1  -c -o uncompr.o uncompr.c
cc: Warning: "-c" redefines goal from "preprocessed source (stdout)" to "object file"
cc -O4 -fast -m64 -E -D_LARGEFILE64_SOURCE=1  -c -o gzclose.o gzclose.c
cc: Warning: "-c" redefines goal from "preprocessed source (stdout)" to "object file"
cc -O4 -fast -m64 -E -D_LARGEFILE64_SOURCE=1  -c -o gzlib.o gzlib.c
cc: Warning: "-c" redefines goal from "preprocessed source (stdout)" to "object file"
cc -O4 -fast -m64 -E -D_LARGEFILE64_SOURCE=1  -c -o gzread.o gzread.c
cc: Warning: "-c" redefines goal from "preprocessed source (stdout)" to "object file"
cc -O4 -fast -m64 -E -D_LARGEFILE64_SOURCE=1  -c -o gzwrite.o gzwrite.c
cc: Warning: "-c" redefines goal from "preprocessed source (stdout)" to "object file"
ar rc libz.a adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o
cc -O4 -fast -m64 -E -D_LARGEFILE64_SOURCE=1 -o example example.o -L. libz.a
cc: internal error:  process_source_file() @ run.c:1704
*** Error code 1
make: Fatal error: Command failed for target `example'
hicham65 commented 4 months ago

Ok, I tried the below command:

./configure --64 --shared

The make/test/install, all went successful. The shared libraries are all 64-bit.

:/u/local/lib64/zlib-1.2.11/lib$ ls -lt libz*.so*
lrwxrwxrwx   1 hhadjali dba           14 Mar 12 06:41 libz.so -> libz.so.1.2.11
lrwxrwxrwx   1 hhadjali dba           14 Mar 12 06:41 libz.so.1 -> libz.so.1.2.11
-r-xr-xr-x   1 hhadjali dba       161784 Mar 12 06:41 libz.so.1.2.11
:/u/local/lib64/zlib-1.2.11/lib$

:/u/local/lib64/zlib-1.2.11/lib$ file libz.so*
libz.so:        ELF 64-bit MSB dynamic lib SPARCV9 Version 1, UltraSPARC3 Extensions Required [CBCOND VIS3], dynamically linked, not stripped
libz.so.1:      ELF 64-bit MSB dynamic lib SPARCV9 Version 1, UltraSPARC3 Extensions Required [CBCOND VIS3], dynamically linked, not stripped
libz.so.1.2.11: ELF 64-bit MSB dynamic lib SPARCV9 Version 1, UltraSPARC3 Extensions Required [CBCOND VIS3], dynamically linked, not stripped
:/u/local/lib64/zlib-1.2.11/lib$