the-tcpdump-group / libpcap

the LIBpcap interface to various kernel packet capture mechanism
https://www.tcpdump.org/
Other
2.7k stars 851 forks source link

Building fails on macOS #760

Closed seanren96 closed 5 years ago

seanren96 commented 6 years ago

I am stuck at installation, I am using Mac OS. Here is my steps please let me if i am doing it wrong:) :

  1. Clone source code to my Mac.
  2. cd to the lib directory.
  3. run ./configure which seems fine screen shot 2018-09-18 at 5 39 25 pm
  4. run make seems something happenning here screen shot 2018-09-18 at 5 40 18 pm

To report a security issue please send an e-mail to security@tcpdump.org.

To report bugs and other problems, contribute patches, request a feature, provide generic feedback etc please see the file CONTRIBUTING in the libpcap source tree root.

guyharris commented 6 years ago

Please copy and paste - as text, NOT as a screenshot - the entire output of the make command.

seanren96 commented 6 years ago

Thank you for you response. rm -f libpcap.dylib VER=cat ./VERSION; \ MAJOR_VER=A; \ COMPAT_VER=1; \ CURRENT_VER=`sed 's/[^0-9.].$//' ./VERSION`; \ gcc -dynamiclib -undefined error -arch x86_64 -arch i386 \ -o libpcap.$VER.dylib pcap-bpf.o fad-getad.o pcap.o gencode.o optimize.o nametoaddr.o etherent.o fmtutils.o savefile.o sf-pcap.o sf-pcapng.o pcap-common.o bpf_image.o bpf_filter.o bpf_dump.o scanner.o grammar.o \ -install_name /usr/local/lib/libpcap.$MAJOR_VER.dylib \ -compatibility_version $COMPAT_VER \ -current_version $CURRENT_VER ld: warning: The i386 architecture is deprecated for macOS (remove from the Xcode build setting: ARCHS) ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd, missing required architecture i386 in file /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd Undefined symbols for architecture i386: "DefaultRuneLocale", referenced from: _pcap_ether_aton in nametoaddr.o _pcap_next_etherent in etherent.o _pcap_lex in scanner.o _pcap_ether_aton in nametoaddr.o _pcap_next_etherent in etherent.o _pcap_lex in scanner.o _pcap_ether_aton in nametoaddr.o _pcap_next_etherent in etherent.o _pcap_lex in scanner.o "_bzero", referenced from: _pcap_create_common in pcap.o _pcap_open_offline_common in pcap.o _pcap_open_dead_with_tstamp_precision in pcap.o _pcap_open_dead in pcap.o _newchunk in gencode.o _pcap_compile in gencode.o _genprotochain in gencode.o ... "error", referenced from: _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _check_bpf_bindable in pcap-bpf.o _get_if_flags in pcap-bpf.o _bpf_open in pcap-bpf.o _get_dlt_list in pcap-bpf.o _check_setiffailure in pcap-bpf.o ... "maskrune", referenced from: _pcap_ether_aton in nametoaddr.o _pcap_next_etherent in etherent.o _pcap_lex in scanner.o "_memset_chk", referenced from: _gen_mcode6 in gencode.o "___snprintf_chk", referenced from: _pcap_activate_bpf in pcap-bpf.o _bpf_open in pcap-bpf.o _pcap_read_bpf in pcap-bpf.o _pcap_setdirection_bpf in pcap-bpf.o _pcap_lookupnet in pcap.o _pcap_check_activated in pcap.o _pcap_setsnaplen in pcap.o ... "stack_chk_fail", referenced from: _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _check_bpf_bindable in pcap-bpf.o _get_if_flags in pcap-bpf.o _bpf_open in pcap-bpf.o _check_setif_failure in pcap-bpf.o _bpf_open_and_bind in pcap-bpf.o ... "_stack_chk_guard", referenced from: _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _check_bpf_bindable in pcap-bpf.o _get_if_flags in pcap-bpf.o _bpf_open in pcap-bpf.o _check_setif_failure in pcap-bpf.o _bpf_open_and_bind in pcap-bpf.o ... _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _check_bpf_bindable in pcap-bpf.o _get_if_flags in pcap-bpf.o _bpf_open in pcap-bpf.o _check_setif_failure in pcap-bpf.o _bpf_open_and_bind in pcap-bpf.o ... _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _check_bpf_bindable in pcap-bpf.o _get_if_flags in pcap-bpf.o _bpf_open in pcap-bpf.o _check_setif_failure in pcap-bpf.o _bpf_open_and_bind in pcap-bpf.o ... _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _check_bpf_bindable in pcap-bpf.o _get_if_flags in pcap-bpf.o _bpf_open in pcap-bpf.o _check_setif_failure in pcap-bpf.o _bpf_open_and_bind in pcap-bpf.o ... _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _check_bpf_bindable in pcap-bpf.o _get_if_flags in pcap-bpf.o _bpf_open in pcap-bpf.o _check_setif_failure in pcap-bpf.o _bpf_open_and_bind in pcap-bpf.o ... _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _check_bpf_bindable in pcap-bpf.o _get_if_flags in pcap-bpf.o _bpf_open in pcap-bpf.o _check_setif_failure in pcap-bpf.o _bpf_open_and_bind in pcap-bpf.o ... _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _check_bpf_bindable in pcap-bpf.o _get_if_flags in pcap-bpf.o _bpf_open in pcap-bpf.o _check_setif_failure in pcap-bpf.o _bpf_open_and_bind in pcap-bpf.o ... ... "___stderrp", referenced from: _pcap_perror in pcap.o _yy_fatal_error in scanner.o _pcap_perror in pcap.o _yy_fatalerror in scanner.o "stdinp", referenced from: _sf_cleanup in savefile.o _pcap_open_offline_with_tstamp_precision in savefile.o _pcap_lex in scanner.o _sf_cleanup in savefile.o _pcap_open_offline_with_tstamp_precision in savefile.o _pcap_lex in scanner.o "_stdoutp", referenced from: _pcap_dump_open in sf-pcap.o _pcap_dump_fopen in sf-pcap.o _pcap_dump_open_append in sf-pcap.o _pcap_lex in scanner.o _pcap_dump_open in sf-pcap.o _pcap_dump_fopen in sf-pcap.o _pcap_dump_open_append in sf-pcap.o _pcaplex in scanner.o "strcat_chk", referenced from: _pcap_activate_bpf in pcap-bpf.o _check_bpf_bindable in pcap-bpf.o "_strlcat_chk", referenced from: _pcap_can_set_rfmon_bpf in pcap-bpf.o _check_setif_failure in pcap-bpf.o "___strlcpy_chk", referenced from: _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _check_setif_failure in pcap-bpf.o _pcap_lookupdev in pcap.o _pcap_lookupnet in pcap.o _pcap_getnonblock in pcap.o _pcapsetnonblock in pcap.o ... "udivdi3", referenced from: _add_interface in sf-pcapng.o _pcap_ng_next_packet in sf-pcapng.o "_vsnprintf_chk", referenced from: _bpf_error in gencode.o _pcap_fmt_errmsg_for_errno in fmtutils.o "_abort", referenced from: _gen_atmtype_abbrev in gencode.o _gen_load_a in gencode.o _gen_proto_abbrev in gencode.o _gen_proto in gencode.o _gen_linktype in gencode.o _gen_portop in gencode.o _gen_portop6 in gencode.o ... "_atexit", referenced from: _pcap_do_addexit in pcap.o "_atoi", referenced from: _get_figure_of_merit in pcap.o (maybe you meant: _pcap_atoin) "_calloc", referenced from: _pcap_list_tstamp_types in pcap.o _pcap_list_datalinks in pcap.o _bpf_optimize in optimize.o _convert_code_r in optimize.o "_clearerr", referenced from: _pcap_lex in scanner.o "_close$UNIX2003", referenced from: _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _check_bpf_bindable in pcap-bpf.o _get_if_flags in pcap-bpf.o _check_setif_failure in pcap-bpf.o _bpf_open_and_bind in pcap-bpf.o _pcap_lookupnet in pcap.o ... "_ether_hostton", referenced from: _pcap_ether_hostton in nametoaddr.o (maybe you meant: _pcap_ether_hostton) "_exit", referenced from: _yy_fatal_error in scanner.o "_fclose", referenced from: _sf_cleanup in savefile.o _pcap_open_offline_with_tstamp_precision in savefile.o _pcap_dump_open in sf-pcap.o _pcap_dump_fopen in sf-pcap.o _pcap_dump_open_append in sf-pcap.o _pcap_dump_close in sf-pcap.o "_fcntl$UNIX2003", referenced from: _pcap_getnonblock_fd in pcap.o _pcap_setnonblock_fd in pcap.o "_feof", referenced from: _pcap_dump_open_append in sf-pcap.o "_ferror", referenced from: _pcap_fopen_offline_with_tstamp_precision in savefile.o _pcap_check_header in sf-pcap.o _pcap_next_packet in sf-pcap.o _pcap_dump_open_append in sf-pcap.o _pcap_ng_check_header in sf-pcapng.o _read_block in sf-pcapng.o _pcap_lex in scanner.o ... "_fflush", referenced from: _pcap_dump_flush in sf-pcap.o "_fileno", referenced from: _pcap_fopen_offline_with_tstamp_precision in savefile.o (maybe you meant: _pcap_fileno) "_fopen$UNIX2003", referenced from: _pcap_open_offline_with_tstamp_precision in savefile.o _pcap_dump_open in sf-pcap.o _pcap_dump_open_append in sf-pcap.o "_fprintf", referenced from: _pcap_perror in pcap.o _yy_fatal_error in scanner.o "_fread", referenced from: _pcap_fopen_offline_with_tstamp_precision in savefile.o _pcap_check_header in sf-pcap.o _pcap_next_packet in sf-pcap.o _pcap_dump_open_append in sf-pcap.o _pcap_ng_check_header in sf-pcapng.o _read_block in sf-pcapng.o _pcap_lex in scanner.o ... "_free", referenced from: _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _check_bpf_bindable in pcap-bpf.o _get_dlt_list in pcap-bpf.o _pcap_cleanup_bpf in pcap-bpf.o _pcap_free_tstamp_types in pcap.o _pcap_freealldevs in pcap.o ... (maybe you meant: _pcap_free, _pcap_free_tstamp_types , _pcap_free_datalinks , _pcap_freecode , _pcap_freealldevs ) "_freeaddrinfo", referenced from: _pcap_compile in gencode.o _gen_scode in gencode.o _gen_mcode6 in gencode.o _pcap_nametoport in nametoaddr.o _pcap_lex in scanner.o "_freeifaddrs", referenced from: _pcap_findalldevs_interfaces in fad-getad.o "_fseek", referenced from: _pcap_dump_open_append in sf-pcap.o "_ftell", referenced from: _pcap_dump_ftell in sf-pcap.o (maybe you meant: _pcap_dump_ftell, _pcap_dump_ftell64 ) "_ftello", referenced from: _pcap_dump_ftell64 in sf-pcap.o "_fwrite$UNIX2003", referenced from: _pcap_dump in sf-pcap.o _pcap_dump_open in sf-pcap.o _pcap_dump_fopen in sf-pcap.o _pcap_dump_open_append in sf-pcap.o _pcap_lex in scanner.o "_getaddrinfo", referenced from: _pcap_nametoaddrinfo in nametoaddr.o _pcap_nametoport in nametoaddr.o _pcap_lex in scanner.o "_getc", referenced from: _pcap_next_etherent in etherent.o _pcap_lex in scanner.o "_gethostbyname", referenced from: _pcap_nametoaddr in nametoaddr.o "_getifaddrs", referenced from: _pcap_findalldevs_interfaces in fad-getad.o "_getnetbyname", referenced from: _pcap_nametonetaddr in nametoaddr.o "_getprotobyname", referenced from: _pcap_nametoproto in nametoaddr.o "_ioctl", referenced from: _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _get_if_flags in pcap-bpf.o _get_dlt_list in pcap-bpf.o _check_setif_failure in pcap-bpf.o _pcap_inject_bpf in pcap-bpf.o _pcap_setfilter_bpf in pcap-bpf.o ... "_longjmp", referenced from: _bpf_error in gencode.o "_malloc", referenced from: _pcap_activate_bpf in pcap-bpf.o _check_bpf_bindable in pcap-bpf.o _get_dlt_list in pcap-bpf.o _add_addr_to_dev in pcap.o _add_dev in pcap.o _pcap_create_common in pcap.o _pcap_open_offline_common in pcap.o ... "_memcpy", referenced from: _pcap_list_tstamp_types in pcap.o _add_addr_to_dev in pcap.o _pcap_list_datalinks in pcap.o _opt_loop in optimize.o _install_bpf_program in optimize.o _pcapscan_string in scanner.o _pcap__scan_bytes in scanner.o ... "_memset", referenced from: _opt_loop in optimize.o "_open$UNIX2003", referenced from: _bpf_open in pcap-bpf.o "_printf", referenced from: _bpf_dump in bpf_dump.o "_puts", referenced from: _bpf_dump in bpf_dump.o "_read$UNIX2003", referenced from: _pcap_read_bpf in pcap-bpf.o "_realloc", referenced from: _pcap_next_packet in sf-pcap.o _read_block in sf-pcapng.o _add_interface in sf-pcapng.o _pcap_lex in scanner.o _pcap_ensure_buffer_stack in scanner.o _pcap_realloc in scanner.o (maybe you meant: _pcap_realloc) "_setjmp", referenced from: _pcap_compile in gencode.o "_socket", referenced from: _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _get_if_flags in pcap-bpf.o _check_setif_failure in pcap-bpf.o _pcap_lookupnet in pcap.o "_sscanf", referenced from: _pcapnametoportrange in nametoaddr.o pcap_atodn in nametoaddr.o "_strchr", referenced from: _pcap_findalldevs_interfaces in fad-getad.o _pcap_nametoportrange in nametoaddr.o "_strcmp", referenced from: _pcap_activate_bpf in pcap-bpf.o _find_or_add_if in pcap.o _find_or_add_dev in pcap.o _add_addr_to_if in pcap.o _find_dev in pcap.o _get_figure_of_merit in pcap.o _pcap_lookupnet in pcap.o ... "_strdup", referenced from: _pcap_activate_bpf in pcap-bpf.o _add_dev in pcap.o _pcap_create in pcap.o _pcap_nametoportrange in nametoaddr.o "_strerror$UNIX2003", referenced from: _pcap_strerror in pcap.o "_strerror_r", referenced from: _pcap_fmt_errmsg_for_errno in fmtutils.o "_strlen", referenced from: _pcap_activate_bpf in pcap-bpf.o _check_bpf_bindable in pcap-bpf.o _get_figure_of_merit in pcap.o _sdup in gencode.o _pcap_fmt_errmsg_for_errno in fmtutils.o _pcap__scan_string in scanner.o "_strncmp", referenced from: _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _check_bpf_bindable in pcap-bpf.o _check_setif_failure in pcap-bpf.o "_strncpy", referenced from: _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _get_if_flags in pcap-bpf.o _bpf_open_and_bind in pcap-bpf.o "_uname", referenced from: _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o "_write$UNIX2003", referenced from: _pcap_inject_bpf in pcap-bpf.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [libpcap.dylib] Error 1

