[Bug 155] New: Compilation failure in 3.3.3: the Darwin linker does not accept "--whole-archive"
https://bugzilla.balabit.com/show_bug.cgi?id=155 Summary: Compilation failure in 3.3.3: the Darwin linker does not accept "--whole-archive" Product: syslog-ng Version: 3.3.x Platform: Macintosh OS/Version: Mac OS Status: NEW Severity: normal Priority: unspecified Component: syslog-ng AssignedTo: bazsi@balabit.hu ReportedBy: jacknagel@gmail.com Type of the Report: bug Estimated Hours: 0.0 Trying to compile 3.3.3 on Mac OS X 10.6.8/XCode 4.2, I get this: libtool: link: /usr/bin/llvm-gcc -std=gnu99 -dynamiclib -o .libs/libsyslog-ng-3.3.3.dylib [...] ld: unknown option: --whole-archive collect2: ld returned 1 exit status some cursory googling reveals that the Darwin linker does not accept "--whole-archive". I'd be happy to help test a patch. -- Configure bugmail: https://bugzilla.balabit.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
https://bugzilla.balabit.com/show_bug.cgi?id=155 --- Comment #1 from Balazs Scheidler <bazsi@balabit.hu> 2012-01-02 07:42:07 --- can you check if --enable-dynamic-linking solves this issue? -- Configure bugmail: https://bugzilla.balabit.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
https://bugzilla.balabit.com/show_bug.cgi?id=155 Jack Nagel <jacknagel@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jacknagel@gmail.com --- Comment #2 from Jack Nagel <jacknagel@gmail.com> 2012-01-04 01:58:02 ---
can you check if --enable-dynamic-linking solves this issue?
Compiling with and without --enable-dynamic-linking results in the same (aformentioned) linker error. -- Configure bugmail: https://bugzilla.balabit.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
https://bugzilla.balabit.com/show_bug.cgi?id=155 Tamás Pál <folti@balabit.hu> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |folti@balabit.hu --- Comment #3 from Tamás Pál <folti@balabit.hu> 2012-01-05 10:26:28 --- (In reply to comment #1)
can you check if --enable-dynamic-linking solves this issue?
In OSE, this options are hardcoded into the SYSLOGNG_DEPS_LIBS variable when dynamic linking is disabled, but hardcoded into ivykis' options when dynamic linking enabled and the internal ivykis source used. Either he has to use a separate ivykis or we have to make optional the --whole-archive options, like with this patch: diff --git a/configure.in b/configure.in index ed12a8e..71a8f06 100644 --- a/configure.in +++ b/configure.in @@ -220,6 +220,15 @@ AC_PROG_MAKE_SET PKG_PROG_PKG_CONFIG LT_INIT([dlopen disable-static]) +WHOLE_ARCHIVE="-Wl,--whole-archive" +NO_WHOLE_ARCHIVE="-Wl,--no-whole-archive" +case "$ostype" in + Darwin) + WHOLE_ARCHIVE= + NO_WHOLE_ARCHIVE= + ;; +esac + dnl *************************************************************************** dnl Validate yacc @@ -737,12 +746,12 @@ if test "x$with_ivykis" = "xinternal"; then # these can only be used in lib as it assumes # the current directory just one below ivykis - IVYKIS_LIBS="-Wl,--whole-archive -L\$(top_builddir)/lib/ivykis/lib -livykis -L\$(top_builddir)/lib/ivykis/modules -livykis-modules -Wl,--no-whole-archive" + IVYKIS_LIBS="$WHOLE_ARCHIVE -L\$(top_builddir)/lib/ivykis/lib -livykis -L\$(top_builddir)/lib/ivykis/modules -livykis-modules $NO_WHOLE_ARCHIVE" IVYKIS_CFLAGS="-I\$(top_srcdir)/lib/ivykis/lib/include -I\$(top_builddir)/lib/ivykis/lib/include -I\$(top_srcdir)/lib/ivykis/modules/include" IVYKIS_SUBDIRS=ivykis # LIBS to use when libtool is not applicable (when linking the main syslog-ng executable in mixed linking mode) - IVYKIS_NO_LIBTOOL_LIBS="-Wl,--whole-archive -L\$(top_builddir)/lib/ivykis/lib/.libs -livykis -L\$(top_builddir)/lib/ivykis/modules/.libs -livykis-modules -Wl,--no-whole-archive" + IVYKIS_NO_LIBTOOL_LIBS="$WHOLE_ARCHIVE -L\$(top_builddir)/lib/ivykis/lib/.libs -livykis -L\$(top_builddir)/lib/ivykis/modules/.libs -livykis-modules $NO_WHOLE_ARCHIVE" else AC_MSG_ERROR([Internal ivykis sources not found in lib/ivykis. This is a hard dependency, unable to build syslog-ng without them.]) fi @@ -1004,7 +1013,7 @@ if test "x$linking_mode" = "xdynamic"; then # syslog-ng binary is linked with the default link command (e.g. libtool) SYSLOGNG_LINK='$(LINK)' else - SYSLOGNG_DEPS_LIBS="$LIBS $BASE_LIBS $RESOLV_LIBS $LD_START_STATIC -Wl,--whole-archive $GLIB_LIBS $EVTLOG_LIBS $PCRE_LIBS $REGEX_LIBS -Wl,--no-whole-archive $IVYKIS_NO_LIBTOOL_LIBS $LD_END_STATIC $LIB + SYSLOGNG_DEPS_LIBS="$LIBS $BASE_LIBS $RESOLV_LIBS $LD_START_STATIC $WHOLE_ARCHIVE $GLIB_LIBS $EVTLOG_LIBS $PCRE_LIBS $REGEX_LIBS $NO_WHOLE_ARCHIVE $IVYKIS_NO_LIBTOOL_LIBS $LD_END_STATIC $LIBCAP_LIBS $ TOOL_DEPS_LIBS="$LIBS $BASE_LIBS $GLIB_LIBS $EVTLOG_LIBS $RESOLV_LIBS $LIBCAP_LIBS $PCRE_LIBS $REGEX_LIBS $IVYKIS_LIBS $DL_LIBS" CORE_DEPS_LIBS="" -- Configure bugmail: https://bugzilla.balabit.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
https://bugzilla.balabit.com/show_bug.cgi?id=155 --- Comment #4 from Balazs Scheidler <bazsi@balabit.hu> 2012-01-06 12:45:35 --- The issue with this patch that --whole-archive is required, as ivykis is linked into an .so which needs to reexport _all_ symbols. If whole-archive is not specified, only the parts of ivykis that are directly referenced will be linked in. Is there an alternative of --whole-archive in the darwin linker? -- Configure bugmail: https://bugzilla.balabit.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
https://bugzilla.balabit.com/show_bug.cgi?id=155 --- Comment #5 from Tamás Pál <folti@balabit.hu> 2012-01-06 13:40:01 --- (In reply to comment #4)
The issue with this patch that --whole-archive is required, as ivykis is linked into an .so which needs to reexport _all_ symbols. If whole-archive is not specified, only the parts of ivykis that are directly referenced will be linked in.
Is there an alternative of --whole-archive in the darwin linker?
Not that I know of. Problem is that the Darwin linker is a 10+ years old BSD linker, missing these features. Most likely it doesn't support the --no-whole-archive functionality. At least a patch(http://people.freebsd.org/~peter/valgrind.diff) google found did just what my patch did. -- Configure bugmail: https://bugzilla.balabit.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
https://bugzilla.balabit.com/show_bug.cgi?id=155 --- Comment #6 from Balazs Scheidler <bazsi@balabit.hu> 2012-01-09 09:42:28 --- The solution would probably be to introduce a "--enable-monolithic-linking" option that simply creates a single binary from syslog-ng without the shared object stuff. This would even make it easier to compile syslog-ng from source, although only on platforms which support reeexporting symbols from the main binary. (e.g. I think AIX is not possible) until then, I'm afraid you'd have to stick to 3.2 on MacOS -- Configure bugmail: https://bugzilla.balabit.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
https://bugzilla.balabit.com/show_bug.cgi?id=155 --- Comment #7 from Jack Nagel <jacknagel@gmail.com> 2013-08-25 22:18:29 --- (In reply to comment #5)
(In reply to comment #4)
The issue with this patch that --whole-archive is required, as ivykis is linked into an .so which needs to reexport _all_ symbols. If whole-archive is not specified, only the parts of ivykis that are directly referenced will be linked in.
Is there an alternative of --whole-archive in the darwin linker?
Not that I know of. Problem is that the Darwin linker is a 10+ years old BSD linker, missing these features. Most likely it doesn't support the --no-whole-archive functionality. At least a patch(http://people.freebsd.org/~peter/valgrind.diff) google found did just what my patch did.
I'm fairly certainly that darwin equivalent of "--[no-]whole-archive" is "-[no]all_load". -- Configure bugmail: https://bugzilla.balabit.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
https://bugzilla.balabit.com/show_bug.cgi?id=155 Gergely Nagy <algernon@balabit.hu> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |algernon@balabit.hu AssignedTo|bazsi@balabit.hu |algernon@balabit.hu --- Comment #8 from Gergely Nagy <algernon@balabit.hu> 2013-08-26 10:43:43 --- (In reply to comment #7)
(In reply to comment #5)
(In reply to comment #4)
The issue with this patch that --whole-archive is required, as ivykis is linked into an .so which needs to reexport _all_ symbols. If whole-archive is not specified, only the parts of ivykis that are directly referenced will be linked in.
Is there an alternative of --whole-archive in the darwin linker?
Not that I know of. Problem is that the Darwin linker is a 10+ years old BSD linker, missing these features. Most likely it doesn't support the --no-whole-archive functionality. At least a patch(http://people.freebsd.org/~peter/valgrind.diff) google found did just what my patch did.
I'm fairly certainly that darwin equivalent of "--[no-]whole-archive" is "-[no]all_load".
Hrm... I can try to cook up a patch that tests for --whole-archive, and if that fails, tries -all_load, but I won't be able to test it much. I will be able to show the patch and ask for testing though. -- Configure bugmail: https://bugzilla.balabit.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
https://bugzilla.balabit.com/show_bug.cgi?id=155 Gergely Nagy <algernon@balabit.hu> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED -- Configure bugmail: https://bugzilla.balabit.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
https://bugzilla.balabit.com/show_bug.cgi?id=155 --- Comment #9 from Gergely Nagy <algernon@balabit.hu> 2013-08-26 13:37:08 --- I checked further, and there's an issue: while we can emulate --whole-archive with -all_load, that won't do the trick, we need to be able to turn it off too, and -noall_load won't do that: they're mutually exclusive. You can't enable all_libs for certain libraries only, like we do with --whole-archive. There's a workaround of linking the objects by hand, but... that's beyond awkward. What we could do is enable -all_libs in this case, but I'm not exactly sure whether that'd work. I'll prepare a patch that does that, so someone with a MacOS handy can test the results. -- Configure bugmail: https://bugzilla.balabit.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
https://bugzilla.balabit.com/show_bug.cgi?id=155 --- Comment #10 from Gergely Nagy <algernon@balabit.hu> 2013-08-26 13:57:05 --- Can you try if this patch helps?: https://github.com/algernon/syslog-ng/commit/6f7d8cec9293ef3aff856d399750b77... -- Configure bugmail: https://bugzilla.balabit.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
participants (1)
-
bugzilla@bugzilla.balabit.com