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

Installation failing on high sierra #721

Closed
mgoffin opened this issue Jan 2, 2018 · 10 comments
Closed

Installation failing on high sierra #721

mgoffin opened this issue Jan 2, 2018 · 10 comments

Comments

@mgoffin
Copy link

mgoffin commented Jan 2, 2018

Description

Attemping to install on High Sierra is throwing the following error:

checking whether g++ accepts -g... yes
checking accept ARG2 => struct sockaddr ARG3 => socklen_t ... not ok
checking accept ARG2 => void ARG3 => socklen_t ... not ok
checking accept ARG2 => struct sockaddr ARG3 => size_t ... not ok
checking accept ARG2 => void ARG3 => size_t ... not ok
checking accept ARG2 => struct sockaddr ARG3 => int ... not ok
checking accept ARG2 => void ARG3 => int ... not ok
configure: error: accept unable to find a working combination

Command I am running:

$ CFLAGS="-L/usr/local/opt/openssl/lib -I/usr/local/opt/openssl/include" pecl install mongodb

Environment

OSX High Sierra using default PHP installation (/usr/bin/php)

PHP 7.1.7 (cli) (built: Jul 15 2017 18:08:09) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
@jmikola
Copy link
Member

jmikola commented Jan 2, 2018

Does this error only arise when you specify CFLAGS?

Can you grep sys/socket.h for accept and share its prototype? On the off chance there are multiple instances of that file, please list all paths and prototypes that you come across.

According to this accept(2) man page, it should be satisfied with ARG2 => struct sockaddr and ARG3 => int (case 5 of 6 in your paste). This gist of socket.h suggests that ARG3 should be socklen_t (case 1 of 6 in your paste). For reference, the logic for this check is implemented in CheckCompiler.m4 within libmongoc.

@mgoffin
Copy link
Author

mgoffin commented Jan 2, 2018

That was the issue. xcode command line tools was not installed. Weird as it was installed before the high sierrra upgrade. That got me as far as sudo make install which failed for a reason other than this issue, so I'll close it out. Thank you!

@mgoffin mgoffin closed this as completed Jan 2, 2018
@jmikola
Copy link
Member

jmikola commented Jan 2, 2018

@mgoffin: Note that if you need to customize the path for OpenSSL headers, the --with-openssl-dir option for ./configure is the proper way to do so. This has been used to alleviate issues building the driver on High Sierra, since macOS switched to using BoringSSL as its system library (see: Homebrew/homebrew-core#21475 (comment)).

Since we don't currently support passing configure options via PECL (pending PHPC-1017), the above approach does require building the driver from source.

@mgoffin
Copy link
Author

mgoffin commented Jan 2, 2018

@jmikola Thanks! Would you happen to know why I would get an "Operation not permitted" when doing sudo make install? Is that due to the protected file system Apple introduced a while back?

@jmikola
Copy link
Member

jmikola commented Jan 2, 2018

Is the "Operation not permitted" only when building for the macOS version of PHP? AFAIK, the only thing make install does is copy modules/mongodb.so to PHP's extension directory. If PHP's extension directory is located within some directory covered by macOS' System Integrity Protection, I suppose that could be the cause of this error (as discussed in this Stack Overflow thread). I'll note that this answer is likely better than the accepted answer, as it advises against simply disabling SIP for a quick fix.

You may also want to look into installing PHP via Homebrew and compiling the driver for that. Independent of the MongoDB driver, that would keep PHP within accessible directories and give you more control over its version.

@mgoffin
Copy link
Author

mgoffin commented Jan 3, 2018

I got past the Operation not permitted error. I went with Homebrew everything and then I followed the steps at the end of #658. Unfortunately I am now seeing Apache segfaults. I can cleanly start Apache if I comment out the extension from php.ini, but once it's added Apache dies.

[Tue Jan 02 20:22:21.659114 2018] [core:notice] [pid 83900] AH00094: Command line: '/usr/local/opt/httpd/bin/httpd'
[Tue Jan 02 20:23:09.409472 2018] [mpm_prefork:notice] [pid 83900] AH00173: SIGHUP received.  Attempting to restart
[Tue Jan 02 20:23:09.449385 2018] [core:notice] [pid 83900] AH00060: seg fault or similar nasty error detected in the parent process

@jmikola
Copy link
Member

jmikola commented Jan 3, 2018

If you're able to obtain a backtrace from the segfaults, I expect you'll find they're related to SSL (see: #681 and #682). If so, the solution outlined in Homebrew/homebrew-core#21475 (comment) is likely the best option for macOS High Sierra at the moment.

@mgoffin
Copy link
Author

mgoffin commented Jan 3, 2018

That was it! Thanks!

@CaledoniaProject
Copy link

CaledoniaProject commented Dec 24, 2018

I got the exactly same issue on OSX 10.14.2. Apart from CFLAGS and LDFLAGS, I had to disable warnings about unused arguments, e.g

CFLAGS="-Wno-unused-command-line-argument -L/usr/local/opt/openssl/lib -I/usr/local/opt/openssl/include" pecl install mongodb

Hopefully this would help.

#796

@sunznx
Copy link

sunznx commented Aug 13, 2020

I got the exactly same issue on OSX 10.14.2. Apart from CFLAGS and LDFLAGS, I had to disable warnings about unused arguments, e.g

CFLAGS="-Wno-unused-command-line-argument -L/usr/local/opt/openssl/lib -I/usr/local/opt/openssl/include" pecl install mongodb

Hopefully this would help.

#796

it works for me!

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