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

[php] Add gcc-libs to pkg_deps #1946

merged 3 commits into from Nov 26, 2018
Changes from all commits
File filter
Filter file types
Failed to load comments.
Jump to
Jump to file
Failed to load files.


Just for now

@@ -23,6 +23,7 @@ pkg_deps=(
@@ -38,11 +39,7 @@ pkg_include_dirs=(include)

do_build() {
# The configuration scripts unset LD_RUN_PATH when testing linking for configured options,
# so the resulting 'conftest' binaries cannot run due to being unable to find
# This allows those binaries to execute while limiting the scope of LD_LIBRARY_PATH
# to the execution of `./configure`.
LD_LIBRARY_PATH="$(pkg_path_for gcc)/lib" ./configure --prefix="${pkg_prefix}" \
./configure --prefix="${pkg_prefix}" \

This comment has been minimized.


universam1 Oct 30, 2018

this will break libzip support!

Suggested change
./configure --prefix="${pkg_prefix}" \
LD_LIBRARY_PATH="$(pkg_path_for gcc)/lib" ./configure --prefix="${pkg_prefix}" \

This comment has been minimized.


smacfarlane Oct 30, 2018
Author Contributor

I wrote the comment, and it's wrong 😞. The underlying issue was that core/gcc-libs wasn't in the pkg_deps therefore the conftest binaries were unable to execute, not that the path was being manipulated.

The above LD_LIBRARY_PATH modifies only the runtime for ./configure and has no effect on commands executed later in the build, or in the runtime for the php package. Since this change adds core/gcc-libs to the pkg_deps, ./configure is able complete successfully without setting LD_LIBRARY_PATH, so LD_LIBRARY_PATH and the comment can safely be removed.

I've put together a small test case to validate. Note: I'm not a php dev, so suggestions on correctness are welcome 😄

Given the following php:

  $za = new ZipArchive;

When executing it under core/php/7.2.8/20181008145855 (current stable):

[31][default:/src:0]# hab pkg exec core/php/7.2.8/20181008145855 php test.php

Fatal error: Uncaught Error: Class 'ZipArchive' not found in /src/test.php:2
Stack trace:
#0 {main}
  thrown in /src/test.php on line 2

When executed it on a build with these changes:

[32][default:/src:0]# hab pkg exec smacfarlane/php php test.php
[33][default:/src:0]# unzip -l
  Length      Date    Time    Name
---------  ---------- -----   ----
     2027  2018-10-30 14:45   php/
---------                     -------
     2027                     1 file

This comment has been minimized.


predominant Oct 31, 2018

🎉 👍 💯 🥇

This comment has been minimized.


predominant Nov 1, 2018

@smacfarlane How about adding these steps to a test we can include? That would prevent any zip regression in the future.

This comment has been minimized.


smacfarlane Nov 9, 2018
Author Contributor

@predominant Done!

@universam1 Does the above address your concerns?

This comment has been minimized.


universam1 Nov 9, 2018

Cool, I’ll try!

This comment has been minimized.


smacfarlane Nov 26, 2018
Author Contributor

@universam1 I'm going to merge this, please open an issue if the resulting packages do not contain libzip support.

--enable-exif \
--enable-fpm \
--with-fpm-user=hab \
@@ -0,0 +1,5 @@
# The below will exit with a fatal error if libzip is not supported.
$za = new ZipArchive;
echo("Libzip is supported.\n");
@@ -0,0 +1,20 @@

set -euo pipefail

if [[ -z "${1:-}" ]]; then
echo "Usage: <fully qualified package ident>"
echo "ex: core/php/7.2.8/20181108151533"
exit 1


# This depends on the package being present on the depot OR
# in your local cache. If you're testing locally this is a
# reasonably safe assumption to make, as long as the cache
# isn't cleaned aggressively
hab pkg install "$pkg_ident"

hab pkg exec "$pkg_ident" php "$(dirname "$0")"/libzip_support.php
ProTip! Use n and p to navigate between commits in a pull request.