guyharris commented 6 years ago

ld: warning: The i386 architecture is deprecated for macOS (remove from the Xcode build setting: ARCHS)

So is this with Xcode 10? And are you running on High Sierra or on Mojave beta?

agnosticdev commented 6 years ago

I was also able to reproduce this with a Xcode 10 Beta toolchain (10L176w) on macOS Mojave 10.14 Beta (18A377a)

EXPORTS -DHAVE_CONFIG_H  -g -O2    -c grammar.c
ar rc libpcap.a pcap-bpf.o fad-getad.o pcap.o gencode.o optimize.o nametoaddr.o etherent.o fmtutils.o savefile.o sf-pcap.o sf-pcapng.o pcap-common.o bpf_image.o bpf_filter.o bpf_dump.o  scanner.o grammar.o  
ranlib libpcap.a
rm -f libpcap*.dylib
VER=`cat ./VERSION`; \
    MAJOR_VER=A; \
    COMPAT_VER=1; \
    CURRENT_VER=`sed 's/[^0-9.].*$//' ./VERSION`; \
    gcc -dynamiclib -undefined error -arch x86_64 -arch i386  \
        -o libpcap.$VER.dylib pcap-bpf.o fad-getad.o pcap.o gencode.o optimize.o nametoaddr.o etherent.o fmtutils.o savefile.o sf-pcap.o sf-pcapng.o pcap-common.o bpf_image.o bpf_filter.o bpf_dump.o  scanner.o grammar.o    \
        -install_name /usr/local/lib/libpcap.$MAJOR_VER.dylib \
        -compatibility_version $COMPAT_VER \
        -current_version $CURRENT_VER
