php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74969 Broken build with libsodium 1.0.0 and macro redifinitions
Submitted: 2017-07-22 12:03 UTC Modified: 2017-07-24 08:38 UTC
From: ab@php.net Assigned: jedisct1 (profile)
Status: Closed Package: Compile Failure
PHP Version: 7.2Git-2017-07-22 (Git) OS: Debian Jessie
Private report: No CVE-ID: None
 [2017-07-22 12:03 UTC] ab@php.net
Description:
------------
From the config.log

14407 configure:76454: checking for sodium support
14408 configure:76490: result: yes
14409 configure:76502: checking for pkg-config
14410 configure:76533: result: /usr/bin/pkg-config
14411 configure:76541: checking for libsodium
14412 configure:76553: result: version 1.0.0 found using pkg-config

Package libsodium-dev:
p   1.0.0-1          oldstable       500
i   1.0.11-1~bpo8+1  jessie-backports 100

The package from the backports compiles, the macro redifinition warnings are still present. Same warnings are shown in Windows builds. The extension should either compile with older dependency versions or do a clean error check at the configure time.

Thanks.

Actual result:
--------------
/home/anatol/dws/src/php-7.2-nts/ext/sodium/libsodium.c: In function ‘zm_startup_sodium’:
/home/anatol/dws/src/php-7.2-nts/ext/sodium/libsodium.c:419:0: warning: "crypto_kx_PUBLICKEYBYTES" redefined
 # define crypto_kx_PUBLICKEYBYTES 32
 ^
In file included from /home/anatol/dws/src/php-7.2-nts/ext/sodium/libsodium.c:26:0:
/home/anatol/dws/src/php-7.2-nts/ext/sodium/php_libsodium.h:113:0: note: this is the location of the previous definition
 #define crypto_kx_PUBLICKEYBYTES crypto_scalarmult_SCALARBYTES
 ^
/home/anatol/dws/src/php-7.2-nts/ext/sodium/libsodium.c:420:0: warning: "crypto_kx_SECRETKEYBYTES" redefined
 # define crypto_kx_SECRETKEYBYTES 32
 ^
In file included from /home/anatol/dws/src/php-7.2-nts/ext/sodium/libsodium.c:26:0:
/home/anatol/dws/src/php-7.2-nts/ext/sodium/php_libsodium.h:114:0: note: this is the location of the previous definition
 #define crypto_kx_SECRETKEYBYTES crypto_scalarmult_SCALARBYTES
 ^
/home/anatol/dws/src/php-7.2-nts/ext/sodium/libsodium.c: In function ‘zif_sodium_crypto_aead_chacha20poly1305_ietf_keygen’:
/home/anatol/dws/src/php-7.2-nts/ext/sodium/libsodium.c:2870:20: error: ‘crypto_aead_chacha20poly1305_ietf_KEYBYTES’ undeclared (first use in this function)
  unsigned char key[crypto_aead_chacha20poly1305_ietf_KEYBYTES];
                    ^
/home/anatol/dws/src/php-7.2-nts/ext/sodium/libsodium.c:2870:20: note: each undeclared identifier is reported only once for each function it appears in
/home/anatol/dws/src/php-7.2-nts/ext/sodium/libsodium.c:2870:16: warning: unused variable ‘key’ [-Wunused-variable]
  unsigned char key[crypto_aead_chacha20poly1305_ietf_KEYBYTES];
                ^
Makefile:1607: recipe for target 'ext/sodium/libsodium.lo' failed
make: *** [ext/sodium/libsodium.lo] Error 1

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-07-22 12:03 UTC] ab@php.net
-Assigned To: +Assigned To: jedisct1
 [2017-07-22 16:35 UTC] jedisct1@php.net
libsodium 1.0.0 is dead old, we can't reasonably support that. In addition to many missing functions, there were some annoying limitations, such as input/output buffers that couldn't overlap.
 [2017-07-22 17:30 UTC] ab@php.net
Ok, I thought that. Perhaps the right way were to add a version check, also cleaning up the macro redifines while on that. It is definitely not nice to fail in the middle of compilation, where the configure could reject the incompatible version. Fe see what is done for OpenSSL version checks.

It can be different on other distros/OSes, here as mentioned 1.0.11 from backports seems OK. However the backports repo has to be extra enabled and the regular repo has a higher priority, so that's not the version installed by default.

Thanks.
 [2017-07-22 20:25 UTC] jedisct1@php.net
A configuration-time check for libsodium >= 1.0.8 was added.
 [2017-07-22 20:47 UTC] ab@php.net
Fix confirmed.

For the further, just you to be aware, there's a standard procedure

- please check https://wiki.php.net/vcs/gitworkflow for merging rules
- once fixed, the ticket can be set to "closed"
- updating NEWS (released branches only, except the change is master only)
- note to UPGRADING would make sense

Thanks!
 [2017-07-24 08:38 UTC] kalle@php.net
-Status: Assigned +Status: Closed
 [2017-07-24 08:38 UTC] kalle@php.net
Closing per Anatol's comment
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 11:01:31 2024 UTC