On Thu, Apr 9, 2015 at 10:46 AM, Paul Moore <[email protected]> wrote: > On 9 April 2015 at 00:40, David Macek <[email protected]> wrote: >> Since the way to make static builds differs between build systems, maybe >> it'd be good to work with an example. > > Do you mean an example of how I build things at the moment, or what > I'm looking for? I suppose it's probably easiest if I give both :-) > > At the moment, in order to build (say) libarchive (bsdtar), what I > need to do is: > > Create a new /win64 directory (so I don't accidentally pick up > existing dynamic builds) > Download and unpack libiconv > Run > export CFLAGS="-I/win64/include" > export CPPFLAGS="-I/win64/include" > export LDFLAGS="-L/win64/lib" > ./configure --prefix=/win64 --build=x86_64-w64-mingw32 --disable-shared > make install > > Repeat for zlib, bzip2, gzip, xz, lzo, libxml2, libarchive > > My build process also includes gmp, mpfr, libidn, openssl, and pcre, > but these may be for other builds - wget for example uses a lot of > dependencies. I haven't sorted out precisely what depends on what, or > an exact build order to create minimal dependencies, as frankly it's > too much work :-( > > What I'd like to do is to grab > https://github.com/Alexpux/MINGW-packages, go into the > mingw-w64-libarchive subdirectory, and run makepkg-mingw, possibly > with some command line options or environment variables set to say > "use static versions of any dependencies". > > Having to build (and potentially port) huge numbers of support > libraries, when msys2 already provides static builds of them, seems > like a huge waste of time to me :-( > > I hope that clarifies what I'm asking. > >> In the meantime you can check out the man pages of gcc and ld for -static >> and -Bstatic and docs for libtool for --enable-static. Maybe they'll help. > > That's more or less where I got the above process from. The variations > on -static, -Bstatic and --enable-static that I tried never seemed to > work - no matter what I tried, the build always seemed to prefer a > dynamic link if it was available. Some articles I found on > stackoverflow essentially said that the only way to avoid dynamic > linking is never to build the dynamic versions of the libraries. Which > seems to me to defeat the object of building both, and having libtool > to manage them, but I don't have enough experience with the Unix > toolset to contradict what I was told.
To follow on up David's email, From: http://www.gnu.org/software/libtool/manual/html_node/Static-libraries.html "Another common situation where static linking is desirable is in creating a standalone binary. Use libtool to do the linking and add the -all-static flag." When Alexey made pacman as-static-as-possible, he added the following to AM_LDFLAGS for executables: AM_LDFLAGS = -Wc,--static -Wc,-static-libgcc From: http://www.gnu.org/software/libtool/manual/libtool.html "-Wc,flag Pass a flag directly to the compiler. With -Wc,, multiple flags may be separated by commas, whereas -Xcompiler passes through commas unchanged" .. I have started a project on github to host templates of lots of different build systems doing static and shared library linking and I've not yet figured out how to convince autotools to use -all-static with libtool, maybe it's not possible, I'd like to think it is though. Alternatively, you could use pacman to install all packages containing static libraries that your stuff depends on (or just the top level thing itself, e.g. our mingw64/mingw-w64-x86_64-libarchive, but in some instances, -devel packages could be needed too) to a different sysroot (pacman --root=/win64 option), then remove all the .dlls and .dll.a (command would be: find /win64 -name "*.dll*" -exec rm {} \;), then configure bsdtar/libarchive pointing to /win64. If you discover that any of our packages don't have static libraries then please raise a bug on github. Best regards, Ray. > > Thanks, > Paul > > ------------------------------------------------------------------------------ > BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT > Develop your own process in accordance with the BPMN 2 standard > Learn Process modeling best practices with Bonita BPM through live exercises > http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ > source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF > _______________________________________________ > Msys2-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/msys2-users ------------------------------------------------------------------------------ BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT Develop your own process in accordance with the BPMN 2 standard Learn Process modeling best practices with Bonita BPM through live exercises http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF _______________________________________________ Msys2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/msys2-users