ld: warning: The i386 architecture is deprecated for macOS (remove from Xcode build setting: ARCHS)
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd, missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd
Undefined symbols for architecture i386:
  "__DefaultRuneLocale", referenced from:
...
      _pcap_inject_bpf in pcap-bpf.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libpcap.dylib] Error 1

The line that sticks out to me is ld: warning: The i386 architecture is deprecated for macOS (remove from Xcode build setting: ARCHS

I know that macOS is going start dropping 32 bit build support in the future at some point, but I am not certain that this is the issue we are running into here. Let me do some more digging.

guyharris commented 6 years ago

There are two issues here:

  1. the "ld: warning: The i386 architecture is deprecated for macOS (remove from Xcode build setting: ARCHS" warning;

  2. the "ld: symbol(s) not found for architecture i386" error.

The first of those also occurs on High Sierra with Xcode 10, but the second of those doesn't.

Libpcap is still fat in High Sierra and in the Mojave GM, as is libSystem, so we would still want to build it fat for Mojave (so that it could be an alternative to the system library, although, unfortunately, macOS now has its own forked version, which is not open source, so it couldn't be a complete alternative; even the older open source versions of libpcap from Apple have APSL-licensed parts, and I'd prefer neither to have GPLed nor license-with-patent-clauses code in libpcap, to avoid upstreams either with anti-GPL preferences or anti-license-with-patent-clauses preferences not wanting to include libpcap).

But that pesky ".tbd" file lists only x86_64, not i386, even on High Sierra. I'm not sure why that's not causing an issue on High Sierra.

agnosticdev commented 6 years ago

I'd prefer neither to have GPLed nor license-with-patent-clauses code in libpcap, to avoid upstreams either with anti-GPL preferences or anti-license-with-patent-clauses preferences not wanting to include libpcap

I completely agree with and understand that point of view.

It looks like my libSystem file is only setting the arch to x86_64 and not building it fat. In Mojave GM is libSystem fat @guyharris ? If so, I probably need to update and that could be the problem on my end.

archs:           [ x86_64 ]
uuids:           [ 'x86_64: ...' ]
platform:        macosx
install-name:    /usr/lib/libSystem.B.dylib
current-version: 1252.200.5
objc-constraint: none
exports:         
  - archs:           [ x86_64 ]
    ...
seanren96 commented 6 years ago

ld: warning: The i386 architecture is deprecated for macOS (remove from the Xcode build setting: ARCHS)

So is this with Xcode 10? And are you running on High Sierra or on Mojave beta?

I am using Mojave sorry about the late response.

agnosticdev commented 6 years ago

@guyharris I see your recent commit to fix this. Let me test it out.

agnosticdev commented 6 years ago

I updated to the full release of macOS Mojave 10.14. I pulled down the update for macOS to not build programs any fatter than they need to be and I still seen the i386 architecture warning from Xcode's toolchain when I ran make. Possibly this is not a big deal.

ld: warning: The i386 architecture is deprecated for macOS (remove from Xcode build setting: ARCHS)

Screen shot of the issue: screen shot 2018-09-22 at 7 23 05 am

I did make some changes to CMakeLists.txt

    elseif(SYSTEM_VERSION_MAJOR EQUAL 10)
        #
        # Snow Leopard.  Build for x86-64, x86, and
        # 32-bit PowerPC, with x86-64 first.  (That's
        # what Apple does, even though Snow Leopard
        # doesn't run on PPC, so PPC libpcap runs under
        # Rosetta, and Rosetta doesn't support BPF
        # ioctls, so PPC programs can't do live
        # captures.)
        #
        set(CMAKE_OSX_ARCHITECTURES "x86_64;i386;ppc")
    else()
        #
        # Post-Snow Leopard.  Build for x86-64 and
        # x86, with x86-64 first.  (That's probably what
        # Apple does, given that Rosetta is gone.)
        # XXX - update if and when Apple drops support
        # for 32-bit x86 code.
        #
        set(CMAKE_OSX_ARCHITECTURES "x86_64")
    endif()

To configure

darwin10.*)
    #
    # Snow Leopard.  Build libraries for x86-64,
    # 32-bit x86, and 32-bit PowerPC, with x86-64
    # first, and build executables for x86-64 and
    # 32-bit x86, with x86-64 first.  (That's what
    # Apple does, even though Snow Leopard doesn't
    # run on PPC, so PPC libpcap runs under Rosetta,
    # and Rosetta doesn't support BPF ioctls, so PPC
    # programs can't do live captures.)
    #
    V_LIB_CCOPT_FAT="-arch x86_64 -arch i386 -arch ppc"
    V_LIB_LDFLAGS_FAT="-arch x86_64 -arch i386 -arch ppc"
    V_PROG_CCOPT_FAT="-arch x86_64 -arch i386"
    V_PROG_LDFLAGS_FAT="-arch x86_64 -arch i386"
    ;;

