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

.deb package missing dependencies #734

Majkl578 opened this issue Jan 28, 2020 · 2 comments

.deb package missing dependencies #734

Majkl578 opened this issue Jan 28, 2020 · 2 comments


Copy link

@Majkl578 Majkl578 commented Jan 28, 2020

Trying to install the datadog-trace-php in clean Docker environment (official image debian:buster-20191118-slim) causes the installer to produce errors about nonexistent command:

root@91a62a089c18:/tmp# dpkg -i datadog-php-tracer_0.38.0_amd64.deb 
Selecting previously unselected package datadog-php-tracer.
(Reading database ... 6850 files and directories currently installed.)
Preparing to unpack datadog-php-tracer_0.38.0_amd64.deb ...
Unpacking datadog-php-tracer (0.38.0) ...
Setting up datadog-php-tracer (0.38.0) ...
### Installing Datadog PHP tracing extension (ddtrace)
### Logging  -i to a file
/var/lib/dpkg/info/datadog-php-tracer.postinst: line 142: -i: command not found
/var/lib/dpkg/info/datadog-php-tracer.postinst: line 144: -i: command not found
/var/lib/dpkg/info/datadog-php-tracer.postinst: line 145: -i: command not found
/var/lib/dpkg/info/datadog-php-tracer.postinst: line 147: -i: command not found
### conf.d folder not found falling back to appending extension config to main "php.ini"
/var/lib/dpkg/info/datadog-php-tracer.postinst: line 166: -i: command not found
### Failed enabling ddtrace extension
### The extension has been installed but couldn't be enabled
### Try adding the extension manually to your PHP - php.ini - configuration file
### e.g. by adding following line: 
###     extension=/opt/datadog-php/extensions/
### Note that your PHP API version must match the extension's API version
### PHP API version can be found using following command
###      -i | grep 'PHP API'

After installing PHP packages, it starts producing different warnings about missing libcurl4:

PHP Warning:  PHP Startup: Unable to load dynamic library '/opt/datadog-php/extensions/' (tried: /opt/datadog-php/extensions/ ( cannot open shared object file: No such file or directory), /usr/lib/php/20190902//opt/datadog-php/extensions/ (/usr/lib/php/20190902//opt/datadog-php/extensions/ cannot open shared object file: No such file or directory)) in Unknown on line 0
### Failed enabling ddtrace extension

To make the installer work properly datadog-php-tracer should explicitly depend on:

  • php5-cli | php7.0-cli | php7.1-cli | php7.2-cli | php7.3-cli | php7.4-cli
  • libcurl4 (with proper version constraint, depends on used symbols)

Your package has no dependencies which is really a bad practice. :/


This comment has been minimized.

Copy link

@labbati labbati commented Jan 28, 2020

Hi @Majkl578, thanks for opening this issue. We are still looking into how to improve our installation script to cover more and more scenarios and you are pointing in the right direction. Just a few comments though:

  1. PHP installation. One popular way to install php (other than the default version) on debian is through the repo. E.g. like in the example below. I put this together in my l ocal env and it works as expected. Can you confirm that it works in your case?
FROM debian:buster-20191118-slim

# This part is really depends on the user env
RUN apt update
RUN apt install -y \
    wget \
    lsb-release \
    apt-transport-https \
RUN wget -O /etc/apt/trusted.gpg.d/php.gpg
RUN echo "deb $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list
RUN apt update
RUN apt -y install php7.4

# Install the tracer
RUN wget
RUN dpkg -i datadog-php-tracer_0.38.0_amd64.deb
  1. Dependency on phpX.Y: I am not an expert of deb vs rpm so I might need some help. How would we support in this case custom builds of php? Also how would be end up delivering our package for different php versions? E.g. dd-trace-php7.1 and ...? I am asking, again I am not super expert.

  2. Dependency on libcurl: we should better detect this and improve our installation script. We commit to improve it even if we have to push back this work a little bit as we currently have other priorities.


This comment has been minimized.

Copy link

@Majkl578 Majkl578 commented Feb 5, 2020


Can you confirm that it works in your case?

Yes, that's basically exactly what I do in my Docker script (more-or-less).

How would we support in this case custom builds of php?

The issue is that your .deb package uses php binary and as such it requires PHP to work. Normally PHP extension doesn't need explicit dependency on PHP. It only depends on php-common and specific PHP API it is built against (through virtual package called phpapi-<ABIVERSION>, e.g. phpapi-20180731).
In case of your package, you have two choices - you can provide extension packages for specific PHP versions dd-trace-php7.1 (I personally prefer this approach) or you can choose a simpler approach of providing all extension .so files in single dd-trace-php while depending on one of PHP APIs (that's what I outlined in my first message).
You can check how php-xdebug is packaged in Debian (for single PHP version) here:
You can inspect debian/control file of php-xdebug provided by here (download, open with ar x,
unpack control.tar.xz, open DEBIAN/control):

I have no experience with YUM-based packaging.

Dependency on libcurl: we should better detect this and improve our installation script.

Debian usually uses shlibs to detect correct versions for the debian/control file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.