PDA

View Full Version : How to generate "lmflex.so" file ?



flexnetnew
09-12-2018, 02:06 AM
Hi all,

I want to generate lmflex.so from lmflex.c. Recently, I can only generate lmflex.o by editing "makefile" file.


lmflex: $(SRCDIR)/lmflex.c $(SRCDIR)/lm_code.h $(CLIENTLIB) lm_new.o
$(MAKE) lm_new.o
$(CC) -c $(CFLAGS_PIE) $(CFLAGS) $(SRCDIR)/lmflex.c
$(CC) $(CFLAGS) $(LDFLAGS_PIE) $(LDFLAGS) -o lmflex lmflex.o lm_new.o $(CLIENTLIB) $(ACTSTUB) $(XTRALIB) \
$(THREADLIB)
rm lmflex.o => remove this line
$(STRIP) lmflex
rm -f lm_new.o

If I use this command to build .so file, it will give an error

Command:

gcc lmflex.o -shared -o lmflex.so

Error:

/usr/bin/ld: lmflex.o: relocation R_X86_64_32 against `lm_job' can not be used when making a shared object; recompile with -fPIC
lmflex.o: could not read symbols: Bad value
collect2: ld returned 1 exit status



Any ideas to solve this. Thank you !

Aparashar
09-14-2018, 01:02 AM
Hi

I believe the default FNP toolkit comes with compiler options for "-fpic" defined as "CFLAGS". You can use the CFLAGS during compiler time (through makefile) and get the pic version for object files.

Regards,
Abhay