threadhead
03-04-2006, 05:06 PM
hello!
i have multiple source files like 1.c, 2.c and 3.c where 1.c calls functions that lie in 2.c and 3.c.
some of the source files access the openssl library with function calls.
when i am compiling the package to a dynamically linked elf this is no problem:
gcc -c -o 1.o 1.c
gcc -c -o 2.o 2.c
gcc -c -o 3.o 3.c
gcc -lssl -o a.out 1.o 2.o 3.o
When i try the last step with static:
gcc -static -lssl -o a.out 1.o 2.o 3.o
i get lots of complaints about undefined references like:
: undefined reference to `RAND_status'
1.o(.text+0x13b): In function `prepare_openssl':
: undefined reference to `RAND_load_file'
1.o(.text+0x15d): In function `create_pem':
: undefined reference to `DH_new'
1.o(.text+0x195): In function `create_pem':
: undefined reference to `DH_generate_parameters'
...
...
so my question is, how i can compile this to a statically linked elf binary?
thanks in advance
i have multiple source files like 1.c, 2.c and 3.c where 1.c calls functions that lie in 2.c and 3.c.
some of the source files access the openssl library with function calls.
when i am compiling the package to a dynamically linked elf this is no problem:
gcc -c -o 1.o 1.c
gcc -c -o 2.o 2.c
gcc -c -o 3.o 3.c
gcc -lssl -o a.out 1.o 2.o 3.o
When i try the last step with static:
gcc -static -lssl -o a.out 1.o 2.o 3.o
i get lots of complaints about undefined references like:
: undefined reference to `RAND_status'
1.o(.text+0x13b): In function `prepare_openssl':
: undefined reference to `RAND_load_file'
1.o(.text+0x15d): In function `create_pem':
: undefined reference to `DH_new'
1.o(.text+0x195): In function `create_pem':
: undefined reference to `DH_generate_parameters'
...
...
so my question is, how i can compile this to a statically linked elf binary?
thanks in advance