Hello,<br><br>I have made an application in C++ using GMP, but I need it to be linked/compiled statically (needs to be run in a simulator called SimIt-ARM). I'm doing the cross-compilation to ARM in scratchbox (<a href="http://www.scratchbox.org">
http://www.scratchbox.org</a>). GMP has been compiled and installed in Scratchbox.<br><br>The command <br> g++ -lgmp -static -O3 -o rsa_keygen rsa_keygen.cpp<br>gives errors about undefined references to __gmpz_init, __gmpz_clear, ...
<br><br>[sbox-MYTARGET: ~/rsa] > g++ -lgmp -static -O3 -o rsa_keygen rsa_keygen.cpp<br>/tmp/cckdV8OI.o: In function `initializeGMP()':<br>rsa_keygen.cpp:(.text+0x8): undefined reference to `__gmpz_init'<br>rsa_keygen.cpp:(.text+0x10): undefined reference to `__gmpz_init'
<br>rsa_keygen.cpp:(.text+0x18): undefined reference to `__gmpz_init'<br>rsa_keygen.cpp:(.text+0x20): undefined reference to `__gmpz_init'<br>rsa_keygen.cpp:(.text+0x2c): undefined reference to `__gmpz_init'<br>
/tmp/cckdV8OI.o: In function `clearGMP()':<br>rsa_keygen.cpp:(.text+0x4c): undefined reference to `__gmpz_clear'<br>rsa_keygen.cpp:(.text+0x54): undefined reference to `__gmpz_clear'<br>rsa_keygen.cpp:(.text+0x5c): undefined reference to `__gmpz_clear'
<br>rsa_keygen.cpp:(.text+0x64): undefined reference to `__gmpz_clear'<br>rsa_keygen.cpp:(.text+0x70): undefined reference to `__gmpz_clear'<br>/tmp/cckdV8OI.o: In function `checkKeys()':<br>rsa_keygen.cpp:(.text+0x148): undefined reference to `__gmpz_set_str'
<br>rsa_keygen.cpp:(.text+0x158): undefined reference to `__gmpz_set_str'<br>rsa_keygen.cpp:(.text+0x168): undefined reference to `__gmpz_set_str'<br>/tmp/cckdV8OI.o: In function `generateKeys()':<br>rsa_keygen.cpp:(.text+0x24c): undefined reference to `__gmpz_init'
<br>rsa_keygen.cpp:(.text+0x254): undefined reference to `__gmpz_init'<br>rsa_keygen.cpp:(.text+0x2e8): undefined reference to `__gmpz_set_str'<br>rsa_keygen.cpp:(.text+0x2f8): undefined reference to `__gmpz_set_str'
<br>rsa_keygen.cpp:(.text+0x304): undefined reference to `__gmpz_nextprime'<br>rsa_keygen.cpp:(.text+0x310): undefined reference to `__gmpz_nextprime'<br>rsa_keygen.cpp:(.text+0x324): undefined reference to `__gmpz_get_str'
<br>rsa_keygen.cpp:(.text+0x338): undefined reference to `__gmpz_get_str'<br>rsa_keygen.cpp:(.text+0x348): undefined reference to `__gmpz_init'<br>rsa_keygen.cpp:(.text+0x364): undefined reference to `__gmpz_mul'
<br>rsa_keygen.cpp:(.text+0x374): undefined reference to `__gmpz_get_str'<br>rsa_keygen.cpp:(.text+0x380): undefined reference to `__gmpz_init'<br>rsa_keygen.cpp:(.text+0x388): undefined reference to `__gmpz_init'
<br>rsa_keygen.cpp:(.text+0x39c): undefined reference to `__gmpz_sub_ui'<br>rsa_keygen.cpp:(.text+0x3ac): undefined reference to `__gmpz_sub_ui'<br>rsa_keygen.cpp:(.text+0x3c8): undefined reference to `__gmpz_mul'
<br>rsa_keygen.cpp:(.text+0x3d0): undefined reference to `__gmpz_init'<br>rsa_keygen.cpp:(.text+0x3f0): undefined reference to `__gmpz_gcd_ui'<br>rsa_keygen.cpp:(.text+0x3fc): undefined reference to `__gmpz_cmp_ui'
<br>rsa_keygen.cpp:(.text+0x410): undefined reference to `__gmpz_set_ui'<br>rsa_keygen.cpp:(.text+0x420): undefined reference to `__gmpz_invert'<br>rsa_keygen.cpp:(.text+0x44c): undefined reference to `__gmpz_get_str'
<br>rsa_keygen.cpp:(.text+0x4e4): undefined reference to `__gmpz_clear'<br>rsa_keygen.cpp:(.text+0x4ec): undefined reference to `__gmpz_clear'<br>rsa_keygen.cpp:(.text+0x4f4): undefined reference to `__gmpz_clear'
<br>rsa_keygen.cpp:(.text+0x500): undefined reference to `__gmpz_clear'<br>rsa_keygen.cpp:(.text+0x508): undefined reference to `__gmpz_clear'<br>/tmp/cckdV8OI.o:rsa_keygen.cpp:(.text+0x510): more undefined references to `__gmpz_clear' follow
<br>/tmp/cckdV8OI.o: In function `main':<br>rsa_keygen.cpp:(.text+0x594): undefined reference to `__gmpz_init'<br>rsa_keygen.cpp:(.text+0x59c): undefined reference to `__gmpz_init'<br>rsa_keygen.cpp:(.text+0x5a4): undefined reference to `__gmpz_init'
<br>rsa_keygen.cpp:(.text+0x5ac): undefined reference to `__gmpz_init'<br>rsa_keygen.cpp:(.text+0x5b4): undefined reference to `__gmpz_init'<br>rsa_keygen.cpp:(.text+0x5c8): undefined reference to `__gmpz_clear'
<br>rsa_keygen.cpp:(.text+0x5d0): undefined reference to `__gmpz_clear'<br>rsa_keygen.cpp:(.text+0x5d8): undefined reference to `__gmpz_clear'<br>rsa_keygen.cpp:(.text+0x5e0): undefined reference to `__gmpz_clear'
<br>rsa_keygen.cpp:(.text+0x5e8): undefined reference to `__gmpz_clear'<br>collect2: ld returned 1 exit status<br><br>What is the correct command to get my binary statically linked?<br><br>Thanks,<br><br>Steven<br>