From owner-freebsd-net@freebsd.org Sun May 8 21:47:23 2016 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 36BB3B32AC6 for ; Sun, 8 May 2016 21:47:23 +0000 (UTC) (envelope-from victor.toni@gmail.com) Received: from mail-lf0-x232.google.com (mail-lf0-x232.google.com [IPv6:2a00:1450:4010:c07::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9E9FF1FA0 for ; Sun, 8 May 2016 21:47:22 +0000 (UTC) (envelope-from victor.toni@gmail.com) Received: by mail-lf0-x232.google.com with SMTP id u64so182314053lff.3 for ; Sun, 08 May 2016 14:47:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=dKqIbRU0yfqhym4+FLRBzBFc89q5tZnj/qLXnreKVTg=; b=BnpKsmhBm4/WJh6vRDgXvxcx5cquN6Bd3t9UEdaiP7zPpefvP0P7ehJM+O1lAuNs1n csjsVzqLbQuZKAAEyiUuDICZNoRgMzc1s7igJZUxnxw8wx/TDM1bzfme1o8ZyTdHn9cH 7/VcolSuTLSnX8NufP1JH1/rLWldXIu6+a3jiGm+OLGK4tx9zvO2BZ1D5ppdmqcr4PO7 qJr4n5MC/+PHxOE99aMvrmCXM5A15iUZq2irk9NFiNkf++zy9BZw+vEuQPxNRh5Am41b GwaXvlySajQoIFFIn0EwRpHtdF2lS683DEKdwFVZ9Z2pssRw4wx+r6yhvnXE7ORnL+4s i52g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=dKqIbRU0yfqhym4+FLRBzBFc89q5tZnj/qLXnreKVTg=; b=OC+7f2quQJ1uM5thcfGRrCDTLU+oB7YmTziwFMDPHabZJnWfIwDS6Vz9zXeL+iEedn b0AWRvGnyTG9BwpkPY5FWzk/hBjIlgN0+kpY7L3UhTmvZseJA2miKNkxeoLoFiZ11+w+ uqpE+qc0emEWBu66hVoGP8scPHHH7N0N4wndDoM+SkocJlz9e8jpZ4eaZpPWZLR8lt0+ vl4hSmvLIhDpPd0j1ioIX2pDmjngCbW/tw8l9hCifKqgKq7BYZqGezAgQu2Qfxu6zEEU gmDY87ACo+Jek/JwlNcNTP1SX/iRF5v8lk5qBinA2lf9b01w40kg9Thb8wOEs2AOuGJW r0fg== X-Gm-Message-State: AOPr4FWcWbwbkT/HGJZ26q+q1GYh1aFN92bbrMgLsiiGxOBw9/iR7lbSNskEUgeF6kRV0BBtyywGXuf9AdoPxg== X-Received: by 10.25.143.16 with SMTP id r16mr14175085lfd.59.1462744040735; Sun, 08 May 2016 14:47:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.112.20.194 with HTTP; Sun, 8 May 2016 14:46:51 -0700 (PDT) From: Victor Toni Date: Sun, 8 May 2016 23:46:51 +0200 Message-ID: Subject: [FreeBSD 10-3] undefined reference to getsourcefilter /setsourcefilter To: freebsd-net@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2016 21:47:23 -0000 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 > 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 >&) 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?