This repository has been archived by the owner. It is now read-only.

cannot install php71 : missing libsystem_darwin.dylib (Xcode 9) #4590

Closed
theredled opened this Issue Nov 21, 2017 · 20 comments

Comments

Projects
None yet
@theredled
Copy link

theredled commented Nov 21, 2017

Description

I can't install php71 with brew install php71 --with-httpd as an error appears during the make process :

ld: file not found: /usr/lib/system/libsystem_darwin.dylib for architecture x86_64

Full log :

ld: file not found: /usr/lib/system/libsystem_darwin.dylib for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: file not found: /usr/lib/system/libsystem_darwin.dylib for architecture x86_64
make: *** [sapi/cgi/php-cgi] Error 1
make: *** Waiting for unfinished jobs....
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libs/libphp7.bundle] Error 1
ld: file not found: /usr/lib/system/libsystem_darwin.dylib for architecture x86_64
ld: file not found: /usr/lib/system/libsystem_darwin.dylib for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [sapi/fpm/php-fpm] Error 1
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [sapi/cli/php] Error 1

Seems like that file doesn't exist anymore in XCode 9; which is a shame because Brew asked me to install Xcode 9 or it wouldn't work...

Any idea?

Context and Logs

Parameter Value
macOS version: 10.12.6
Homebrew version: 1.3.8
PHP version in use: 7.1.8
Xcode version: 9.1

Output of gcc -v:

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.0.0 (clang-900.0.38)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Output of php -v:

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php71-intl/intl.so' - dlopen(/usr/local/opt/php71-intl/intl.so, 9): Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.58.dylib
Referenced from: /usr/local/opt/php71-intl/intl.so
Reason: image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php71-intl/intl.so' - dlopen(/usr/local/opt/php71-intl/intl.so, 9): Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.58.dylib
Referenced from: /usr/local/opt/php71-intl/intl.so
Reason: image not found in Unknown on line 0
PHP 7.1.8 (cli) (built: Aug 8 2017 18:49:37) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
with Xdebug v2.5.5, Copyright (c) 2002-2017, by Derick Rethans

@SMillerDev

This comment has been minimized.

Copy link
Contributor

SMillerDev commented Nov 21, 2017

did you install the command line tools after installing xcode 9? Because this looks like an issue with the command line tools.

@theredled

This comment has been minimized.

Copy link

theredled commented Nov 21, 2017

Yes I did:

$ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
$ xcode-select -v
xcode-select version 2347.

@theredled

This comment has been minimized.

Copy link

theredled commented Nov 22, 2017

All right, I stopped adding --with-httpd as it seems to be included by default as brew install php71 says:

With the release of macOS Sierra the Apache module is now not built by default.

It installs without any error but libphp7.so can't be found... Where is it supposed to be located?
Why is there no sentence explaining how to install that module (path etc) as it used to be?

@gzilt

This comment has been minimized.

Copy link

gzilt commented Nov 22, 2017

I have the same problem as @theredled. Installing with --with-httpd has error. Doing it without --with-httpd success but no libphp7.so

@SMillerDev

This comment has been minimized.

Copy link
Contributor

SMillerDev commented Nov 22, 2017

This thread seems to resolve around the same issue, and it seems to be caused by the users setup
unbit/uwsgi#1364 (comment)

Maybe that could work? I just tried to install --with-httpd just now, and it worked fine in my environment.

@Finetuned

This comment has been minimized.

Copy link

Finetuned commented Nov 22, 2017

Does this solution shed any light?

The issue is the project is use -L to point to /usr/lib in the SDK. The correct usage is no -L and instead use -isysroot pointing to the SDK. Ex:

-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk

What is happening is that libSystem.B.dylib in the SDK depends on /usr/lib/system/libsystem_darwin.dylib. If -isysroot is specified, the linker finds it. But since libsystem_darwin.dylib is not in the -L paths specified, it is not found.

I had to deleted Xcode 9.1, reinstall 8.3.3 before I was able to build php71 --with-httpd

@theredled

This comment has been minimized.

Copy link

theredled commented Nov 22, 2017

Works fine with XCode 8.3.3. The problem seems to be Sierra + XCode 9.
But git doctor now complains - which is a way more minor issue.

@tomyates

This comment has been minimized.

Copy link

tomyates commented Nov 23, 2017

Anyone know of a solution which doesn't involved downgrading Xcode 9?

@SMillerDev

This comment has been minimized.

Copy link
Contributor

SMillerDev commented Nov 23, 2017

There's one in the thread I linked

@Finetuned

This comment has been minimized.

Copy link

Finetuned commented Nov 23, 2017

@SMillerDev Can you be specific about which one you are referring to?

@tomyates

This comment has been minimized.

Copy link

tomyates commented Nov 23, 2017

@SMillerDev Thanks. None of that seems to work for me.

@dknell

This comment has been minimized.

Copy link

dknell commented Nov 26, 2017

I just did a clean install of MacOS Sierra (10.12.6) and had this same issue. I installed homebrew before Xcode was fully downloaded. I noticed that homebrew downloaded and installed the command line tools itself. I'm not sure if that's was caused the problem, but here's how I fixed it:

  • Removed the command line tools
sudo rm -rf /Library/Developer/CommandLineTools
  • Reinstalled the command line tools via xcode
xcode-select --install
  • Set the correct path
sudo xcode-select -s /Library/Developer/CommandLineTools
  • Then the php7 install works fine
brew install php71 --with-httpd
@gakkispy

This comment has been minimized.

Copy link

gakkispy commented Nov 26, 2017

Thanks @dknell ! It works for me.

@barryp

This comment has been minimized.

Copy link

barryp commented Nov 29, 2017

Thanks @dknell - I was having the exact same problem with php70 and those steps fixed it.

FYI for anyone else trying to follow, the 3rd step needed a sudo:

sudo xcode-select -s /Library/Developer/CommandLineTools

but if you miss that, it tells you what to do:

xcode-select: error: --switch must be run as root (e.g. `sudo xcode-select --switch <xcode_folder_path>`).
@tomyates

This comment has been minimized.

Copy link

tomyates commented Nov 29, 2017

Thanks @dknell worked for me.

@wikusv

This comment has been minimized.

Copy link

wikusv commented Nov 30, 2017

Thanks @dknell worked for me

@ajielee

This comment has been minimized.

Copy link

ajielee commented Nov 30, 2017

Thanks @dknell and @barryp, these steps works but just don't forget to use sudo in the 3rd step.

@javian

This comment has been minimized.

Copy link
Member

javian commented Dec 2, 2017

I'm currently committing a fix so that it should work on Sierra again. It is also required for creating the bottles for the new PHP releases including 7.2 so this has to work. #4617

@javian

This comment has been minimized.

Copy link
Member

javian commented Dec 3, 2017

The fix has been merged. Closing issue.

@javian javian closed this Dec 3, 2017

@kevinquillen

This comment has been minimized.

Copy link

kevinquillen commented Mar 9, 2018

Only thing that worked for me was the steps from @dknell.

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