figgles@sunnyd:~$ cat test.c int main() { return 0; } figgles@sunnyd:~$ gcc -static test.c -o test figgles@sunnyd:~$ ./test figgles@sunnyd:~$
My empty program in 644KB static, 4.7KB dynamically linked. If you're getting that error below, it means you're mixing PIC and non PIC objects. I'd check to make sure everything is compiled with -fno-PIC / -static Patrick On Mon, Dec 3, 2012 at 4:36 PM, Yasir I. Al-Dosary - zgzg2020™ < yasiraldos...@yahoo.com> wrote: > Thanx for the reply. > I tried in GCC the -static flag, but I got the: > > relocation R_X86_64_32 can not be used when making a shared object; > recompile with -fPIC > error. That's why I added the -fPIC flag. > What's missing here? > > ------------------------------ > *From:* Patrick Baggett <baggett.patr...@gmail.com> > *To:* Yasir I. Al-Dosary - zgzg2020™ <yasiraldos...@yahoo.com>; Primary > ioquake3 Discussion/Development list <ioquake3@lists.ioquake.org> > *Sent:* Monday, December 3, 2012 11:21 PM > > *Subject:* Re: [ioquake3] How do I build ioquake3 with static libraries? > > -fPIC is for position independent code, which should not be necessary when > building an executable program (or at least, not explicitly). Also, for > GCC, I used "gcc -static" > > Patrick > > On Mon, Dec 3, 2012 at 4:55 AM, Yasir I. Al-Dosary - zgzg2020™ < > yasiraldos...@yahoo.com> wrote: > > Hi > > I would like to cross-compile ioquake3 with static libraries. I tried > -static and -fPIC, but got an error: > relocation R_X86_64_32 can not be used when making a shared object; > recompile with -fPIC > Then, I also tried -Bstatic, and NOSHARED=0, which didn't do anything. > What are the correct flags? > Mine: > make USE_LOCAL_HEADERS=0 CFLAGS='-fopenmp -Wall -D_GNU_SOURCE=1 > -D_REENTRANT' USE_VOIP=0 BUILD_CLIENT=0 BUILD_MISSIONPACK=0 BUILD_GAME_QVM=0 > > The story: > > After doing the cross-compiling, the library versions were different > between the cross-compiling machine, and the executing machine. > I don't have authority to up/downgrade any of the libraries. Furthermore, > I tried to build the glibc library, which took FOREVER. But, kept failing > because the GCC was too old. > Anyway to make a long story short, someone suggested that I should try to > statically cross-compile ioquake3, so that it would run regardless of the > version discrepancies. > Version error: > ./ioq3ded.sh4a: /lib/libc.so.6: version `GLIBC_2.11' not found (required > by ./ioq3ded.sh4a) > _______________________________________________ > ioquake3 mailing list > ioquake3@lists.ioquake.org > http://lists.ioquake.org/listinfo.cgi/ioquake3-ioquake.org > By sending this message I agree to love ioquake3 and libsdl. > > > > >
_______________________________________________ ioquake3 mailing list ioquake3@lists.ioquake.org http://lists.ioquake.org/listinfo.cgi/ioquake3-ioquake.org By sending this message I agree to love ioquake3 and libsdl.