Preventing the python and ffmpeg heroku buildpacks from overwriting LD_LIBRARY_PATH

I'm deployng a Django app to heroku, which requires ffmpeg. To accomplish this I am using heroku-buildpack-multi to install both heroku-buildpack-ffmpeg and heroku-buildpack-python, and all of that works fine. The problem is my that app also depends on django-pylibmc-sasl, python-memcached, pylibmc et al. which, as per usual, heroku senses and automatically installs libmemcached for me.

Here's where something goes a little wrong. If I remove the custom buildpack everything runs fine (except for ffmpeg obviously). As soon as I add it in, however, while I can run ffmpeg, python fails on import pylibmc (or rather on import _pylibmc inside the module itself). After a amount of head-scratching I decided to have a look at the environment variables, here's what I got:

With only the Python buildpack enabled:

LD_LIBRARY_PATH=/app/.heroku/vendor/lib

With both the Python and the ffmpeg buildpacks enabled:

LD_LIBRARY_PATH=:vendor/ffmpeg/lib

It looks like one or both of the buildpacks simply overwrites the other, or avoids setting the variable should it be already set. The ffmpeg buildpack seems to set LD_LIBRARY_PATH in a way that looks kosher to me, while the Python buildpack does a few things that I don't really understand the reason for.

Solution

Anyway, after manually overriding the library path using heroku config:set LD_LIBRARY_PATH=/app/.heroku/vendor/lib:vendor/ffmpeg/lib I am able to use both libmemcached and ffmpeg, but it doesn't feel too robust. What if something changes in one of the buildpacks path settings, or I add another buildpack - then I would have to manually edit the library path variable.

Better solution?

So, while this is not really an urgent question at all, I simply would like to know:

  • Is there a better way of solving this issue?
  • Might I have made some configuration error leading up to the path conflict?
  • Should this be considered a bug in either of the buildpacks?

Answers


From a quick glance at the code this may be an issue with heroku-buildpack-python. Look at your ~/.profile (heroku run bash) and look where LD_LIBRARY_PATH is set. My guess is you'll see ffmpeg's first, and then see Python's setting overriding it.

If that's the case you should file a bug.


Need Your Help

AS3: Enable features according to Flash Player Version

actionscript-3 actionscript version flash-player detection

I'd like to know if it is possible to enable/disable some piece of code according to Flash Player version in ActionScript 3.

Spring with remote DB. How to minimize network delay overhead?

java mysql spring remote-server

I have 2 servers, one with a Java app using Spring for DB connection handling, and the other with MySQL.