Page 1 of 1

Statically linked like the official binary

Posted: Fri Nov 11, 2016 7:23 pm
by don
Hi,

I followed the build instructions in README.WINDOWS and successfully created binaries (1.10.0) with dynamically linked libraries. Thank you for great instructions.

I would like to be able to do the same but link the dependencies statically. The build instructions mention this is how the official binary release is built, however I cannot find the steps/scripts used to build it. Would you mind sharing?

Thanks!

Don

Re: Statically linked like the official binary

Posted: Sat Nov 12, 2016 2:38 am
by synchronicity
I assume you're talking about creating a libwim DLL with its third-party dependencies linked into it, as opposed to creating a libwim static library. I prepare the official Windows releases on Linux using the script tools/make-windows-release. As part of the process, libxml2 and winpthreads get downloaded, configured, and compiled as static libraries. You're of course free to use this too, but it's primarily for my own use so I'm not supporting it and you'd have to be willing to work through any problems you encounter. Alternatively is probably possible to put together some process in Cygwin. I have not done this and do not have directions to do so. If you are interested in doing so and documenting the process I'd be glad to consider adding it to the documentation!

Re: Statically linked like the official binary

Posted: Mon Nov 14, 2016 5:19 pm
by don
Yes, exactly. Basically the process of building the library (e.g. libwim-15.dll) on Windows where third-party libraries are statically linked. As requested, I've worked through the issues and have come up with steps that may be appropriate for inclusion in a future README.WINDOWS.

Additional Cygwin packages needed:
Archive > p7zip: A file archiver with very high compression ratios
Devel > nasm: The Netwide Assembler
Graphics > ghostscript: GPL PostScript interpreter (utilities)

To be added as a separate Cygwin terminal commands section for building statically linked library:
cd /cygdrive/c/Users/example/Downloads # (or wherever you downloaded the source to)
tar xf wimlib-1.10.0.tar.gz
[DISCLAIMER] The remaining commands assume the ./tools directory (and its contents), as well as the file ./build-aux/nasm_lt.sh exist in the source archive. As of 1.10.0 they do not. For now, simply download the tools directory and ./build-aux/nasm_lt.sh from the wimlib tree to the appropriate locations within your local wimlib tree (that you extracted in the previous command).[/DISCLAIMER]
cd ./wimlib-1.10.0/tools/windeps
make
cd ../..
./tools/make-windows-release x86_64

Enjoy!

Don

Re: Statically linked like the official binary

Posted: Tue Nov 15, 2016 1:41 am
by synchronicity
Great! I wasn't expecting tools/make-windows-release to work on Windows, but it looks like you got it working in Cygwin without too much trouble.

The absence of build-aux/nasm_lt.sh from the release tarball is a bug. I'll add it in the next version.

The absence of the tools directory is intentional, though maybe worth reconsidering if people besides me will start wanting to use stuff from it. An alternative would be to recommend cloning the git tree; then all the files would be included.

Re: Statically linked like the official binary

Posted: Thu Nov 17, 2016 7:40 am
by synchronicity
I went ahead and added directions to README.WINDOWS for running tools/make-windows-release, similar to what you suggested. I did make it say to clone the git repository, which avoids the missing files. For now I think it's reasonable for tools/ to be in the git repository only.

Thanks for the suggestion!