Skip to content

Conversation

@dancrossnyc
Copy link

On FreeBSD, one must actually link against libpcap (or give the path to a shared object at link
time). That is, it is not a header-only library
on that platform.

Account for this by adding a new boolean variable
in platform-quirks.cmake: NEED_PCAP_LIBRARY,
which defaults to false. Condition pcap library
discovery and link argument modifications on that
variable in FindPCAP.cmake and dep-link.cmake.

@dancrossnyc dancrossnyc force-pushed the cmake branch 2 times, most recently from 6b94852 to 92175ea Compare January 20, 2026 19:50
On FreeBSD, one must actually link against libpcap
(or give the path to a shared object at link
time).  That is, it is not a header-only library
on that platform.

Account for this by adding a new boolean variable
in `platform-quirks.cmake`: `NEED_PCAP_LIBRARY`,
which defaults to false.  Condition pcap library
discovery and link argument modifications on that
variable in `FindPCAP.cmake` and `dep-link.cmake`.
@dancrossnyc
Copy link
Author

Gentle ping on this?

@markpizz
Copy link
Contributor

FYI, the makefile build produces completely useful simulators with PCAP network support that works just fine on FreeBSD 14.3. I suspect the same with 15.0.

mark@FreeBSD:~/open-simh $ gmake pdp11
lib paths are: /lib /usr/lib /usr/lib/compat /usr/local/lib /usr/local/lib/compat/pkg /usr/local/lib/gcc13 /usr/local/lib/perl5/5.40/mach/CORE /lib/ /usr/lib/
include paths are:  /usr/local/lib/gcc13/gcc/x86_64-portbld-freebsd14.2/13.3.0/include /usr/local/include /usr/include /usr/local/include
using libm: /usr/lib/libm.so
using librt: /usr/lib/librt.so
using libpthread: /usr/lib/libpthread.so /usr/include/pthread.h
using libpcre: /usr/local/lib/libpcre.so /usr/local/include/pcre.h
using semaphore: /usr/include/semaphore.h
using libdl: /usr/lib/libdl.so /usr/include/dlfcn.h
using libedit: /usr/local/include/editline/readline.h
using libpng: /usr/local/lib/libpng.so /usr/local/include/png.h
using zlib: /usr/lib/libz.so /usr/include/zlib.h
using mman: /usr/include/sys/mman.h
using libSDL2: /usr/local/include/SDL2/SDL.h
*** No SDL ttf support available.  BESM-6 video panel disabled.
***
*** Info *** Install the development components of libSDL2-ttf packaged by your
*** Info *** operating system distribution and rebuild your simulator to
*** Info *** enable this extra functionality.
using libpcap: /usr/include/pcap.h
***
*** pdp11 Simulator being built with:
*** - compiler optimizations and no debugging support. GCC Version: 13.3.0.
*** - dynamic networking support using FreeBSD provided libpcap components.
*** - Local LAN packet transports: PCAP TAP NAT(SLiRP)
*** - video capabilities provided by libSDL2 (Simple Directmedia Layer).
*** - Per simulator tests will be run.
***
*** git commit id is 4d38373206cd7c0ce8b94f5e16bd4429cb96430f.
*** git commit time is 2025-10-12T07:58:51+0200.
***
gcc -std=gnu99 -U__STRICT_ANSI__  -O2 -DNDEBUG=1 -finline-functions -fgcse-after-reload -fpredictive-commoning -fipa-cp-clone -fno-unsafe-loop-optimizations -fno-strict-overflow -DSIM_GIT_COMMIT_ID=4d38373206cd7c0ce8b94f5e16bd4429cb96430f -DSIM_GIT_COMMIT_TIME=2025-10-12T07:58:51+0200  -DSIM_COMPILER="GCC Version: 13.3.0" -DSIM_BUILD_TOOL=simh-makefile -I . -Werror -D_GNU_SOURCE -I/usr/local/include -DHAVE_PCRE_H -DHAVE_SEMAPHORE -DHAVE_SYS_IOCTL -DSIM_HAVE_DLOPEN=so -DHAVE_EDITLINE -DHAVE_UTIME -DHAVE_LIBPNG -DHAVE_ZLIB -DHAVE_GLOB -DHAVE_SHM_OPEN  ./PDP11/pdp11_fp.c ./PDP11/pdp11_cpu.c ./PDP11/pdp11_dz.c ./PDP11/pdp11_cis.c ./PDP11/pdp11_lp.c ./PDP11/pdp11_rk.c ./PDP11/pdp11_rl.c ./PDP11/pdp11_rp.c ./PDP11/pdp11_rx.c ./PDP11/pdp11_stddev.c ./PDP11/pdp11_sys.c ./PDP11/pdp11_tc.c ./PDP11/pdp11_tm.c ./PDP11/pdp11_ts.c ./PDP11/pdp11_io.c ./PDP11/pdp11_rq.c ./PDP11/pdp11_tq.c ./PDP11/pdp11_pclk.c ./PDP11/pdp11_ry.c ./PDP11/pdp11_pt.c ./PDP11/pdp11_hk.c ./PDP11/pdp11_xq.c ./PDP11/pdp11_xu.c ./PDP11/pdp11_vh.c ./PDP11/pdp11_rh.c ./PDP11/pdp11_tu.c ./PDP11/pdp11_cpumod.c ./PDP11/pdp11_cr.c ./PDP11/pdp11_rf.c ./PDP11/pdp11_dl.c ./PDP11/pdp11_ta.c ./PDP11/pdp11_rc.c ./PDP11/pdp11_kg.c ./PDP11/pdp11_ke.c ./PDP11/pdp11_dc.c ./PDP11/pdp11_dmc.c ./PDP11/pdp11_kmc.c ./PDP11/pdp11_dup.c ./PDP11/pdp11_rs.c ./PDP11/pdp11_vt.c ./PDP11/pdp11_td.c ./PDP11/pdp11_io_lib.c ./PDP11/pdp11_rom.c ./PDP11/pdp11_ch.c ./PDP11/pdp11_dh.c ./PDP11/pdp11_ng.c ./PDP11/pdp11_daz.c ./PDP11/pdp11_tv.c ./PDP11/pdp11_mb.c ./PDP11/pdp11_rr.c ./display/display.c ./display/sim_ws.c ./display/ng.c ./display/vt11.c ./scp.c ./sim_console.c ./sim_fio.c ./sim_timer.c ./sim_sock.c ./sim_tmxr.c ./sim_ether.c ./sim_tape.c ./sim_disk.c ./sim_serial.c ./sim_video.c ./sim_imd.c ./sim_card.c -DVM_PDP11 -I ./PDP11 -DHAVE_PCAP_NETWORK -I/usr/include/ -DBPF_CONST_STRING -DUSE_SHARED -DHAVE_TAP_NETWORK -DHAVE_BSDTUNTAP -Islirp -Islirp_glue -Islirp_glue/qemu -DHAVE_SLIRP_NETWORK -DUSE_SIMH_SLIRP_DEBUG slirp/*.c slirp_glue/*.c -DUSE_DISPLAY -DHAVE_LIBSDL -DUSE_SIM_VIDEO `sdl2-config --cflags` `sdl2-config --libs` -DUSE_READER_THREAD -DSIM_ASYNCH_IO -o BIN/pdp11 -L/lib -L/usr/lib -L/usr/lib/compat -L/usr/local/lib -L/usr/local/lib/compat/pkg -L/usr/local/lib/gcc13 -L/usr/local/lib/perl5/5.40/mach/CORE -L/lib/ -L/usr/lib/ -lm -lrt -lpthread -lpcre -L/usr/local/lib/ -ldl -ledit -ltermcap -lpng -lz
BIN/pdp11 RegisterSanityCheck  </dev/null
 Running internal register sanity checks on PDP-11 simulator.
*** Good Registers in PDP-11 simulator.
mark@FreeBSD:~/open-simh $ su
Password:
root@FreeBSD:/home/mark/open-simh # BIN/pdp11

PDP-11 simulator Open SIMH V4.1-0 Current        git commit id: 4d383732
sim> show eth
ETH devices:
 eth0   hn0                                  (No description available)
 eth1   tap:tapN                             (Integrated Tun/Tap support)
 eth2   nat:{optional-nat-parameters}        (Integrated NAT (SLiRP) support)
 eth3   udp:sourceport:remotehost:remoteport (Integrated UDP bridge support)
sim> show ver
PDP-11 simulator Open SIMH V4.1-0 Current
    Simulator Framework Capabilities:
        32b data
        32b addresses
        Threaded Ethernet Packet transports:PCAP:TAP:NAT:UDP
        Idle/Throttling support is available
        Virtual Hard Disk (VHD) support
        Asynchronous I/O support (Lock free asynchronous event queue)
        Asynchronous Clock support
        FrontPanel API Version 12
    Host Platform:
        Compiler: GCC 13.3.0
        Simulator Compiled as C arch: x64 (Release Build) on Jan 21 2026 at 11:19:10
        Build Tool: simh-makefile
        Memory Access: Little Endian
        Memory Pointer Size: 64 bits
        Large File (>2GB) support
        SDL Video support: SDL Version 2.32.8, PNG Version 1.6.49, zlib: 1.3.1
        PCRE RegEx (Version 8.45 2021-06-15) support for EXPECT commands
        OS clock resolution: 1ms
        Time taken by msleep(1): 1ms
        Ethernet packet info: libpcap version 1.10.5
        OS: FreeBSD FreeBSD 14.3-RELEASE FreeBSD 14.3-RELEASE releng/14.3-n271432-8c9ce319fef7 GENERIC amd64
        tar tool: bsdtar 3.7.7 - libarchive 3.7.7 zlib/1.3.1 liblzma/5.8.1 bz2lib/1.0.8 libzstd/1.5.2
        curl tool: curl 8.14.1 (amd64-portbld-freebsd14.2) libcurl/8.14.1 OpenSSL/3.0.16 zlib/1.3.1 brotli/1.1.0 zstd/1.5.7 libidn2/2.3.8 libpsl/0.21.5 libssh2/1.11.1 nghttp2/1.66.0
        git commit id: 4d383732
        git commit time: 2025-10-12T07:58:51+0200
sim>

@dancrossnyc
Copy link
Author

Yes. But not with cmake. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants