From 71dc2c1a088d3d63e6386eb58c6953f21100393e Mon Sep 17 00:00:00 2001 From: Siesh1oo Date: Mon, 10 Mar 2014 14:03:41 +0100 Subject: [PATCH 1/3] - minisat/utils/System.cc: fix declaration-definition mismatch of Minisat::memUsedPeak() for OSX, BSD and other non-Linux platforms --- minisat/utils/System.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/minisat/utils/System.cc b/minisat/utils/System.cc index 21aa4ff4..b353bece 100644 --- a/minisat/utils/System.cc +++ b/minisat/utils/System.cc @@ -77,7 +77,7 @@ double Minisat::memUsed() { struct rusage ru; getrusage(RUSAGE_SELF, &ru); return (double)ru.ru_maxrss / 1024; } -double Minisat::memUsedPeak() { return memUsed(); } +double Minisat::memUsedPeak(bool strictlyPeak) { (void) strictlyPeak; return memUsed(); } #elif defined(__APPLE__) @@ -87,11 +87,11 @@ double Minisat::memUsed() { malloc_statistics_t t; malloc_zone_statistics(NULL, &t); return (double)t.max_size_in_use / (1024*1024); } -double Minisat::memUsedPeak() { return memUsed(); } +double Minisat::memUsedPeak(bool strictlyPeak) { (void) strictlyPeak; return memUsed(); } #else double Minisat::memUsed() { return 0; } -double Minisat::memUsedPeak() { return 0; } +double Minisat::memUsedPeak(bool strictlyPeak) { (void) strictlyPeak; return 0; } #endif From ca4318a7d67b4225f7d2ae3fa2f07602cbd019e0 Mon Sep 17 00:00:00 2001 From: Siesh1oo Date: Mon, 10 Mar 2014 14:04:08 +0100 Subject: [PATCH 2/3] - Makefile: fix build of static and shared libraries and binaries for OSX systems. --- Makefile | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index ceb9d77d..7782c85f 100644 --- a/Makefile +++ b/Makefile @@ -62,6 +62,14 @@ SORELEASE?=.0# Declare empty to leave out from library file name. MINISAT_CXXFLAGS = -I. -D __STDC_LIMIT_MACROS -D __STDC_FORMAT_MACROS -Wall -Wno-parentheses -Wextra MINISAT_LDFLAGS = -Wall -lz +ifeq (Darwin,$(findstring Darwin,$(shell uname))) + SHARED_LDFLAGS += -shared -Wl,-dylib_install_name,$(MINISAT_DLIB).$(SOMAJOR) + RELEASE_LDFLAGS += +else + SHARED_LDFLAGS += -shared -Wl,-soname,$(MINISAT_DLIB).$(SOMAJOR) + RELEASE_LDFLAGS += -static +endif + ECHO=@echo ifeq ($(VERB),) VERB=@ @@ -96,9 +104,9 @@ $(BUILD_DIR)/dynamic/%.o: MINISAT_CXXFLAGS +=$(MINISAT_REL) $(MINISAT_FPIC) ## Build-type Link-flags: $(BUILD_DIR)/profile/bin/$(MINISAT): MINISAT_LDFLAGS += -pg -$(BUILD_DIR)/release/bin/$(MINISAT): MINISAT_LDFLAGS += --static $(MINISAT_RELSYM) +$(BUILD_DIR)/release/bin/$(MINISAT): MINISAT_LDFLAGS += $(RELEASE_LDFLAGS) $(MINISAT_RELSYM) $(BUILD_DIR)/profile/bin/$(MINISAT_CORE): MINISAT_LDFLAGS += -pg -$(BUILD_DIR)/release/bin/$(MINISAT_CORE): MINISAT_LDFLAGS += --static $(MINISAT_RELSYM) +$(BUILD_DIR)/release/bin/$(MINISAT_CORE): MINISAT_LDFLAGS += $(RELEASE_LDFLAGS) $(MINISAT_RELSYM) ## Executable dependencies $(BUILD_DIR)/release/bin/$(MINISAT): $(BUILD_DIR)/release/minisat/simp/Main.o $(BUILD_DIR)/release/lib/$(MINISAT_SLIB) @@ -162,7 +170,7 @@ $(BUILD_DIR)/dynamic/lib/$(MINISAT_DLIB).$(SOMAJOR).$(SOMINOR)$(SORELEASE)\ $(BUILD_DIR)/dynamic/lib/$(MINISAT_DLIB): $(ECHO) Linking Shared Library: $@ $(VERB) mkdir -p $(dir $@) - $(VERB) $(CXX) $(MINISAT_LDFLAGS) $(LDFLAGS) -o $@ -shared -Wl,-soname,$(MINISAT_DLIB).$(SOMAJOR) $^ + $(VERB) $(CXX) $^ $(SHARED_LDFLAGS) $(MINISAT_LDFLAGS) $(LDFLAGS) -o $@ $(VERB) ln -sf $(MINISAT_DLIB).$(SOMAJOR).$(SOMINOR)$(SORELEASE) $(BUILD_DIR)/dynamic/lib/$(MINISAT_DLIB).$(SOMAJOR) $(VERB) ln -sf $(MINISAT_DLIB).$(SOMAJOR) $(BUILD_DIR)/dynamic/lib/$(MINISAT_DLIB) From ac52f10615bfb150d8399c62bb3622bafd0e7e49 Mon Sep 17 00:00:00 2001 From: Siesh1oo Date: Mon, 10 Mar 2014 14:05:03 +0100 Subject: [PATCH 3/3] - minisat/utils/Options.h: separate format string and PRIi64 token (which evaluates to a string), in order to avoid definition of user-defined trigraphs. --- minisat/utils/Options.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/minisat/utils/Options.h b/minisat/utils/Options.h index 4e71a18c..7d2e83a8 100644 --- a/minisat/utils/Options.h +++ b/minisat/utils/Options.h @@ -282,15 +282,15 @@ class Int64Option : public Option if (range.begin == INT64_MIN) fprintf(stderr, "imin"); else - fprintf(stderr, "%4"PRIi64, range.begin); + fprintf(stderr, "%4" PRIi64, range.begin); fprintf(stderr, " .. "); if (range.end == INT64_MAX) fprintf(stderr, "imax"); else - fprintf(stderr, "%4"PRIi64, range.end); + fprintf(stderr, "%4" PRIi64, range.end); - fprintf(stderr, "] (default: %"PRIi64")\n", value); + fprintf(stderr, "] (default: %" PRIi64 ")\n", value); if (verbose){ fprintf(stderr, "\n %s\n", description); fprintf(stderr, "\n");