-
Notifications
You must be signed in to change notification settings - Fork 79
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
Building a static binary #288
Comments
Static linking is always a PITA, and I don't think this is a use case i'd like to officially support. I can make this work "by hand" though: Run configure with a lot of stuff disabled and add
Now linking fails, which seems to has to do with the order of the
Not that gcc does not fully agree and whines about things likely not working with a static build:
|
Shadab> I want to build a static binary of duc so that I can use it on
Shadab> remote linux boxes easily. I tried configure --enable-static
Shadab> --disable-shared and configure CFLAGS="-static" etc. but
Shadab> nothing works.
Hmm... can you send us the output of your config.log file and the
results of the compilation? These days static binaries are harder to
do. It might also be that you need to install some extra dev
libraries.
But more details on your system, what you're targeting, etc would be
helpful.
John
|
>>>> "Ico" == Ico Doornekamp ***@***.***> writes:
Ico> Static linking is always a PITA, and I don't think this is a use
Ico> case i'd like to officially support. I can make this work "by
Ico> hand" though:
Ico> Run configure with a lot of stuff disabled and add -static LDFLAG:
Ico> ./configure --disable-cairo --disable-x11 --disable-ui LDFLAGS="-static"
Ico> Now linking fails, which seems to has to do with the order of the
Ico> LDFLAGS passed to the compiler. I can make this work by running
Ico> the last command manually and adding -lpthread -lz -lbz2:
Ico> gcc -Isrc/libduc -Isrc/libduc-graph -Isrc/glad -g -O2 -static -lpthread -lz -o duc src/libduc/buffer.o src/libduc/db.o src/libduc/db-tokyo.o src/libduc/db-kyoto.o src/libduc/db-leveldb.o src/libduc/db-sqlite3.o src/libduc/db-lmdb.o src/libduc/dir.o src/libduc/duc.o src/libduc/index.o src/libduc/canonicalize.o src/libduc/varint.o src/glad/glad.o src/libduc-graph/graph.o src/libduc-graph/graph-cairo.o src/libduc-graph/graph-opengl.o src/libduc-graph/graph-svg.o src/libduc-graph/graph-html.o src/duc/cmd-cgi.o src/duc/cmd-graph.o src/duc/cmd-gui.o src/duc/cmd-guigl.o src/duc/cmd-index.o src/duc/cmd-info.o src/duc/cmd-ls.o src/duc/cmd-ui.o src/duc/cmd-xml.o src/duc/ducrc.o src/duc/main.o -ltokyocabinet -lm -lpthread -lz -lbz2
Ico> Not that gcc does not fully agree and whines about things likely
Ico> not working with a static build:
Ico> warning: Using 'getpwuid' in statically linked applications
Ico> requires at runtime the shared libraries from the glibc version
Ico> used for linking
This might be fixed (for some value of fixed) by maybe not using
getpduid, but I haven't looked at the code enough to know if this is
even possible.
But I also agree with Ico, static linking isn't really something we
target. It's easy enough these days to spin up a vagrant host to do
compiles for funky systems where things aren't new enough. But if you
spin up an older Debian system, it should work for alot of systems.
Finding the best base OS for your use case is something we can't help
with.
John
|
I want to build a static binary of
duc
so that I can use it on remote linux boxes easily.I tried
configure --enable-static --disable-shared
andconfigure CFLAGS="-static"
etc. but nothing works.Any ideas?
The text was updated successfully, but these errors were encountered: