[FreeBSD 10-3] undefined reference to getsourcefilter /setsourcefilter

Victor Toni victor.toni at gmail.com
Sun May 8 21:47:23 UTC 2016


Trying to port mcproxy to FreeBSD I encountered a quite strange problem.
Compiling everything works but linking fails with the following error:

$ c++ -v -Wl,-rpath,/usr/local/lib -pthread -o mcproxy main.o
 hamcast_logging.o  mc_socket.o  addr_storage.o  mroute_socket.o  if_prop.o
 reverse_path_filter.o  proxy.o  sender.o  receiver.o  mld_receiver.o
 igmp_receiver.o  mld_sender.o  igmp_sender.o  proxy_instance.o  routing.o
 worker.o  timing.o  check_if.o  check_kernel.o  membership_db.o  querier.o
 timers_values.o  interfaces.o  def.o  simple_mc_proxy_routing.o
 simple_routing_data.o  scanner.o  token.o  configuration.o  parser.o
 interface.o    -L/usr/local/lib -L/usr/lib -lpthread
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
Target: i386-unknown-freebsd10.3
Thread model: posix
Selected GCC installation:
 "/usr/bin/ld" --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1
--hash-style=both --enable-new-dtags -m elf_i386_fbsd -o mcproxy
/usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/local/lib
-L/usr/lib -L/usr/lib -rpath /usr/local/lib main.o hamcast_logging.o
mc_socket.o addr_storage.o mroute_socket.o if_prop.o reverse_path_filter.o
proxy.o sender.o receiver.o mld_receiver.o igmp_receiver.o mld_sender.o
igmp_sender.o proxy_instance.o routing.o worker.o timing.o check_if.o
check_kernel.o membership_db.o querier.o timers_values.o interfaces.o def.o
simple_mc_proxy_routing.o simple_routing_data.o scanner.o token.o
configuration.o parser.o interface.o -lpthread -lc++ -lm -lgcc --as-needed
-lgcc_s --no-as-needed -lpthread -lc -lgcc --as-needed -lgcc_s
--no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o
mc_socket.o: In function `mc_socket::set_source_filter(unsigned int,
addr_storage const&, unsigned int, std::__1::list<addr_storage,
std::__1::allocator<addr_storage> > const&) const':
src/utils/mc_socket.cpp:(.text+0x29cc): undefined reference to
`setsourcefilter(int, unsigned int, sockaddr*, unsigned int, unsigned int,
unsigned int, sockaddr_storage*)'
mc_socket.o: In function `mc_socket::get_source_filter(unsigned int,
addr_storage const&, unsigned int&, std::__1::list<addr_storage,
std::__1::allocator<addr_storage> >&) const':
src/utils/mc_socket.cpp:(.text+0x2c29): undefined reference to
`getsourcefilter(int, unsigned int, sockaddr*, unsigned int, unsigned int*,
unsigned int*, sockaddr_storage*)'
src/utils/mc_socket.cpp:(.text+0x2cae): undefined reference to
`getsourcefilter(int, unsigned int, sockaddr*, unsigned int, unsigned int*,
unsigned int*, sockaddr_storage*)'
c++: error: linker command failed with exit code 1 (use -v to see
invocation)

The methods should be found:

$ readelf -s /usr/lib/libc.a | grep etsourcefilter
    10: 00000600   392 FUNC    GLOBAL DEFAULT    1 getsourcefilter
    12: 00000290   305 FUNC    GLOBAL DEFAULT    1 setsourcefilter


What am I missing?


More information about the freebsd-net mailing list