Skip to content
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

configure script doesn't include required headers; configuration fails #45

Closed
ryandesign opened this issue Feb 2, 2021 · 5 comments
Closed

Comments

@ryandesign
Copy link
Contributor

Describe the bug

Configuration fails on macOS and when implicit declaration of functions is an error:

checking for library containing socket... not found
configure: error: could not find library containing socket

config.log shows the reason is:

conftest.c:78:1: error: implicit declaration of function 'socket' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
socket();
^

This was reported to MacPorts here. Implicit declaration of functions is an error in the version of clang included with Xcode 12 and later, or if you add -Werror=implicit-function-declaration to CFLAGS (which I do because I have not upgraded to Xcode 12 but I want to find and help fix these errors). Apple changed this condition from a warning to an error in order to support ARM processors which have different calling conventions for variadic and non-variadic functions, so the compiler must know before you call a function what kind of function it is, so it must see the function declaration.

After fixing this problem by patching the configure script to add the line:

#include <sys/socket.h>

it still fails. config.log shows the next problem is:

conftest.c:78:8: error: too few arguments to function call, expected 3, have 0
socket();
~~~~~~ ^
/usr/include/sys/socket.h:702:1: note: 'socket' declared here
int     socket(int, int, int);
^

Environment

  • neon version: master
  • OS: macOS
  • SSL library version: 1.1.1i

To Reproduce
On macOS with Xcode 12 or later, run LIBTOOLIZE=glibtoolize ./autogen.sh (if not using a release) and ./configure.

Debugging output
N/A

@cooljeanius
Copy link

Note that in MacPorts, a lot of other ports depend upon neon, so getting this fixed is pretty important for getting software that uses neon to build on Macs in general.

@notroj
Copy link
Owner

notroj commented Mar 23, 2021

If you build with:
ne_cv_libsfor_socket="none needed" ./configure
does the configure run otherwise succeed?

@1480c1
Copy link
Contributor

1480c1 commented Mar 23, 2021

Perhaps it might be possible to do something similar to https://github.com/notroj/neon/blob/master/macros/neon.m4#L374 where #include <sys/socket.h> is added to ne__prologue and with 0 values for the arguments?

@ryandesign
Copy link
Contributor Author

A fix has been committed to MacPorts. I have not evaluated the suitability of this fix.

@ryandesign
Copy link
Contributor Author

If you build with:
ne_cv_libsfor_socket="none needed" ./configure
does the configure run otherwise succeed?

It then goes to:

configure: error: could not find library containing gethostbyname

If I extend your suggestion by adding ne_cv_libsfor_gethostbyname="none needed" then configure succeeds, however config.log still shows evidence of implicit function declarations in the checks for getaddrinfo and hstrerror and configure output contains:

checking for library containing socket... (cached) none needed
checking for library containing getaddrinfo... not found
checking for library containing gethostbyname... (cached) none needed
checking for library containing hstrerror... not found

The build succeeds but I don't know what effect those "not found" results would have. If I add ne_cv_libsfor_getaddrinfo="none needed" and ne_cv_libsfor_hstrerror="none needed" to the configure invocation then those go away. But of course none of these should be needed.

Perhaps it might be possible to do something similar to https://github.com/notroj/neon/blob/master/macros/neon.m4#L374 where #include <sys/socket.h> is added to ne__prologue and with 0 values for the arguments?

I think I have reached success with that suggestion and I'll submit a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants