mkulke/ftplibpp

compile error on ubuntu server 14.02 version

Closed this issue · 3 comments

rocky@rocky-VirtualBox:~/code/DevelopEnv/ftplibpp$ make
cc -shared -Wl,-install_name,libftp.so.2 -lssl -lc -o libftp.so.2.0 ftplib.o
/usr/bin/ld: bad -rpath option
collect2: error: ld returned 1 exit status
make: *** [libftp.so.2.0] Error 1

ftplibpp  make
cc -c -Wall -I. -fPIC -D_REENTRANT ftplib.cpp -o ftplib.o
ftplib.cpp: In member function ‘int ftplib::FtpOpenPort(ftphandle_, ftphandle__, ftplib::transfermode, int, char_)’:
ftplib.cpp:783:47: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘off64_t {aka long int}’ [-Wformat=]
sprintf(buf,"REST %lld", mp_ftphandle->offset);
^
ftplib.cpp: In member function ‘int ftplib::FtpOpenPasv(ftphandle_, ftphandle__, ftplib::transfermode, int, char_)’:
ftplib.cpp:887:47: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘off64_t {aka long int}’ [-Wformat=]
sprintf(buf,"REST %lld",mp_ftphandle->offset);
^
ftplib.cpp: In member function ‘int ftplib::FtpXfer(const char_, const char_, ftphandle_, ftplib::accesstype, ftplib::transfermode)’:
ftplib.cpp:1197:6: warning: variable ‘rv’ set but not used [-Wunused-but-set-variable]
int rv=1; // 3.1-1
^
ar -rcs libftp++.a ftplib.o
cc -shared -Wl,-install_name,libftp.so.2 -lssl -lc -o libftp.so.2.0 ftplib.o
/usr/bin/ld: unrecognised option: -install_name
collect2: error: ld returned 1 exit status
Makefile:56: recipe for target 'libftp.so.2.0' failed
make: *_* [libftp.so.2.0] Error 1

Change below code in Makefile on line 55
from
$(CC) -shared -Wl,-install_name,libftp.so.$(SONAME) $(LIBS) -lc -o $@ $<
to
$(CC) -shared -Wl,-soname,libftp.so.$(SONAME) $(LIBS) -lc -o $@ $<
will resolve redanium's problem. I've tested on UBUNTU 17.04

thank you for the fix