>From 477ae199f088468d1c00cfdd1de35a0a74e5632f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 7 Dec 2014 02:59:49 +0100 Subject: [PATCH] Fix linking boost 1.33.1 without --allow-multiple-definition. Don't use this linker option any longer now that it is unnecessary. --- boost_1_33_1.patch | 64 ++++++++++++++++++++++++++++++++++++++++++++++ install_miscellanea.make | 1 + objects.make | 2 - workhorse.make | 5 +--- 4 files changed, 66 insertions(+), 6 deletions(-) create mode 100644 boost_1_33_1.patch diff --git a/boost_1_33_1.patch b/boost_1_33_1.patch new file mode 100644 index 0000000..68c8b5a --- /dev/null +++ b/boost_1_33_1.patch @@ -0,0 +1,64 @@ +diff --recursive '--unified=3' original/boost_1_33_1/libs/regex/src/cregex.cpp modified/boost_1_33_1/libs/regex/src/cregex.cpp +--- original/boost_1_33_1/libs/regex/src/cregex.cpp 2005-03-30 13:38:32.000000000 +0200 ++++ modified/boost_1_33_1/libs/regex/src/cregex.cpp 2014-12-06 23:53:30.273125000 +0100 +@@ -362,7 +362,7 @@ + #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) + (::sprintf_s)(buf, sizeof(buf), "%s%s%s", dstart.path(), directory_iterator::separator(), ptr); + #else +- (std::sprintf)(buf, "%s%s%s", dstart.path(), directory_iterator::separator(), ptr); ++ sprintf(buf, "%s%s%s", dstart.path(), directory_iterator::separator(), ptr); + #endif + BuildFileList(pl, buf, recurse); + ++dstart; +diff --recursive '--unified=3' original/boost_1_33_1/libs/regex/src/fileiter.cpp modified/boost_1_33_1/libs/regex/src/fileiter.cpp +--- original/boost_1_33_1/libs/regex/src/fileiter.cpp 2005-03-30 13:38:32.000000000 +0200 ++++ modified/boost_1_33_1/libs/regex/src/fileiter.cpp 2014-12-06 23:53:19.195000000 +0100 +@@ -30,7 +30,6 @@ + #include + #if defined(BOOST_NO_STDC_NAMESPACE) + namespace std{ +- using ::sprintf; + using ::fseek; + using ::fread; + using ::ftell; +@@ -788,9 +787,9 @@ + { + char buf[MAX_PATH]; + if( ( (root[0] == *_fi_sep) || (root[0] == *_fi_sep_alt) ) && (root[1] == '\0') ) +- (std::sprintf)(buf, "%s%s", root, name); ++ sprintf(buf, "%s%s", root, name); + else +- (std::sprintf)(buf, "%s%s%s", root, _fi_sep, name); ++ sprintf(buf, "%s%s%s", root, _fi_sep, name); + DIR* d = opendir(buf); + if(d) + { +diff --recursive '--unified=3' original/boost_1_33_1/libs/regex/src/posix_api.cpp modified/boost_1_33_1/libs/regex/src/posix_api.cpp +--- original/boost_1_33_1/libs/regex/src/posix_api.cpp 2005-03-30 13:38:32.000000000 +0200 ++++ modified/boost_1_33_1/libs/regex/src/posix_api.cpp 2014-12-07 02:44:11.652125000 +0100 +@@ -24,7 +24,6 @@ + + #if defined(BOOST_NO_STDC_NAMESPACE) + namespace std{ +- using ::sprintf; + using ::strcpy; + using ::strcmp; + } +@@ -148,7 +147,7 @@ + #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) + (::sprintf_s)(localbuf, 5, "%d", i); + #else +- (std::sprintf)(localbuf, "%d", i); ++ sprintf(localbuf, "%d", i); + #endif + if(std::strlen(localbuf) < buf_size) + re_detail::strcpy_s(buf, buf_size, localbuf); +@@ -158,7 +157,7 @@ + #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) + (::sprintf_s)(localbuf, 5, "%d", 0); + #else +- (std::sprintf)(localbuf, "%d", 0); ++ sprintf(localbuf, "%d", 0); + #endif + if(std::strlen(localbuf) < buf_size) + re_detail::strcpy_s(buf, buf_size, localbuf); diff --git a/install_miscellanea.make b/install_miscellanea.make index 12d6a4f..6090c06 100644 --- a/install_miscellanea.make +++ b/install_miscellanea.make @@ -155,6 +155,7 @@ all: boost cgicc fop jing md5sum_msw sample trang xmlwrapp .PHONY: boost boost: $(file_list) + -[ -e $(stem).patch ] && $(PATCH) --directory=scratch --strip=1 < $(stem).patch @$(MKDIR) $(third_party_include_dir)/boost/ $(CP) --force --preserve --recursive scratch/$(stem)/boost/* $(third_party_include_dir)/boost/ @$(MKDIR) $(third_party_source_dir)/boost/ diff --git a/objects.make b/objects.make index 84dbaba..8349f84 100644 --- a/objects.make +++ b/objects.make @@ -831,7 +831,6 @@ progress_meter_test$(EXEEXT): \ progress_meter_test.o \ timer.o \ -regex_test$(EXEEXT): EXTRA_LDFLAGS = -Wl,--allow-multiple-definition regex_test$(EXEEXT): \ $(boost_regex_objects) \ $(common_test_objects) \ @@ -952,7 +951,6 @@ ihs_crc_comp$(EXEEXT): \ test_coding_rules_test := $(src_dir)/test_coding_rules_test.sh test_coding_rules$(EXEEXT): POST_LINK_COMMAND = $(test_coding_rules_test) -test_coding_rules$(EXEEXT): EXTRA_LDFLAGS = -Wl,--allow-multiple-definition test_coding_rules$(EXEEXT): \ $(boost_filesystem_objects) \ $(boost_regex_objects) \ diff --git a/workhorse.make b/workhorse.make index dd372d4..e6f6eec 100644 --- a/workhorse.make +++ b/workhorse.make @@ -472,9 +472,6 @@ operations_posix_windows.o: gcc_common_extra_warnings += -Wno-unused-parameter # http://lists.boost.org/Archives/boost/2006/03/102189.php # at least in version 1.33.1, and there seems to be no easy workaround # except to blow away all warning options and let a warning appear. -# This library also seems to require -# -Wl,--allow-multiple-definition -# for reasons unknown, at least with MinGW gcc-3.4.5 . static_mutex.o: gcc_common_extra_warnings := static_mutex.o: gcc_cxx_warnings := @@ -857,7 +854,7 @@ antediluvian_cli_monolithic$(EXEEXT): $(cli_objects) $(antediluvian_common_objec wx_new$(SHREXT): wx_new.o wx_test$(EXEEXT): lmi_so_attributes := -DLMI_USE_SO -wx_test$(EXEEXT): EXTRA_LDFLAGS := $(wx_ldflags) -Wl,--allow-multiple-definition +wx_test$(EXEEXT): EXTRA_LDFLAGS := $(wx_ldflags) wx_test$(EXEEXT): $(wx_test_objects) skeleton$(SHREXT) liblmi$(SHREXT) # TODO ?? This needs a corresponding test target. -- 1.7.9