Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Packages are extracted but not configured #35

Open
tilgovi opened this issue Aug 15, 2018 · 4 comments
Open

Packages are extracted but not configured #35

tilgovi opened this issue Aug 15, 2018 · 4 comments

Comments

@tilgovi
Copy link

tilgovi commented Aug 15, 2018

The compile script uses dpkg -x to extract the packages, but this results in post-installation steps not being run. I suspect this is the cause of some of the LD_LIBRARY_PATH issues that have been opened.

In a recent investigation, we determined that a problem for our application was that some libraries were being installed but no symlink in /app/.apt/usr/lib created for them because these symlinks are created only when dpkg --configure is run.

Unfortunately, this opens some new questions. Since configuration of a package might run post-installation steps, the paths need to be the same as they would be for a regular installation. The only way I can think to do that would be to run in a chroot. However, we wouldn't want to debootstrap a full base system into the slug. We would probably want things like the alternatives system to exist.

There may be no easy way to resolve this, but I thought it best to open an issue to share the knowledge gained by struggling with our application.

@tilgovi
Copy link
Author

tilgovi commented Aug 15, 2018

Here's an example of a rails initializer we just added to our application to address the issue we encountered:

if Rails.env.production? || Rails.env.staging?
  ENV['GDAL_DATA'] = ".apt/usr/share/gdal/2.1"
  # heroku-buildpack-apt does not run postinstall scripts
  ENV['LD_LIBRARY_PATH'] = ".apt/usr/lib/libblas:.apt/usr/lib/lapack:#{ENV['LD_LIBRARY_PATH']}"
end

Typically, there is a symlink chain: /usr/lib/liblapack.so -> /etc/alternatives/liblapack.so -> /usr/lib/lapack/liblapack.so. That chain would normally be set up by the postint step of the liblapack3 package, but that is not run under heroku-buildpack-apt.

@lazyatom
Copy link

I suspect this also relates to #27, and perhaps even #37; in my own experience, installing ffmpeg left many linked libraries unfindable (because they were in /app/.apt/lib, or /app/.apt/usr/lib/x86_64-linux-gnu/mesa, or so on). Is there a chance that all of these issues are related, and would be solved if the packages were also configured and symlinks created?

@dyakovlev
Copy link

It is likely that all of these issues have the same root cause, yes.

@kmewhort
Copy link

Just a note for anyone hitting issues on Heroku: you'll also need to set require: false in your Gemfile for the gem, or when Heroku tries the "Detecting rake tasks" step in its Ruby buildpack, it'll error out that it can't find libCbcSolver.so.3.

Adding /app/.apt/usr/lib/x86_64-linux-gnu to LD_LIBRARY_PATH isn't sufficient, as at this point in the build pack /app/.apt doesn't exist yet. It seems the apt-buildpack, even though it builds first, doesn't get copied over until later.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants