I decided it would be a fun side project to do some work on tsocks, since it hasn't seen any updates in 8 years. It's hosted here on GitHub.
I only made cosmetic changes to the code so far, but now I've run into a compiler error. According to dlopen(3)
:
The obsolete symbols _init() and _fini()
[...]
Using these routines [...] is not recommended. Their use may result in undesired behavior, since the constructor/destructor routines will not be executed (unless special measures are taken).
Instead, libraries should export routines using the __attribute__((constructor)) and __attribute__((destructor)) function attributes.
Unfortunately, this change (commit f785c8e) seems to be the source of the compiler error:
gcc -fPIC -g -O2 -Wall -I. -c tsocks.c -o tsocks.o
gcc -fPIC -g -O2 -Wall -I. -c common.c -o common.o
gcc -fPIC -g -O2 -Wall -I. -c parser.c -o parser.o
gcc -fPIC -g -O2 -Wall -I. -static -o saveme saveme.c
gcc -fPIC -g -O2 -Wall -I. -o inspectsocks inspectsocks.c common.o -lc
gcc -fPIC -g -O2 -Wall -I. -o validateconf validateconf.c common.o parser.o -lc
gcc -fPIC -g -O2 -Wall -I. -o libtsocks.so.1.8 tsocks.o common.o parser.o -ldl -lc -rdynamic
/usr/lib/gcc/i686-redhat-linux/4.4.4/../../../crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status
Can anyone help me? I'm stumped.