Link wxWidgets application statically and run on any linux distribution without missing any dependency files.
This tutorial inspired by article written by Tierra here, mentioned about linking with gtk and run on any linux. Also to show you how to make static linking to libstdc++ since various linux distribution will have different version of this library that could lead to error program to running.
Note: Remember that GTK is licensed under LGPL, which essentially means that
in order to link it to your application _statically_, your application
will have to be (L)GPL-licensed.
$ sudo mkdir -p /opt/wxWidgets
$ cd /opt/wxWidgets
$ wget http://ftp.wxwidgets.org/pub/3.0.2/wxWidgets-3.0.2.tar.bz2
$ tar -xapvf wxWidgets-3.0.2.tar.bz2
$ cd wxWidgets-3.0.2
$ mkdir -p build2/wx3.0.2u_static
$ cd build2/wx3.0.2u_static
$ ../../configure --disable-shared --with-gtk --with-libtiff=builtin --with-libjpeg=builtin --with-libpng=builtin --with-regex=builtin --with-zlib=builtin --with-expat=builtin LDFLAGS="-static-libgcc -static-libstdc++"
$ make
Note: using similar switch as shown at autoconf above , you may also build/compile any Plain C/C++ application to link statically.
0 comments:
Post a Comment