brew install (or upgrade, reinstall) a single, Homebrew/homebrew-core formula (not cask) on macOS? If it's a general brew problem please file this issue at Homebrew/brew: https://github.com/Homebrew/brew/issues/new/choose. If it's a Linux problem please file this issue at https://github.com/Homebrew/linuxbrew-core/issues/new/choose. If it's a brew cask problem please file this issue at https://github.com/Homebrew/homebrew-cask/issues/new/choose. If it's a tap (e.g. Homebrew/homebrew-php) problem please file this issue at the tap.brew update and can still reproduce the problem?brew doctor, fixed all issues and can still reproduce the problem?brew gist-logs <formula> (where <formula> is the name of the formula that failed) and included the output link?brew gist-logs didn't work: ran brew config and brew doctor and included their output with your issue?To help us debug your issue please explain:
Symfony PHP framework is using sodium extension (when available) to encode users passwords.
> php -r "sodium_crypto_pwhash_str('foo', 4, 67108864);"
[1] 3947 segmentation fault php -r "sodium_crypto_pwhash_str('foo', 4, 67108864);"
Function should return proper password hash.
brew install commands)brew install php
php -r "sodium_crypto_pwhash_str('foo', 4, 67108864);"
Same here, maybe it is related to: https://github.com/jedisct1/libsodium/issues/881
@LogicException Yes, that was my assumption too.
If You're struggling with this, my advice for now would be to disable sodium extension and rebuild php from source.
What I did for now:
brew edit php
Removed this line https://github.com/Homebrew/homebrew-core/blob/master/Formula/php.rb#L152
brew reinstall -s php
If You're - hopefully - not reliant on this extension, You should be fine until this issue is resolved.
@phpeek thank's for the workaround, but switching encryption algorithm in my symphony dev env is way more easier ;-)
Using the stable branch of libsodium instead of the release package worked for me. I edited the brew formula a bit to build the stable branch using the head parameter as workaround.
brew edit libsodium
head do
url "https://github.com/jedisct1/libsodium.git", :branch => "stable"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
brew install libsodium --HEAD
Could you report that upstream? It seems important for them to know that their release is broken on macOS.
Could you report that upstream? It seems important for them to know that their release is broken on macOS.
See https://github.com/jedisct1/libsodium/issues/881 I only applied solution 2 under “What can you do?” They are aware.
Appears that this issue has been fixed by Xcode 11.2 release. Closing.
I did all points from this issue, but it doesnt help for me. After upgrade to MacOS Catalina 10.15.1, then Xcode to 11.2 I still have this error
[1] 13177 segmentation fault php -r "sodium_crypto_pwhash_str('foo', 4, 67108864);"
PHP 7.2 + PHP 7.3 which use libsodium
@kamilmaliszewski you can try @phpeek's answer (https://github.com/Homebrew/homebrew-core/issues/45074#issuecomment-542373915 ), this workaround solved the problem for me
@LogicException but looking on this answer, he is removing sodium from PHP lib. So in the result this metod sodium_crypto_pwhash_str wlill stop working? I need this method working
@kamilmaliszewski yes, you're right, sorry 🥺 that was not the full story. I've removed libsodium like @phpeek described in his answer and than rebuild it like @mennoterlaak described in https://github.com/Homebrew/homebrew-core/issues/45074#issuecomment-542736213
@kamilmaliszewski Make sure You recompile PHP after upgrading Xcode ?
brew reinstall -s php
@phpeek yep, I did it before, but I started it also right now brew reinstall -s php, then restart apache and php and... still the same.
php -r "sodium_crypto_pwhash_str('foo', 4, 67108864);"
[1] 94573 segmentation fault php -r "sodium_crypto_pwhash_str('foo', 4, 67108864);"
I have MacOS Catalina 10.15.1
Xcode 11.2 (11B52)
PHP 7.3.11
Httpd 2.4.41
Libsodium 1.0.18
Not have idea what to do to fix it
@phpeek do you have also the newest php version? Maybe you have any older? Can you check?
@kamilmaliszewski Sorry for the confusion. You were right. php still segfaults with latest 1.0.18 version of libsodium.
If Your app depends on sodium extension, then You have to rely on workaround suggested by @mennoterlaak - https://github.com/Homebrew/homebrew-core/issues/45074#issuecomment-542736213.
brew unlink libsodium
brew edit libsodium
Point HEAD to stable branch as suggested in mentioned comment and do
brew install --HEAD libsodium
It's working for me.
I've issued PR for libsodium formula - https://github.com/Homebrew/homebrew-core/pull/46604 in order for it to be fetched from stable release tarball. This should fix the issue and workaround won't be necessary.
@phpeek your solution works for me. After add this ":branch => "stable" and reinstall libsodium everything is fine. sodium_crypto_pwhash_str is used by Magento2 when you are trying to login into admin panel, so I thnik soon will be more pepole here :)
libsodium has been rebuilt using Xcode 11.2 (and a different source url). Hopefully this should be working now. Let me know if it isn't and I'll reopen.
Most helpful comment
Using the stable branch of libsodium instead of the release package worked for me. I edited the brew formula a bit to build the stable branch using the head parameter as workaround.
brew edit libsodiumbrew install libsodium --HEAD