From 36bf9f8bcb2a1a3aea1f90eb4d13aed3bbf6da8f Mon Sep 17 00:00:00 2001 From: Andres Noetzli Date: Fri, 27 Oct 2017 14:01:35 -0700 Subject: Modify LDFLAGS to support shared libraries for Win (#1280) * Use uintptr_t for pointer casts in Swig files CVC4's Swig interface files were casting pointers to longs in multiple instances. The problem with that is that on certain platforms *cough* Windows/MinGW *cough* long is only 32-bit even when compiling a 64-bit executable (they use the LLP64 data model). This made the compilation of language bindings fail with MinGW. This commit changes the types to uintptr_t defined in Swig's stdint.i. * Modify LDFLAGS to support shared libraries for Win This commit adds "-no-undefined" to the LDFLAGS of CVC4's library, which is required for building DLLs (shared libraries on Windows). It also adds "--export-all-symbols" to the linker flags of the parser to ensure that there are no unresolved symbols when linking against it (see comment in the Makefile.am for details). * Fix for non-Windows builds * add no-undefined to libcvc4compatjni --- src/parser/Makefile.am | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/parser/Makefile.am') diff --git a/src/parser/Makefile.am b/src/parser/Makefile.am index a316019fd..98b98ccaf 100644 --- a/src/parser/Makefile.am +++ b/src/parser/Makefile.am @@ -21,9 +21,20 @@ SUBDIRS = smt1 smt2 cvc tptp lib_LTLIBRARIES = libcvc4parser.la -libcvc4parser_la_LDFLAGS = $(ANTLR_LDFLAGS) \ +libcvc4parser_la_LDFLAGS = \ + $(ANTLR_LDFLAGS) \ + -no-undefined \ -version-info $(LIBCVC4PARSER_VERSION) +if CVC4_WINDOWS_BUILD +# -Wl,--export-all-symbols makes sure that all symbols are exported when +# building a DLL. This option is on by default but gets disabled for the parser +# library because the generated lexer/parser files define some functions as +# __declspec(dllexport), which leads to lots of unresolved symbols when linking +# against libcvc4parser. +libcvc4parser_la_LDFLAGS += -Wl,--export-all-symbols +endif + libcvc4parser_la_LIBADD = \ @builddir@/smt1/libparsersmt1.la \ @builddir@/smt2/libparsersmt2.la \ -- cgit v1.2.3