darwin*)
    #
    # Post-Snow Leopard.  Build libraries for x86-64
    # and 32-bit x86, with x86-64 first, and build
    # executables only for x86-64.  (That's what
    # Apple does.)  This requires no special flags
    # for programs.
    # XXX - update if and when Apple drops support
    # for 32-bit x86 code and if and when Apple adds
    # ARM-based Macs.  (You're on your own for iOS
    # etc.)
    #
    V_LIB_CCOPT_FAT="-arch x86_64"
    V_LIB_LDFLAGS_FAT="-arch x86_64"
    ;;
esac
fi

and to configure.ac

darwin10.*)
    #
    # Snow Leopard.  Build libraries for x86-64,
    # 32-bit x86, and 32-bit PowerPC, with x86-64
    # first, and build executables for x86-64 and
    # 32-bit x86, with x86-64 first.  (That's what
    # Apple does, even though Snow Leopard doesn't
    # run on PPC, so PPC libpcap runs under Rosetta,
    # and Rosetta doesn't support BPF ioctls, so PPC
    # programs can't do live captures.)
    #
    V_LIB_CCOPT_FAT="-arch x86_64 -arch i386 -arch ppc"
    V_LIB_LDFLAGS_FAT="-arch x86_64 -arch i386 -arch ppc"
    V_PROG_CCOPT_FAT="-arch x86_64 -arch i386"
    V_PROG_LDFLAGS_FAT="-arch x86_64 -arch i386"
    ;;

darwin*)
    #
    # Post-Snow Leopard.  Build libraries for x86-64
    # and 32-bit x86, with x86-64 first, and build
    # executables only for x86-64.  (That's what
    # Apple does.)  This requires no special flags
    # for programs.
    # XXX - update if and when Apple drops support
    # for 32-bit x86 code and if and when Apple adds
    # ARM-based Macs.  (You're on your own for iOS
    # etc.)
    #
    V_LIB_CCOPT_FAT="-arch x86_64"
    V_LIB_LDFLAGS_FAT="-arch x86_64"
    ;;
esac
fi
;;

I was able to remove this warning to only build against x86_64. I do not want to assume that this is a good idea or the correct course of action so I thought I would put it out there to get feedback from the group. screen shot 2018-09-22 at 7 35 56 am

guyharris commented 6 years ago

I updated to the full release of macOS Mojave 10.14.

Presumably you're referring to the developer/public beta GM build; the official release is going to be out next Monday, 2018-09-24.

I pulled down the update for macOS to not build programs any fatter than they need to be and I still seen the i386 architecture warning from Xcode's toolchain when I ran make.

The libraries are still being built fat, as /usr/lib/libpcap.A.dylib is two-way fat (64-bit and 32-bit x86). However, the .tbd files for libpcap, both in Xcode and in the command-line tools, only mention 64-bit x86.

I did make some changes ...

...which cause it not to build the libraries fat.

I've upgraded my Mojave VM to run the GM build and the released version of Xcode 10 and its command-line tools for Mojave; I was able to build (without changes, so it's building libpcap 2-way fat) both from a checked out version of the Git master branch and from the 1.9.0 release tarball without issues (other than the warning, but that's not a problem, it's just warning that support for 32-bit x86 will be dropped at some point in the future).

libSystem, like libpcap, is 2-way fat in Mojave.

agnosticdev commented 6 years ago

Presumably you're referring to the developer/public beta GM build; the official release is going to be out next Monday, 2018-09-24

You are correct, I am on the beta release cycle with beta 11 currently installed.

I've upgraded my Mojave VM to run the GM build and the released version of Xcode 10 and its command-line tools for Mojave; I was able to build (without changes, so it's building libpcap 2-way fat) both from a checked out version of the Git master branch and from the 1.9.0 release tarball without issues (other than the warning, but that's not a problem, it's just warning that support for 32-bit x86 will be dropped at some point in the future).

