Error compiling on macos

Linus Torvalds torvalds at linux-foundation.org
Wed Jun 28 12:33:37 PDT 2017


On Wed, Jun 28, 2017 at 9:42 AM, Benjamin <nystire at gmail.com> wrote:
> Good afternoon
> I'm running macos 10.12.5.
> I just synced to the latest sources, and when running the build script, I
> get the following message:
>
> Making install in src
>
>   CCLD     libdivecomputer.la
>
> Undefined symbols for architecture x86_64:
>
>   "_crc32", referenced from:

Interesting. The new Suunto protocol over bluetooth needs crc32() for
stream integrity control, and I was expecting to get it from zlib -
which we require to be there anyway due to other dependencies (eg
libgit uses zlib too).

An you must have zlib installed *somehow*, since the

    #include <zlib.h>

in suunto_eonsteel.c worked.

I wonder what the difference here between macos and Linux is - maybe
it's a clang linker difference, or maybe I got crc32() some other
way..

Anyway, it definitely is my bug - I think I just added the "-lz" to
the wrong place (I hate autotools, and I'm bad at it).

I think the attached trivial patch to move the -lz to the right place
will fix it. Can you please test?

                 Linus
-------------- next part --------------
 examples/Makefile.am | 2 +-
 src/Makefile.am      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/examples/Makefile.am b/examples/Makefile.am
index 4bd290d..e830769 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -1,5 +1,5 @@
 AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include
-LDADD = $(top_builddir)/src/libdivecomputer.la -lz
+LDADD = $(top_builddir)/src/libdivecomputer.la
 
 bin_PROGRAMS = \
 	dctool
diff --git a/src/Makefile.am b/src/Makefile.am
index 92de94b..0d60abb 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,7 +3,7 @@ AM_CFLAGS = $(LIBUSB_CFLAGS) $(HIDAPI_CFLAGS)
 
 lib_LTLIBRARIES = libdivecomputer.la
 
-libdivecomputer_la_LIBADD = $(LIBUSB_LIBS) $(HIDAPI_LIBS) -lm
+libdivecomputer_la_LIBADD = $(LIBUSB_LIBS) $(HIDAPI_LIBS) -lm -lz
 libdivecomputer_la_LDFLAGS = \
 	-version-info $(DC_VERSION_LIBTOOL) \
 	-no-undefined \


More information about the subsurface mailing list