Re: [Dar-support] Static dar build issues again
For full, incremental, compressed and encrypted backups or archives
Brought to you by:
edrusb
|
From: Denis C. <dar...@fr...> - 2022-01-19 18:56:42
|
Le 19/01/2022 à 15:36, Robin Atwood a écrit : > I am trying again to build a statically linked dar binary that I can > copy to a backup usb disk and execute from an arbitrary rescue system. > I have a Gentoo system but the dar ebuild does not bode well on the > subject of static builds so I checked-out the Github 2.7.x branch and > built that. I ended up with a 6MB+ binary which was promising since > normally it is about 500K. To check if it was completely self-contained > I moved the libdar libraries out of the library path and tested: another way to check is to use 'file <path/to/binary>', the size is just an indication and when you run to test you did, you must explicitely use the path to the binary you want to test. Moreover doing the way you did, you may assume a binary is to static because it ran once you have removed the dynamic library while another is used from a previous installation in another path (/usr/local/lib vs /usr/lib for example). > > # ../dar_static -l backup-FULL-1642269601 -v > ../dar_static: error while loading shared libraries: libdar64.so.6000: > cannot open shared object file: No such file or directory I never saw that before! obviously the file dar_static is not statically linked... how did you obtain it? Did you renamed a dar binary to dar_static? > > So even with a static build you still need the library modules? What is > the procedure for producing a dar module that works on, say, the > SysResCD system? The process to get a statically linked dar binary from its source code is first to have installed all the static flavors of the libraries you want dar to rely on, then run (for example): mkdir -p /tmp/test ./configure --prefix=/tmp/test Eventually add --disable-shared and --disable-build-html to speed up the process. Once ./configure has completed, check the end of the output to see whether everything is aligned to build a statically linked dar. Add any missing static library if needed and retry. Once all is OK from ./configure stand point, run make -j 4 Replace 4 by the number of CPU cores you have, or remove '-j 4' for single threaded compilation. Then run make install-strip This will strip the symbols from the binary and upx compress the binary if you had upx available at the time you ran the ./configure script. dar_static will be present in /tmp/test/bin once you have copied out dar_static you can cleanup the rest using rm -rf /tmp/test (assuming /tmp/test was not present initially). Cheers, Denis > > Thanks > Robin |