How would I go about compiling mkclean with static libraries


ogi

Recommended Posts

So I'm not sure if this is the correct place for this post, so apologies in advance if I should have posted this elsewhere.

 

My question in short is, how would I go about compiling the mkclean with static libraries?  Longer explanation with some context below.

 

mkclean, is one of several tools that can be used to cleanup and optimize matroska based video containers.  They include some other utilities that are handy as well here: https://github.com/Matroska-Org/foundation-source

 

I thought I would attempt to use the mkclean binary package specifically as part of a post-processing script within a docker container.

 

With the assistance of the devpack plugin I was able to compile the matroska utilities from source.  The problem is that I cannot execute the binaries from within a docker container.  I suspect the reason that's not possible is due to dynamically linked libraries:

 

root@4bb49dcb91f6:/utils$ ldd mkclean
	/lib64/ld-linux-x86-64.so.2 (0x14d447b80000)
	libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x14d44782e000)
	libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x14d447b80000)
	libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x14d44761c000)
	libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x14d447b80000)
root@4bb49dcb91f6:/utils$ ls /lib64
ls: cannot access '/lib64': No such file or directory
root@4bb49dcb91f6:/utils$ ls /usr/lib64/
ls: cannot access '/usr/lib64/': No such file or directory
root@4bb49dcb91f6:/utils$ ls /lib64
ls: cannot access '/lib64': No such file or directory
root@4bb49dcb91f6:/utils$

Of course, from within unraid, the binary executes just fine.

 

So, I suppose this means I need to build mkclean (and the other binaries I want to use) from source, but with statically linked libraries; so how would I go about that?

 

Thanks!

Link to comment

After talking this over with some friends; I got help creating a custom docker build file:

 

```

FROM alpine

RUN apk add --update git build-base openssh
WORKDIR /app/
RUN git clone https://github.com/Matroska-Org/foundation-source.git
WORKDIR /app/foundation-source/
RUN gcc corec/tools/coremake/coremake.c -o coremake
RUN ./coremake gcc_linux_x64
RUN make -C spectool
RUN make -C mkvalidator
RUN make -C mkclean


FROM linuxserver/nzbget 

COPY --from=0 /app/foundation-source/release/gcc_linux_x64/mkclean /usr/bin/
```

 

I created a dockerhub repo in case anyone is curious or wants to try it out here:

 

https://hub.docker.com/r/j9ac9k/nzbget_mktools/

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.