osm0sis
Senior Recognized Developer / Contributor
If you wish to compile xz statically then the following example will do the trick. It's so SIMPLE I about fell out of my seat. Pay attention to what I have in bold:
./configure --build=arm --host=arm-linux-androideabi LDFLAGS="-static"
Then, when you go to run, make, just do the following:
make LDFLAGS=-all-static
Update:
After some tests with @osm0sis we learned that using configure will ultimately overwrite the original flags ordained by the source. Running the configure normally then applying your flags using "+=" will insure the ordained flags do not get overwritten as well as including your own additional flags. This will ultimately be up to the user what they want to do and their ultimate goal at the end of the day.
--- Happy Hunting!!
Can't wait to try that out in the morning. You've just fixed static NDK compiling on anything using Autotools, bro!
Let me know how it works out for you. I tried this method on my phone too and it worked like a champ
Yup works great! The key is this: You can't add -all-static via ./configure since it'll fail the working compiler test for some reason, but overriding the LDFLAGS on the make command-line works perfectly where even an exported environment variable doesn't. Stroke of genius to force a true static compile by @Modding.MyMind!
There's nothing important by default in the LDFLAGS so really all you need to worry about is overriding your own LDFLAGS you may have added with ./configure, and that can be resolved most definitely by adding them in on the make command-line as well (since my tests with += on Cygwin weren't successful). :good:
So to summarize, all you really need to do is:
Code:
./configure --host=<toolchain> --enable-static --disable-shared LDFLAGS=-static
cd src
make LDFLAGS=-all-static
(I've also got some workarounds in place to make it all work nicely on Cygwin, which can be found in my build script post.)
Last edited: