Building OS X with SYSTEM_ZLIB=true

Greg Lewis glewis at eyesbeyond.com
Sun Sep 13 18:59:40 PDT 2009


G'day Michael,

On Mon, Sep 07, 2009 at 06:00:20PM -0400, Michael Franz wrote:
> I am trying to build the bsd-port using the system zlib.  I get two build
> errors when I do this:
> Undefined symbols:
>   "_inflateEnd", referenced from:
>       _inflate_file in libjli.a(parse_manifest.o)
>   "_inflateInit2_", referenced from:
>       _inflate_file in libjli.a(parse_manifest.o)
>   "_inflate", referenced from:
>       _inflate_file in libjli.a(parse_manifest.o)
> ld: symbol(s) not found
> collect2: ld returned 1 exit status
> make[4]: ***
> [/Volumes/Data/Users/mfranz/developer/openjdk-bsd/repos/build-with-jdk7/build/bsd-i586/lib/i386/libinstrument.dylib]
> Error 1
> 
> and
> Undefined symbols:
>   "_deflateReset", referenced from:
>       _png_write_compressed_data_out in pngwutil.o
>       _png_write_finish_row in pngwutil.o
>       _png_write_finish_row in pngwutil.o
>   "_inflateEnd", referenced from:
>       _png_read_destroy in pngread.o
>   "_inflate", referenced from:
>       _png_process_IDAT_data in pngpread.o
>       _png_push_read_zTXt in pngpread.o
>       _png_read_row in pngread.o
>       _png_decompress_chunk in pngrutil.o
>       _png_read_finish_row in pngrutil.o
>   "_deflate", referenced from:
>       _png_write_flush in pngwrite.o
>       _png_text_compress in pngwutil.o
>       _png_text_compress in pngwutil.o
>       _png_text_compress in pngwutil.o
>       _png_write_finish_row in pngwutil.o
>       _png_write_finish_row in pngwutil.o
>       _png_write_filtered_row in pngwutil.o
>   "_crc32", referenced from:
>       _png_reset_crc in png.o
>       _png_calculate_crc in png.o
>   "_inflateInit_", referenced from:
>       _png_create_read_struct_2 in pngread.o
>       _png_read_init_3 in pngread.o
>   "_deflateInit2_", referenced from:
>       _png_write_IHDR in pngwutil.o
>   "_inflateReset", referenced from:
>       _png_reset_zstream in png.o
>       _png_push_read_zTXt in pngpread.o
>       _png_push_read_zTXt in pngpread.o
>       _png_decompress_chunk in pngrutil.o
>       _png_decompress_chunk in pngrutil.o
>       _png_read_finish_row in pngrutil.o
>   "_deflateEnd", referenced from:
>       _png_write_destroy in pngwrite.o
> ld: symbol(s) not found
> collect2: ld returned 1 exit status
> make[4]: ***
> [/Volumes/Data/Users/mfranz/developer/openjdk-bsd/repos/build-with-jdk7/build/bsd-i586/lib/i386/libsplashscreen.dylib]
> Error 1
> 
> These were fixed by applying this patch.  Without looking too deep into
> this, I feel that the patches should not be necessary as OS X has libz/zlib
> and the build works for FreeBSD and OpenBSD.

IIRC the MacOS X linker insists that all the references be resolved when
creating the shared library whereas the GNU linker in *BSD is ok with
dangling references and potentially letting them be resolved at runtime.

With that in mind, I'm going to commit your patch since SYSTEM_ZLIB should
work on MacOS X.

> --- jdk/make/java/instrument/Makefile.orig      2009-09-07
> 10:55:31.000000000 -0400
> +++ jdk/make/java/instrument/Makefile   2009-09-07 11:00:14.000000000 -0400
> @@ -117,6 +117,9 @@
>        OTHER_LDLIBS += -L$(PACKAGE_PATH)/lib -liconv
>      endif
>    endif
> +  ifeq ($(SYSTEM_ZLIB),true)
> +    LDFLAGS += -lz
> +  endif
>  else
>    LDFLAGS += -L $(LIBDIR)/$(LIBARCH)/jli
>    OTHER_LDLIBS += -ljli
> --- jdk/make/sun/splashscreen/Makefile.orig     2009-09-07
> 11:01:44.000000000 -0400
> +++ jdk/make/sun/splashscreen/Makefile  2009-09-07 11:01:14.000000000 -0400
> @@ -65,6 +65,8 @@
>  CPPFLAGS += -I$(SHARE_SRC)/native/$(PKGDIR)/image/jpeg
>  ifneq ($(SYSTEM_ZLIB),true)
>    CPPFLAGS += -I$(SHARE_SRC)/native/java/util/zip/zlib-1.1.3
> +else
> +  OTHER_LDLIBS += -lz
>  endif
> 
> Michael

> 


-- 
Greg Lewis                          Email   : glewis at eyesbeyond.com
Eyes Beyond                         Web     : http://www.eyesbeyond.com
Information Technology              FreeBSD : glewis at FreeBSD.org



More information about the bsd-port-dev mailing list