apr-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 50146] cross compiling apr error: redefinition of 'struct iovec'
Date Mon, 04 Jan 2021 18:43:40 GMT

--- Comment #8 from Michael Driscoll <mdriscoll@tenable.com> ---
Created attachment 37685
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37685&action=edit
Crude patch to configure which demonstrates the issue / direction for a fix

Hello!  We had this same problem with our product's usage of APR, and worked
out what the issue was.

I've attached the temporary workaround patch that we're using in the meantime,
I know this isn't the correct way to fix it (which will involve something like
updating autoconf / autotools, and/or tweaking configure.in, which are both
beyond my ken).  But to summarize the problem / patch:

- In several places `configure` compiles a program like the following to find
the size of a given struct:

    fprintf(f, "%d", sizeof(foo));

This fails on newer macos / xcode / clang, because it generates a fatal warning
("%d" is not a portable specifier for a size_t).  This patch tweaks all of
these uses to use the "%zd" specifier instead.  It would be even more portable
to cast sizeof to (int) instead.

This particular fix is the fix for iovec, without this configure assumes that
"struct iovec" does not exist in system headers, causing the
duplicate/incompatible definition that then fails the compile.

- In other places `configure` is compiling programs that call `exit(1)` without
including <stdlib.h>.  I fixed this by also adding $ac_includes_default to any
programs calling `exit()`.  This might not be a problem in up-to-date apr (we
could be versions behind, I haven't checked), but it caused a compile failure
for us so I'm including it in this patch as an FYI.

You are receiving this mail because:
You are the assignee for the bug.
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org

View raw message