Excellent. These new library build changes work for me. I will discard the warning Thank you very much!

agnosticdev commented 6 years ago

@seanren96 has the latest updates fixed your build issues?

guyharris commented 6 years ago

OK, so does anybody who has the final version of Mojave (pre-installed, or updated using the Mojave from the App store, rather than a beta or GM version from developer.apple.com), and either the final version of Xcode (installed from the App Store, rather than a beta or GM version from developer.apple.com) or the final version of the command-line tools (installed by trying to run a developer tool and, when the dialog pops up, clicking "Install"), still have a problem if they try building either from a libpcap release tarball or from the tip of the master branch of libpcap on GitHub?

If so, did you install Xcode 10 without separately installing the command-line tools, install the command-line tools for Xcode 10 on 10.14 without installing Xcode, or both? If both, in which order did you install them?

(I have a 10.14 final release VM on which to try it; libSystem is 2-way fat, so the problem isn't with libSystem. I have not yet installed any developer tools on it; if it's failing for anybody, I want to install the developer tools exactly the same way they're installed on the machine where the build is failing.

seanren96 commented 6 years ago

@seanren96 has the latest updates fixed your build issues?

Hi, I will be trying tonight. Sorry for the late reply, have been away since Monday.

agnosticdev commented 6 years ago

Unfortunately I am on the Mojave beta release cycle and Xocde beta. However, let me know if I can be of assistance to test.

seanren96 commented 6 years ago

Hi, unfortunately, I encounter this error: gcc -fvisibility=hidden -fno-common -arch x86_64 -arch i386 -I. -I/usr/local/include -DBUILDING_PCAP -Dpcap_EXPORTS -DHAVE_CONFIG_H -g -O2 -c ./pcap-bpf.c gcc -fvisibility=hidden -fno-common -arch x86_64 -arch i386 -I. -I/usr/local/include -DBUILDING_PCAP -Dpcap_EXPORTS -DHAVE_CONFIG_H -g -O2 -c ./fad-getad.c gcc -fvisibility=hidden -fno-common -arch x86_64 -arch i386 -I. -I/usr/local/include -DBUILDING_PCAP -Dpcap_EXPORTS -DHAVE_CONFIGH -g -O2 -c ./pcap.c bison -y -p pcap -o grammar.c -d grammar.y flex -P pcap_ --header-file=scanner.h --nounput -o scanner.c scanner.l gcc -fvisibility=hidden -fno-common -arch x86_64 -arch i386 -I. -I/usr/local/include -DBUILDING_PCAP -Dpcap_EXPORTS -DHAVE_CONFIG_H -g -O2 -c ./gencode.c gcc -fvisibility=hidden -fno-common -arch x86_64 -arch i386 -I. -I/usr/local/include -DBUILDING_PCAP -Dpcap_EXPORTS -DHAVE_CONFIG_H -g -O2 -c ./optimize.c gcc -fvisibility=hidden -fno-common -arch x86_64 -arch i386 -I. -I/usr/local/include -DBUILDING_PCAP -Dpcap_EXPORTS -DHAVE_CONFIG_H -g -O2 -c ./nametoaddr.c gcc -fvisibility=hidden -fno-common -arch x86_64 -arch i386 -I. -I/usr/local/include -DBUILDING_PCAP -Dpcap_EXPORTS -DHAVE_CONFIG_H -g -O2 -c ./etherent.c gcc -fvisibility=hidden -fno-common -arch x86_64 -arch i386 -I. -I/usr/local/include -DBUILDING_PCAP -Dpcap_EXPORTS -DHAVE_CONFIG_H -g -O2 -c ./fmtutils.c gcc -fvisibility=hidden -fno-common -arch x86_64 -arch i386 -I. -I/usr/local/include -DBUILDING_PCAP -Dpcap_EXPORTS -DHAVE_CONFIG_H -g -O2 -c ./savefile.c gcc -fvisibility=hidden -fno-common -arch x86_64 -arch i386 -I. -I/usr/local/include -DBUILDING_PCAP -Dpcap_EXPORTS -DHAVE_CONFIG_H -g -O2 -c ./sf-pcap.c gcc -fvisibility=hidden -fno-common -arch x86_64 -arch i386 -I. -I/usr/local/include -DBUILDING_PCAP -Dpcap_EXPORTS -DHAVE_CONFIG_H -g -O2 -c ./sf-pcapng.c gcc -fvisibility=hidden -fno-common -arch x86_64 -arch i386 -I. -I/usr/local/include -DBUILDING_PCAP -Dpcap_EXPORTS -DHAVE_CONFIG_H -g -O2 -c ./pcap-common.c gcc -fvisibility=hidden -fno-common -arch x86_64 -arch i386 -I. -I/usr/local/include -DBUILDING_PCAP -Dpcap_EXPORTS -DHAVE_CONFIG_H -g -O2 -c ./bpf_image.c gcc -fvisibility=hidden -fno-common -arch x86_64 -arch i386 -I. -I/usr/local/include -DBUILDING_PCAP -Dpcap_EXPORTS -DHAVE_CONFIG_H -g -O2 -c ./bpf_filter.c gcc -fvisibility=hidden -fno-common -arch x86_64 -arch i386 -I. -I/usr/local/include -DBUILDING_PCAP -Dpcap_EXPORTS -DHAVE_CONFIG_H -g -O2 -c ./bpf_dump.c gcc -fvisibility=hidden -fno-common -arch x86_64 -arch i386 -I. -I/usr/local/include -DBUILDING_PCAP -Dpcap_EXPORTS -DHAVE_CONFIG_H -g -O2 -c scanner.c gcc -fvisibility=hidden -fno-common -arch x86_64 -arch i386 -I. -I/usr/local/include -DBUILDING_PCAP -Dpcap_EXPORTS -DHAVE_CONFIG_H -g -O2 -c grammar.c ar rc libpcap.a pcap-bpf.o fad-getad.o pcap.o gencode.o optimize.o nametoaddr.o etherent.o fmtutils.o savefile.o sf-pcap.o sf-pcapng.o pcap-common.o bpf_image.o bpf_filter.o bpf_dump.o scanner.o grammar.o
ranlib libpcap.a rm -f libpcap.dylib VER=cat ./VERSION; \ MAJOR_VER=A; \ COMPAT_VER=1; \ CURRENT_VER=`sed 's/[^0-9.].$//' ./VERSION`; \ gcc -dynamiclib -undefined error -arch x86_64 -arch i386 \ -o libpcap.$VER.dylib pcap-bpf.o fad-getad.o pcap.o gencode.o optimize.o nametoaddr.o etherent.o fmtutils.o savefile.o sf-pcap.o sf-pcapng.o pcap-common.o bpf_image.o bpf_filter.o bpf_dump.o scanner.o grammar.o \ -install_name /usr/local/lib/libpcap.$MAJOR_VER.dylib \ -compatibility_version $COMPAT_VER \ -current_version $CURRENT_VER ld: warning: The i386 architecture is deprecated for macOS (remove from the Xcode build setting: ARCHS) ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd, missing required architecture i386 in file /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd Undefined symbols for architecture i386: "DefaultRuneLocale", referenced from: _pcap_ether_aton in nametoaddr.o _pcap_next_etherent in etherent.o _pcap_lex in scanner.o _pcap_ether_aton in nametoaddr.o _pcap_next_etherent in etherent.o _pcap_lex in scanner.o _pcap_ether_aton in nametoaddr.o _pcap_next_etherent in etherent.o _pcap_lex in scanner.o "_bzero", referenced from: _pcap_create_common in pcap.o _pcap_open_offline_common in pcap.o _pcap_open_dead_with_tstamp_precision in pcap.o _pcap_open_dead in pcap.o _newchunk in gencode.o _pcap_compile in gencode.o _genprotochain in gencode.o ... "error", referenced from: _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _check_bpf_bindable in pcap-bpf.o _get_if_flags in pcap-bpf.o _bpf_open in pcap-bpf.o _get_dlt_list in pcap-bpf.o _check_setiffailure in pcap-bpf.o ... "maskrune", referenced from: _pcap_ether_aton in nametoaddr.o _pcap_next_etherent in etherent.o _pcap_lex in scanner.o "_memset_chk", referenced from: _gen_mcode6 in gencode.o "___snprintf_chk", referenced from: _pcap_activate_bpf in pcap-bpf.o _bpf_open in pcap-bpf.o _pcap_read_bpf in pcap-bpf.o _pcap_setdirection_bpf in pcap-bpf.o _pcap_lookupnet in pcap.o _pcap_check_activated in pcap.o _pcap_setsnaplen in pcap.o ... "stack_chk_fail", referenced from: _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _check_bpf_bindable in pcap-bpf.o _get_if_flags in pcap-bpf.o _bpf_open in pcap-bpf.o _check_setif_failure in pcap-bpf.o _bpf_open_and_bind in pcap-bpf.o ... "_stack_chk_guard", referenced from: _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _check_bpf_bindable in pcap-bpf.o _get_if_flags in pcap-bpf.o _bpf_open in pcap-bpf.o _check_setif_failure in pcap-bpf.o _bpf_open_and_bind in pcap-bpf.o ... _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _check_bpf_bindable in pcap-bpf.o _get_if_flags in pcap-bpf.o _bpf_open in pcap-bpf.o _check_setif_failure in pcap-bpf.o _bpf_open_and_bind in pcap-bpf.o ... _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _check_bpf_bindable in pcap-bpf.o _get_if_flags in pcap-bpf.o _bpf_open in pcap-bpf.o _check_setif_failure in pcap-bpf.o _bpf_open_and_bind in pcap-bpf.o ... _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _check_bpf_bindable in pcap-bpf.o _get_if_flags in pcap-bpf.o _bpf_open in pcap-bpf.o _check_setif_failure in pcap-bpf.o _bpf_open_and_bind in pcap-bpf.o ... _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _check_bpf_bindable in pcap-bpf.o _get_if_flags in pcap-bpf.o _bpf_open in pcap-bpf.o _check_setif_failure in pcap-bpf.o _bpf_open_and_bind in pcap-bpf.o ... _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _check_bpf_bindable in pcap-bpf.o _get_if_flags in pcap-bpf.o _bpf_open in pcap-bpf.o _check_setif_failure in pcap-bpf.o _bpf_open_and_bind in pcap-bpf.o ... _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _check_bpf_bindable in pcap-bpf.o _get_if_flags in pcap-bpf.o _bpf_open in pcap-bpf.o _check_setif_failure in pcap-bpf.o _bpf_open_and_bind in pcap-bpf.o ... ... "___stderrp", referenced from: _pcap_perror in pcap.o _yy_fatal_error in scanner.o _pcap_perror in pcap.o _yy_fatalerror in scanner.o "stdinp", referenced from: _sf_cleanup in savefile.o _pcap_open_offline_with_tstamp_precision in savefile.o _pcap_lex in scanner.o _sf_cleanup in savefile.o _pcap_open_offline_with_tstamp_precision in savefile.o _pcap_lex in scanner.o "_stdoutp", referenced from: _pcap_dump_open in sf-pcap.o _pcap_dump_fopen in sf-pcap.o _pcap_dump_open_append in sf-pcap.o _pcap_lex in scanner.o _pcap_dump_open in sf-pcap.o _pcap_dump_fopen in sf-pcap.o _pcap_dump_open_append in sf-pcap.o _pcaplex in scanner.o "strcat_chk", referenced from: _pcap_activate_bpf in pcap-bpf.o _check_bpf_bindable in pcap-bpf.o "_strlcat_chk", referenced from: _pcap_can_set_rfmon_bpf in pcap-bpf.o _check_setif_failure in pcap-bpf.o "___strlcpy_chk", referenced from: _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _check_setif_failure in pcap-bpf.o _pcap_lookupdev in pcap.o _pcap_lookupnet in pcap.o _pcap_getnonblock in pcap.o _pcapsetnonblock in pcap.o ... "udivdi3", referenced from: _add_interface in sf-pcapng.o _pcap_ng_next_packet in sf-pcapng.o "_vsnprintf_chk", referenced from: _bpf_error in gencode.o _pcap_fmt_errmsg_for_errno in fmtutils.o "_abort", referenced from: _gen_atmtype_abbrev in gencode.o _gen_load_a in gencode.o _gen_proto_abbrev in gencode.o _gen_proto in gencode.o _gen_linktype in gencode.o _gen_portop in gencode.o _gen_portop6 in gencode.o ... "_atexit", referenced from: _pcap_do_addexit in pcap.o "_atoi", referenced from: _get_figure_of_merit in pcap.o (maybe you meant: _pcap_atoin) "_calloc", referenced from: _pcap_list_tstamp_types in pcap.o _pcap_list_datalinks in pcap.o _bpf_optimize in optimize.o _convert_code_r in optimize.o "_clearerr", referenced from: _pcap_lex in scanner.o "_close$UNIX2003", referenced from: _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _check_bpf_bindable in pcap-bpf.o _get_if_flags in pcap-bpf.o _check_setif_failure in pcap-bpf.o _bpf_open_and_bind in pcap-bpf.o _pcap_lookupnet in pcap.o ... "_ether_hostton", referenced from: _pcap_ether_hostton in nametoaddr.o (maybe you meant: _pcap_ether_hostton) "_exit", referenced from: _yy_fatal_error in scanner.o "_fclose", referenced from: _sf_cleanup in savefile.o _pcap_open_offline_with_tstamp_precision in savefile.o _pcap_dump_open in sf-pcap.o _pcap_dump_fopen in sf-pcap.o _pcap_dump_open_append in sf-pcap.o _pcap_dump_close in sf-pcap.o "_fcntl$UNIX2003", referenced from: _pcap_getnonblock_fd in pcap.o _pcap_setnonblock_fd in pcap.o "_feof", referenced from: _pcap_dump_open_append in sf-pcap.o "_ferror", referenced from: _pcap_fopen_offline_with_tstamp_precision in savefile.o _pcap_check_header in sf-pcap.o _pcap_next_packet in sf-pcap.o _pcap_dump_open_append in sf-pcap.o _pcap_ng_check_header in sf-pcapng.o _read_block in sf-pcapng.o _pcap_lex in scanner.o ... "_fflush", referenced from: _pcap_dump_flush in sf-pcap.o "_fileno", referenced from: _pcap_fopen_offline_with_tstamp_precision in savefile.o (maybe you meant: _pcap_fileno) "_fopen$UNIX2003", referenced from: _pcap_open_offline_with_tstamp_precision in savefile.o _pcap_dump_open in sf-pcap.o _pcap_dump_open_append in sf-pcap.o "_fprintf", referenced from: _pcap_perror in pcap.o _yy_fatal_error in scanner.o "_fread", referenced from: _pcap_fopen_offline_with_tstamp_precision in savefile.o _pcap_check_header in sf-pcap.o _pcap_next_packet in sf-pcap.o _pcap_dump_open_append in sf-pcap.o _pcap_ng_check_header in sf-pcapng.o _read_block in sf-pcapng.o _pcap_lex in scanner.o ... "_free", referenced from: _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _check_bpf_bindable in pcap-bpf.o _get_dlt_list in pcap-bpf.o _pcap_cleanup_bpf in pcap-bpf.o _pcap_free_tstamp_types in pcap.o _pcap_freealldevs in pcap.o ... (maybe you meant: _pcap_free, _pcap_free_tstamp_types , _pcap_free_datalinks , _pcap_freecode , _pcap_freealldevs ) "_freeaddrinfo", referenced from: _pcap_compile in gencode.o _gen_scode in gencode.o _gen_mcode6 in gencode.o _pcap_nametoport in nametoaddr.o _pcap_lex in scanner.o "_freeifaddrs", referenced from: _pcap_findalldevs_interfaces in fad-getad.o "_fseek", referenced from: _pcap_dump_open_append in sf-pcap.o "_ftell", referenced from: _pcap_dump_ftell in sf-pcap.o (maybe you meant: _pcap_dump_ftell, _pcap_dump_ftell64 ) "_ftello", referenced from: _pcap_dump_ftell64 in sf-pcap.o "_fwrite$UNIX2003", referenced from: _pcap_dump in sf-pcap.o _pcap_dump_open in sf-pcap.o _pcap_dump_fopen in sf-pcap.o _pcap_dump_open_append in sf-pcap.o _pcap_lex in scanner.o "_getaddrinfo", referenced from: _pcap_nametoaddrinfo in nametoaddr.o _pcap_nametoport in nametoaddr.o _pcap_lex in scanner.o "_getc", referenced from: _pcap_next_etherent in etherent.o _pcap_lex in scanner.o "_gethostbyname", referenced from: _pcap_nametoaddr in nametoaddr.o "_getifaddrs", referenced from: _pcap_findalldevs_interfaces in fad-getad.o "_getnetbyname", referenced from: _pcap_nametonetaddr in nametoaddr.o "_getprotobyname", referenced from: _pcap_nametoproto in nametoaddr.o "_ioctl", referenced from: _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _get_if_flags in pcap-bpf.o _get_dlt_list in pcap-bpf.o _check_setif_failure in pcap-bpf.o _pcap_inject_bpf in pcap-bpf.o _pcap_setfilter_bpf in pcap-bpf.o ... "_longjmp", referenced from: _bpf_error in gencode.o "_malloc", referenced from: _pcap_activate_bpf in pcap-bpf.o _check_bpf_bindable in pcap-bpf.o _get_dlt_list in pcap-bpf.o _add_addr_to_dev in pcap.o _add_dev in pcap.o _pcap_create_common in pcap.o _pcap_open_offline_common in pcap.o ... "_memcpy", referenced from: _pcap_list_tstamp_types in pcap.o _add_addr_to_dev in pcap.o _pcap_list_datalinks in pcap.o _opt_loop in optimize.o _install_bpf_program in optimize.o _pcapscan_string in scanner.o _pcap__scan_bytes in scanner.o ... "_memset", referenced from: _opt_loop in optimize.o "_open$UNIX2003", referenced from: _bpf_open in pcap-bpf.o "_printf", referenced from: _bpf_dump in bpf_dump.o "_puts", referenced from: _bpf_dump in bpf_dump.o "_read$UNIX2003", referenced from: _pcap_read_bpf in pcap-bpf.o "_realloc", referenced from: _pcap_next_packet in sf-pcap.o _read_block in sf-pcapng.o _add_interface in sf-pcapng.o _pcap_lex in scanner.o _pcap_ensure_buffer_stack in scanner.o _pcap_realloc in scanner.o (maybe you meant: _pcap_realloc) "_setjmp", referenced from: _pcap_compile in gencode.o "_socket", referenced from: _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _get_if_flags in pcap-bpf.o _check_setif_failure in pcap-bpf.o _pcap_lookupnet in pcap.o "_sscanf", referenced from: _pcapnametoportrange in nametoaddr.o pcap_atodn in nametoaddr.o "_strchr", referenced from: _pcap_findalldevs_interfaces in fad-getad.o _pcap_nametoportrange in nametoaddr.o "_strcmp", referenced from: _pcap_activate_bpf in pcap-bpf.o _find_or_add_if in pcap.o _find_or_add_dev in pcap.o _add_addr_to_if in pcap.o _find_dev in pcap.o _get_figure_of_merit in pcap.o _pcap_lookupnet in pcap.o ... "_strdup", referenced from: _pcap_activate_bpf in pcap-bpf.o _add_dev in pcap.o _pcap_create in pcap.o _pcap_nametoportrange in nametoaddr.o "_strerror$UNIX2003", referenced from: _pcap_strerror in pcap.o "_strerror_r", referenced from: _pcap_fmt_errmsg_for_errno in fmtutils.o "_strlen", referenced from: _pcap_activate_bpf in pcap-bpf.o _check_bpf_bindable in pcap-bpf.o _get_figure_of_merit in pcap.o _sdup in gencode.o _pcap_fmt_errmsg_for_errno in fmtutils.o _pcap__scan_string in scanner.o "_strncmp", referenced from: _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _check_bpf_bindable in pcap-bpf.o _check_setif_failure in pcap-bpf.o "_strncpy", referenced from: _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o _get_if_flags in pcap-bpf.o _bpf_open_and_bind in pcap-bpf.o "_uname", referenced from: _pcap_activate_bpf in pcap-bpf.o _pcap_can_set_rfmon_bpf in pcap-bpf.o "_write$UNIX2003", referenced from: _pcap_inject_bpf in pcap-bpf.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [libpcap.dylib] Error 1

guyharris commented 6 years ago

Hi, unfortunately, I encounter this error:

And you have the final releases of Mojave and Xcode 10 installed, not beta versions?

What does the command file /usr/lib/libSystem.*.dylib /usr/lib/system/*.dylib print?

seanren96 commented 6 years ago

Ok, I just looked around the system info, it is supposed to be the final beta version. I am downloading the official release and will try later on. Here is the output of the command file /usr/lib/libSystem..dylib /usr/lib/system/.dylib /usr/lib/libSystem.B.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/libSystem.B.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/libSystem.B.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libcache.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libcache.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libcache.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libcommonCrypto.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libcommonCrypto.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libcommonCrypto.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libcompiler_rt.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libcompiler_rt.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libcompiler_rt.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libcopyfile.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libcopyfile.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libcopyfile.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libcorecrypto.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libcorecrypto.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libcorecrypto.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libcorecrypto_trace.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libcorecrypto_trace.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libcorecrypto_trace.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libdispatch.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libdispatch.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libdispatch.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libdyld.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libdyld.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libdyld.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libkeymgr.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libkeymgr.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libkeymgr.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libkxld.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libkxld.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libkxld.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/liblaunch.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/liblaunch.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/liblaunch.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libmacho.dylib: Mach-O universal binary with 2 architectures: [i386:Mach-O dynamically linked shared library i386] [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] /usr/lib/system/libmacho.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libmacho.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libmathCommon.A.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libmathCommon.A.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libmathCommon.A.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libmathCommon.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libmathCommon.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libmathCommon.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libquarantine.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libquarantine.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libquarantine.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libremovefile.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libremovefile.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libremovefile.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libsystem_asl.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libsystem_asl.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libsystem_asl.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libsystem_blocks.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libsystem_blocks.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libsystem_blocks.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libsystem_c.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libsystem_c.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libsystem_c.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libsystem_configuration.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libsystem_configuration.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libsystem_configuration.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libsystem_coreservices.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libsystem_coreservices.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libsystem_coreservices.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libsystem_darwin.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libsystem_darwin.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libsystem_darwin.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libsystem_dnssd.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libsystem_dnssd.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libsystem_dnssd.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libsystem_info.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libsystem_info.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libsystem_info.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libsystem_kernel.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libsystem_kernel.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libsystem_kernel.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libsystem_m.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libsystem_m.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libsystem_m.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libsystem_malloc.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libsystem_malloc.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libsystem_malloc.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libsystem_networkextension.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libsystem_networkextension.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libsystem_networkextension.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libsystem_notify.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libsystem_notify.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libsystem_notify.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libsystem_platform.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libsystem_platform.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libsystem_platform.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libsystem_pthread.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libsystem_pthread.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libsystem_pthread.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libsystem_sandbox.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libsystem_sandbox.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libsystem_sandbox.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libsystem_secinit.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libsystem_secinit.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libsystem_secinit.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libsystem_symptoms.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libsystem_symptoms.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libsystem_symptoms.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libsystem_trace.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libsystem_trace.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libsystem_trace.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libunc.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libunc.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libunc.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libunwind.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libunwind.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libunwind.dylib (for architecture i386): Mach-O dynamically linked shared library i386 /usr/lib/system/libxpc.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [i386:Mach-O dynamically linked shared library i386] /usr/lib/system/libxpc.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64 /usr/lib/system/libxpc.dylib (for architecture i386): Mach-O dynamically linked shared library i386

ryandesign commented 6 years ago

You cannot build for i386 using the macOS 10.14 or later SDK.

guyharris commented 6 years ago

You cannot build for i386 using the macOS 10.14 or later SDK.

...unless you install the command-line tools for Xcode 10 and 10.14 and then install

/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

I installed this because, being an old-time UN*X type, I often tend to look in /usr/include for system header files, and it's too much of a pain to look under /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include or even to set HDRS to that path and look under $HDRS. It turns out that being able to still build fat is a side-effect.

(On High Sierra, it might be necessary to install the command-line tools to be able to build fat, but the command-line tools also sets up /usr/include.)

There aren't any later SDKs yet, but if you build for 10.15, there probably won't be any point in building fat, as 10.15 isn't going to support 32-bit binaries, according to what Apple's said.

git-hulk commented 5 years ago

@seanren96 I fixed it by removing the -arch=1386 options at configure file. https://github.com/git-hulk/tcpkit/blob/master/deps/libpcap/configure

guyharris commented 5 years ago

This should now be fixed, for both High Sierra and Mojave, by 0466b96b44e764ca00ba2a7eddce971f594be255, e8f24aa79fc6530573ffbe89f0be044cbbf70f02, and 4dcea058851263dbe5aa624d9a77ff874b75e5b5. They will check - both with autotools and CMake, as both have to be changed - whether building for 32-bit x86 is supported and, if it's not, build only for x86-64 and issue a warning suggesting how to get 32-bit x86 builds to work.