Changeset: 67002c4ce414 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=67002c4ce414 Modified Files: buildtools/ChangeLog.Mar2018 buildtools/autogen/autogen/am.py buildtools/autogen/autogen/msc.py clients/examples/C/Makefile.ag clients/mapiclient/Makefile.ag clients/mapilib/Makefile.ag common/stream/Makefile.ag common/stream/monetdb-stream.pc.in configure.ag gdk/Makefile.ag gdk/monetdb-gdk.pc.in geom/monetdb5/Makefile.ag monetdb5/extras/rapi/Makefile.ag monetdb5/tools/Makefile.ag monetdb5/tools/monetdb5.pc.in sql/backends/monet5/LSST/Makefile.ag sql/backends/monet5/Makefile.ag sql/backends/monet5/UDF/capi/Makefile.ag sql/backends/monet5/UDF/pyapi/Makefile.ag sql/backends/monet5/UDF/pyapi3/Makefile.ag sql/backends/monet5/UDF/udf/Makefile.ag sql/backends/monet5/generator/Makefile.ag sql/backends/monet5/vaults/Makefile.ag sql/backends/monet5/vaults/bam/Makefile.ag sql/backends/monet5/vaults/fits/Makefile.ag sql/backends/monet5/vaults/lidar/Makefile.ag sql/backends/monet5/vaults/netcdf/Makefile.ag sql/backends/monet5/vaults/shp/Makefile.ag sql/include/sql_mem.h tools/merovingian/client/Makefile.ag tools/merovingian/daemon/Makefile.ag tools/mserver/Makefile.ag Branch: Mar2018 Log Message:
Don't link to libraries multiple times on Linux/Unix. When creating a .so file, don't link to all libraries that are needed on Linux/Unix but instead link to them when creating the binary executable. On Windows, we do need to link to all libraries when creating a .dll since on Windows this works completely differently. diffs (truncated from 828 to 300 lines): diff --git a/buildtools/ChangeLog.Mar2018 b/buildtools/ChangeLog.Mar2018 --- a/buildtools/ChangeLog.Mar2018 +++ b/buildtools/ChangeLog.Mar2018 @@ -1,3 +1,11 @@ # ChangeLog file for buildtools # This file is updated with Maddlog +* Tue Apr 3 2018 Sjoerd Mullender <sjo...@acm.org> +- On Linux and Unix, try not to link to libraries multiple times: that + only causes the code (and worse, the variables in those libraries) to be + included multiple times. On Windows, we do need to link to libraries + multiple times (once for each DLL we create if the DLL references + anything from the library) but that doesn't cause the linked library + to be loaded multiple times. + diff --git a/buildtools/autogen/autogen/am.py b/buildtools/autogen/autogen/am.py --- a/buildtools/autogen/autogen/am.py +++ b/buildtools/autogen/autogen/am.py @@ -208,12 +208,19 @@ def am_additional_libs(name, sep, type, if l[0] not in ("-", "$", "@"): l = am_translate_dir(l, am) + ".la" if c: - if c in ('NATIVE_WIN32', 'WIN32'): + c = c.split('&') + if 'NATIVE_WIN32' in c: continue global libno v = 'LIB%d' % libno libno = libno + 1 - add = 'if %s\n%s = %s\nelse\n%s =\nendif\n%s' % (c, v, l, v, add) + s = '' + for x in c: + s += 'if %s\n' % x + s += '%s = %s\n' % (v, l) + for x in c: + s += 'else\n%s =\nendif\n' % v + add = s + add l = '$(%s)' % v add = add + " " + l return add + "\n" diff --git a/buildtools/autogen/autogen/msc.py b/buildtools/autogen/autogen/msc.py --- a/buildtools/autogen/autogen/msc.py +++ b/buildtools/autogen/autogen/msc.py @@ -209,8 +209,15 @@ def msc_additional_libs(fd, name, sep, t for l in list: if '?' in l: c, l = l.split('?', 1) - if c in ('NATIVE_WIN32', 'WIN32'): - c = None + c = c.split('&') + try: + c.remove('NATIVE_WIN32') + except ValueError: + pass + try: + c.remove('WIN32') + except ValueError: + pass else: c = None d = None @@ -243,7 +250,7 @@ def msc_additional_libs(fd, name, sep, t global libno v = 'LIB%d' % libno libno = libno + 1 - cond += '!IF defined(%s)\n%s = %s\n!ELSE\n%s =\n!ENDIF\n' % (c, v, l, v) + cond += '!IF defined(%s)\n%s = %s\n!ELSE\n%s =\n!ENDIF\n' % (') && defined('.join(c), v, l, v) l = '$(%s)' % v if d: deps = '%s %s' % (deps, l) diff --git a/clients/examples/C/Makefile.ag b/clients/examples/C/Makefile.ag --- a/clients/examples/C/Makefile.ag +++ b/clients/examples/C/Makefile.ag @@ -5,15 +5,14 @@ # Copyright 1997 - July 2008 CWI, August 2008 - 2018 MonetDB B.V. MTSAFE -INCLUDES = ../../mapilib ../../../common/options $(READLINE_INCS) - -MAPI_LIBS = $(SOCKET_LIBS) +INCLUDES = ../../mapilib BINS = { CONDINST = HAVE_TESTING DIR = bindir SOURCES = sample0.c sample1.c sample4.c \ smack00.c smack01.c - LIBS = $(MAPI_LIBS) ../../mapilib/libmapi \ - $(curl_LIBS) + LIBS = ../../mapilib/libmapi \ + ../../../common/stream/libstream \ + $(SOCKET_LIBS) $(zlib_LIBS) $(BZ_LIBS) $(snappy_LIBS) $(lz4_LIBS) $(liblzma_LIBS) $(curl_LIBS) $(LTLIBICONV) $(openssl_LIBS) } diff --git a/clients/mapiclient/Makefile.ag b/clients/mapiclient/Makefile.ag --- a/clients/mapiclient/Makefile.ag +++ b/clients/mapiclient/Makefile.ag @@ -14,43 +14,44 @@ lib_mcutil = { bin_mclient = { SOURCES = mclient.c ReadlineTools.c ReadlineTools.h mhelp.c mhelp.h - LIBS = libmcutil ../mapilib/libmapi \ - ../../common/stream/libstream \ + LIBS = libmcutil \ ../../common/utils/libmutils \ + ../mapilib/libmapi \ + ../../common/stream/libstream \ $(READLINE_LIBS) \ - $(curl_LIBS) $(LTLIBICONV) $(PTHREAD_LIBS) $(MATH_LIBS) $(SOCKET_LIBS) + $(SOCKET_LIBS) $(zlib_LIBS) $(BZ_LIBS) $(snappy_LIBS) $(lz4_LIBS) $(liblzma_LIBS) $(curl_LIBS) $(LTLIBICONV) $(openssl_LIBS) } bin_msqldump = { SOURCES = msqldump.c msqldump.h - LIBS = libmcutil ../mapilib/libmapi \ + LIBS = libmcutil ../../common/utils/libmutils \ + ../mapilib/libmapi \ ../../common/stream/libstream \ - ../../common/utils/libmutils \ - $(curl_LIBS) + $(SOCKET_LIBS) $(zlib_LIBS) $(BZ_LIBS) $(snappy_LIBS) $(lz4_LIBS) $(liblzma_LIBS) $(curl_LIBS) $(LTLIBICONV) $(openssl_LIBS) } bin_stethoscope = { SOURCES = stethoscope.c - LIBS = libmcutil ../mapilib/libmapi \ + LIBS = libmcutil ../../common/utils/libmutils \ + ../mapilib/libmapi \ ../../common/stream/libstream \ - ../../common/utils/libmutils \ - $(curl_LIBS) $(MALLOC_LIBS) $(PTHREAD_LIBS) $(SOCKET_LIBS) + $(SOCKET_LIBS) $(zlib_LIBS) $(BZ_LIBS) $(snappy_LIBS) $(lz4_LIBS) $(liblzma_LIBS) $(curl_LIBS) $(LTLIBICONV) $(openssl_LIBS) $(PTHREAD_LIBS) } bin_tachograph = { SOURCES = tachograph.c - LIBS = libmcutil ../mapilib/libmapi \ + LIBS = libmcutil ../../common/utils/libmutils \ + ../mapilib/libmapi \ ../../common/stream/libstream \ - ../../common/utils/libmutils \ - $(curl_LIBS) $(MALLOC_LIBS) $(PTHREAD_LIBS) $(SOCKET_LIBS) + $(SOCKET_LIBS) $(zlib_LIBS) $(BZ_LIBS) $(snappy_LIBS) $(lz4_LIBS) $(liblzma_LIBS) $(curl_LIBS) $(LTLIBICONV) $(openssl_LIBS) $(PTHREAD_LIBS) } bin_tomograph = { SOURCES = tomograph.c - LIBS = libmcutil ../mapilib/libmapi \ + LIBS = libmcutil ../../common/utils/libmutils \ + ../mapilib/libmapi \ ../../common/stream/libstream \ - ../../common/utils/libmutils \ - $(curl_LIBS) $(MALLOC_LIBS) $(PTHREAD_LIBS) $(SOCKET_LIBS) + $(SOCKET_LIBS) $(zlib_LIBS) $(BZ_LIBS) $(snappy_LIBS) $(lz4_LIBS) $(liblzma_LIBS) $(curl_LIBS) $(LTLIBICONV) $(openssl_LIBS) $(PTHREAD_LIBS) } # disabled: it's not really a tool for users, more to debug mapi diff --git a/clients/mapilib/Makefile.ag b/clients/mapilib/Makefile.ag --- a/clients/mapilib/Makefile.ag +++ b/clients/mapilib/Makefile.ag @@ -7,14 +7,16 @@ MTSAFE INCLUDES = ../../common/options ../../common/stream ../../common/utils \ - $(MSGCONTROL_FLAGS) $(openssl_CFLAGS) + $(MSGCONTROL_FLAGS) lib_mapi = { VERSION = $(MAPI_VERSION) SOURCES = mapi.c mapi.rc - LIBS = $(SOCKET_LIBS) ../../common/stream/libstream \ - ../../common/options/libmoptions \ - ../../common/utils/libmcrypt $(openssl_LIBS) + LIBS = ../../common/options/libmoptions \ + ../../common/utils/libmcrypt \ + WIN32?../../common/stream/libstream \ + WIN32?$(SOCKET_LIBS) \ + WIN32?$(openssl_LIBS) } headers_mapi = { diff --git a/common/stream/Makefile.ag b/common/stream/Makefile.ag --- a/common/stream/Makefile.ag +++ b/common/stream/Makefile.ag @@ -13,21 +13,19 @@ INCLUDES = $(zlib_CFLAGS) \ $(snappy_CFLAGS) \ $(lz4_CFLAGS) \ $(liblzma_CFLAGS) \ - $(openssl_CFLAGS) \ $(curl_CFLAGS) lib_stream = { SOURCES = stream.c stream.h stream_socket.h VERSION = $(STREAM_VERSION) - LIBS = $(SOCKET_LIBS) \ - $(zlib_LIBS) \ - $(BZ_LIBS) \ - $(snappy_LIBS) \ - $(lz4_LIBS) \ - $(liblzma_LIBS) \ - $(openssl_LIBS) \ - $(curl_LIBS) \ - $(LTLIBICONV) + LIBS = WIN32?$(SOCKET_LIBS) \ + WIN32?$(zlib_LIBS) \ + WIN32?$(BZ_LIBS) \ + WIN32?$(snappy_LIBS) \ + WIN32?$(lz4_LIBS) \ + WIN32?$(liblzma_LIBS) \ + WIN32?$(curl_LIBS) \ + WIN32?$(LTLIBICONV) } headers_common = { diff --git a/common/stream/monetdb-stream.pc.in b/common/stream/monetdb-stream.pc.in --- a/common/stream/monetdb-stream.pc.in +++ b/common/stream/monetdb-stream.pc.in @@ -12,7 +12,7 @@ includedir=@includedir@ Name: monetdb-stream Description: MonetDB streams libary Version: @PACKAGE_VERSION@ -Requires: @PKG_CURL@ @PKG_ZLIB@ +Requires: @PKG_CURL@ @PKG_ZLIB@ @PKG_LIBLZMA@ -Libs: -L${libdir} -lstream @SOCKET_LIBS@ +Libs: -L${libdir} -lstream @SOCKET_LIBS@ @BZ_LIBS@ @snappy_LIBS@ @lz4_LIBS@ @LIBICONV@ Cflags: -I${includedir}/monetdb diff --git a/configure.ag b/configure.ag --- a/configure.ag +++ b/configure.ag @@ -66,6 +66,7 @@ AC_DEFINE([MONETDB_RELEASE], ["unrelease AS_VAR_IF([target_os], [cygwin], [AC_DEFINE([WIN32], 1, [Define on Microsoft Windows (also under Cygwin)])]) AM_CONDITIONAL([NOT_WIN32], [test x"$target_os" != xcygwin]) +AM_CONDITIONAL([WIN32], [test x"$target_os" = xcygwin]) AM_CONDITIONAL([NATIVE_WIN32], [false]) m4_ifndef([PKG_PROG_PKG_CONFIG], diff --git a/gdk/Makefile.ag b/gdk/Makefile.ag --- a/gdk/Makefile.ag +++ b/gdk/Makefile.ag @@ -36,10 +36,15 @@ lib_gdk = { gdk_firstn.c \ libbat.rc LIBS = ../common/options/libmoptions \ - ../common/stream/libstream \ ../common/utils/libmutils \ - $(MATH_LIBS) $(SOCKET_LIBS) $(zlib_LIBS) $(BZ_LIBS) \ - $(MALLOC_LIBS) $(PTHREAD_LIBS) $(DL_LIBS) $(PSAPILIB) $(KVM_LIBS) + WIN32?../common/stream/libstream \ + WIN32?$(MATH_LIBS) \ + WIN32?$(SOCKET_LIBS) \ + WIN32?$(MALLOC_LIBS) \ + WIN32?$(PTHREAD_LIBS) \ + WIN32?$(DL_LIBS) \ + WIN32?$(PSAPILIB) \ + WIN32?$(KVM_LIBS) } headers_h = { diff --git a/gdk/monetdb-gdk.pc.in b/gdk/monetdb-gdk.pc.in --- a/gdk/monetdb-gdk.pc.in +++ b/gdk/monetdb-gdk.pc.in @@ -12,6 +12,7 @@ includedir=@includedir@ Name: monetdb-gdk Description: MonetDB GDK libary Version: @PACKAGE_VERSION@ +Requires: monetdb-stream -Libs: -L${libdir} -lbat +Libs: -L${libdir} -lbat @MATH_LIBS@ @MALLOC_LIBS@ @PTHREAD_LIBS@ @DL_LIBS@ @KVM_LIBS@ Cflags: -I${includedir}/monetdb diff --git a/geom/monetdb5/Makefile.ag b/geom/monetdb5/Makefile.ag --- a/geom/monetdb5/Makefile.ag +++ b/geom/monetdb5/Makefile.ag @@ -17,9 +17,9 @@ lib__geom = { DIR = libdir/monetdb5 SOURCES = geom.h geom.c geomBulk.c geom_upgrade.c LIBS = ../lib/libgeom \ - NATIVE_WIN32?../../gdk/libbat \ - NATIVE_WIN32?../../common/stream/libstream \ - NATIVE_WIN32?../../monetdb5/tools/libmonetdb5 \ + WIN32?../../gdk/libbat \ + WIN32?../../common/stream/libstream \ + WIN32?../../monetdb5/tools/libmonetdb5 \ $(GEOS_LIBS) $(PROJ_LIBS) } diff --git a/monetdb5/extras/rapi/Makefile.ag b/monetdb5/extras/rapi/Makefile.ag --- a/monetdb5/extras/rapi/Makefile.ag +++ b/monetdb5/extras/rapi/Makefile.ag @@ -29,9 +29,9 @@ lib__rapi = { DIR = libdir/monetdb5 SOURCES = rapi.c rapi.h converters.c.h XDEPS = $(libr_LIBDEP) - LIBS = NATIVE_WIN32?../../tools/libmonetdb5 \ - NATIVE_WIN32?../../../gdk/libbat \ - $(MALLOC_LIBS) $(libr_LIBS) + LIBS = WIN32?../../tools/libmonetdb5 \ + WIN32?../../../gdk/libbat \ + $(libr_LIBS) _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list