On Jul 10, 2008, at 23:22, Simon Ruderich wrote:
I'm trying to compile lftp 3.7.3 on my Mac 10.4 Tiger but it fails
with the following error:
/usr/bin/ld: Undefined symbols: rpl_poll(pollfd*, unsigned long, int)
It's a C++ name decoration problem, trying to access a function in a C
library.
The chain of events as I understand:
1. poll is preprocessor redefined to be called rpl_poll, as Mac OS X
already comes with its own poll() system function, only it doesn't
work properly.
2. libgnu's lib/poll.c will then export its replacement poll()
function renamed to rpl_poll(), and exported to the libgnu library as
_rpl_poll since it's a plain C _cdecl function
3. lftp's src/PollVec.cc includes the same lib/poll.h header from
libgnu, but since it's compiled as C++, the exported poll() function
it's looking for ends up as __Z8rpl_pollP6pollfdmi
4. the linker in the end errors out, since __Z8rpl_pollP6pollfdmi
doesn't match _rpl_poll
The way I solved it for me is to edit
lib/poll.h
Find inside this one line:
extern int poll (struct pollfd *pfd, nfds_t nfd, int timeout);
And wrap it in an extern "C" block like this:
#ifdef __cplusplus
extern "C" {
#endif
extern int poll (struct pollfd *pfd, nfds_t nfd, int timeout);
#ifdef __cplusplus
}
#endif