Creating a static build for CentOS 7?

Support for HandBrake on Linux, Solaris, and other Unix-like platforms
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
gesture
New User
Posts: 1
Joined: Tue May 09, 2017 12:49 pm

Creating a static build for CentOS 7?

Post by gesture »

Hello,
I was looking to put together a compiled form of HandBrakeCLI that could be used in a cluster where CentOS7 nodes are getting spun up and destroyed as needed. I figured that the easiest thing to do would be to create a single compiled executable, and make sure that got copied to every new instance.
However, after following the compile instructions (https://handbrake.fr/docs/en/latest/dev ... entos.html), throwing the compiled form onto a new CentOS image and trying to run it, I got the error message

Code: Select all

./HandBrakeCLI: error while loading shared libraries: libass.so.5: cannot open shared object file: No such file or directory
If I install libass-devel, I get a few more complaints about prerequisite libraries. After the dependencies are all installed, everything works fine.

It seems that for the CentOS 7 case, in order to run HandBrake, your machine must be equally ready to compile it from source. Is this the expected behavior?

Is there a way to build HandBrakeCLI such that I can just drop a single file, with no other dependencies, onto another machine and have it Just Work (tm)?

My confusion is perhaps arising from how I was able to do the thing that I want (drop a single executable in to a fresh install) with ffmpeg - maybe that's an exception and not a rule though.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: Creating a static build for CentOS 7?

Post by JohnAStebbins »

On Linux, several system libraries are used. If you install the static versions of this libraries instead of dynamic, it should link them statically. But in some cases, Linux distributions don't supply the static versions of libraries. I don't know if this is the case with CentOS, but if it is, you can force the build process to download and build a static version of these libraries. It requires some manual editing however. Have a look at the file make/include/main.defs. Look for

Code: Select all

ifneq (,$(filter $(BUILD.system),darwin cygwin mingw))
    MODULES += contrib/freetype
    MODULES += contrib/fribidi
    MODULES += contrib/harfbuzz
    MODULES += contrib/libxml2
    MODULES += contrib/libass
    MODULES += contrib/libogg
    MODULES += contrib/libvorbis
    MODULES += contrib/libopus
    MODULES += contrib/libtheora
    MODULES += contrib/libsamplerate
    MODULES += contrib/lame
    MODULES += contrib/x264
    MODULES += contrib/jansson
endif
If you remove the ifneq/endif, all those libraries will be downloaded and built instead of using system versions.
shoubam
Posts: 4
Joined: Tue Aug 21, 2018 9:24 am

Re: Creating a static build for CentOS 7?

Post by shoubam »

Any success building a static version? I would be interested in how you did it.
Post Reply