New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not all compilers support -Werror=partial-availability #1104

Closed
bemoody opened this Issue Nov 3, 2016 · 4 comments

Comments

Projects
None yet
2 participants
@bemoody

bemoody commented Nov 3, 2016

Recently, curl's configure script was changed to unconditionally
add '-Werror=partial-availability' to the CFLAGS if $host_os is
darwin*.

This breaks compilation using diorcety's crosstool-ng, which
doesn't know about that option. And it probably breaks lots of
other older compilers.

Please check that the C compiler actually understands a given
option before adding it to the CFLAGS. For example:

save_CFLAGS=$CFLAGS
AC_MSG_CHECKING([whether $CC accepts -Werror=partial-availability])
CFLAGS="$CFLAGS -Werror=partial-availability"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
  [AC_MSG_RESULT([yes])],
  [AC_MSG_RESULT([no])
   CFLAGS=$save_CFLAGS])

@bagder bagder added the build label Nov 3, 2016

@bagder

This comment has been minimized.

Show comment
Hide comment
@bagder

bagder Nov 3, 2016

Member

So what about -mmacosx-version-min, is that also going to cause problems?

Member

bagder commented Nov 3, 2016

So what about -mmacosx-version-min, is that also going to cause problems?

@bagder

This comment has been minimized.

Show comment
Hide comment
@bagder

bagder Nov 3, 2016

Member

Just checking if -Werror=partial-availability works:

diff --git a/acinclude.m4 b/acinclude.m4
index f959e3d..2abae8d 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -3230,9 +3230,16 @@ AC_DEFUN([CURL_MAC_CFLAGS], [
     if test -z "$min"; then
       AC_MSG_RESULT([set by user])
     else
       AC_MSG_RESULT([$min set])
     fi
+
+    old_CFLAGS=$CFLAGS
     CFLAGS="$CFLAGS -Werror=partial-availability"
+    AC_MSG_CHECKING([whether $CC accepts -Werror=partial-availability])
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])
+      CFLAGS=$old_CFLAGS])
   fi

 ])
Member

bagder commented Nov 3, 2016

Just checking if -Werror=partial-availability works:

diff --git a/acinclude.m4 b/acinclude.m4
index f959e3d..2abae8d 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -3230,9 +3230,16 @@ AC_DEFUN([CURL_MAC_CFLAGS], [
     if test -z "$min"; then
       AC_MSG_RESULT([set by user])
     else
       AC_MSG_RESULT([$min set])
     fi
+
+    old_CFLAGS=$CFLAGS
     CFLAGS="$CFLAGS -Werror=partial-availability"
+    AC_MSG_CHECKING([whether $CC accepts -Werror=partial-availability])
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
+      [AC_MSG_RESULT([yes])],
+      [AC_MSG_RESULT([no])
+      CFLAGS=$old_CFLAGS])
   fi

 ])
@bemoody

This comment has been minimized.

Show comment
Hide comment
@bemoody

bemoody Nov 3, 2016

-mmacosx-version-min works for me; it seems to me that's been around for quite a while so it's probably safe. But I'm not sure.

bemoody commented Nov 3, 2016

-mmacosx-version-min works for me; it seems to me that's been around for quite a while so it's probably safe. But I'm not sure.

@bagder bagder closed this in 6724242 Nov 3, 2016

@bagder

This comment has been minimized.

Show comment
Hide comment
@bagder

bagder Nov 3, 2016

Member

Thanks! Ok let's leave -mmacosx-version-min for now and see if people report anything. Pushed the fix for -Werror=partial-availability.

Member

bagder commented Nov 3, 2016

Thanks! Ok let's leave -mmacosx-version-min for now and see if people report anything. Pushed the fix for -Werror=partial-availability.

@lock lock bot locked as resolved and limited conversation to collaborators May 7, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.