Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors building on FreeBSD. #442

Open
larsbrinkhoff opened this issue Jan 23, 2025 · 5 comments
Open

Errors building on FreeBSD. #442

larsbrinkhoff opened this issue Jan 23, 2025 · 5 comments

Comments

@larsbrinkhoff
Copy link
Contributor

When building the latest SIMH, commit feb155f, I get the following errors on FreeBSD 14. See also https://cirrus-ci.com/task/5537648405643264 Maybe a problem using %zu on that platform?

cc -std=c99 -U__STRICT_ANSI__  -O2 -DNDEBUG=1 -fno-strict-overflow -finline-functions -DSIM_GIT_COMMIT_ID=feb155fbc49333e879ab082d481e6dcce27d2d91 -DSIM_GIT_COMMIT_TIME=2024-12-09T13:37:22+0100  -DSIM_COMPILER="FreeBSD clang version 16.0.6" -DSIM_BUILD_TOOL=simh-makefile -I . -Werror -D_GNU_SOURCE -I/usr/local/include -DHAVE_SEMAPHORE -DHAVE_SYS_IOCTL -DSIM_HAVE_DLOPEN=so -DHAVE_EDITLINE -DHAVE_UTIME -DHAVE_ZLIB -DHAVE_GLOB -DHAVE_SHM_OPEN  ./PDP10/pdp10_fe.c ./PDP11/pdp11_dz.c ./PDP10/pdp10_cpu.c ./PDP10/pdp10_ksio.c ./PDP10/pdp10_lp20.c ./PDP10/pdp10_mdfp.c ./PDP10/pdp10_pag.c ./PDP10/pdp10_rp.c ./PDP10/pdp10_sys.c ./PDP10/pdp10_tim.c ./PDP10/pdp10_tu.c ./PDP10/pdp10_xtnd.c ./PDP11/pdp11_pt.c ./PDP11/pdp11_ry.c ./PDP11/pdp11_cr.c ./PDP11/pdp11_dup.c ./PDP11/pdp11_dmc.c ./PDP11/pdp11_kmc.c ./PDP11/pdp11_xu.c ./PDP11/pdp11_ch.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_PDP10 -DUSE_INT64 -I ./PDP10 -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 -o BIN/pdp10 -L/lib -L/usr/lib -L/usr/lib/compat -L/usr/local/lib -L/usr/local/lib/compat/pkg -L/usr/local/lib/expect5.45.4 -L/usr/local/lib/perl5/5.36/mach/CORE -L/lib/ -L/usr/lib/ -lm -lrt -lpthread -ldl -ledit -ltermcap -lz  
./scp.c:13226:61: error: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Werror,-Wformat]
    fprintf (st, "  Match Buffer Size: %" SIZE_T_FMT "d\n", exp->buf_size);
                                       ~~~~~~~~~~~~~~~~     ^~~~~~~~~~~~~
                                       %zu
./scp.c:13227:64: error: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Werror,-Wformat]
    fprintf (st, "  Buffer Insert Offset: %" SIZE_T_FMT "d\n", exp->buf_ins);
                                          ~~~~~~~~~~~~~~~~     ^~~~~~~~~~~~
                                          %zu
./scp.c:13363:99: error: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Werror,-Wformat]
                    sim_debug (exp->dbit, exp->dptr, "Checking String[0:%" SIZE_T_FMT "d]: %s\n", exp->buf_ins, estr);
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
                                                                        %zu
./scp.h:272:146: note: expanded from macro 'sim_debug'
#define sim_debug(dbits, dptr, ...) do { if ((sim_deb != NULL) && ((dptr) != NULL) && ((dptr)->dctrl & (dbits))) _sim_debug_device (dbits, dptr, __VA_ARGS__);} while (0)
                                                                                                                                                 ^~~~~~~~~~~
./scp.c:13376:28: error: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Werror,-Wformat]
                           exp->buf_size - ep->size - exp->buf_ins, ep->size-exp->buf_ins, estr);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./scp.h:272:146: note: expanded from macro 'sim_debug'
#define sim_debug(dbits, dptr, ...) do { if ((sim_deb != NULL) && ((dptr) != NULL) && ((dptr)->dctrl & (dbits))) _sim_debug_device (dbits, dptr, __VA_ARGS__);} while (0)
                                                                                                                                                 ^~~~~~~~~~~
./scp.c:13376:69: error: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Werror,-Wformat]
                           exp->buf_size - ep->size - exp->buf_ins, ep->size-exp->buf_ins, estr);
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
./scp.h:272:146: note: expanded from macro 'sim_debug'
#define sim_debug(dbits, dptr, ...) do { if ((sim_deb != NULL) && ((dptr) != NULL) && ((dptr)->dctrl & (dbits))) _sim_debug_device (dbits, dptr, __VA_ARGS__);} while (0)
                                                                                                                                                 ^~~~~~~~~~~
./scp.c:13391:27: error: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Werror,-Wformat]
                          exp->buf_ins - ep->size, ep->size, estr);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./scp.h:272:146: note: expanded from macro 'sim_debug'
#define sim_debug(dbits, dptr, ...) do { if ((sim_deb != NULL) && ((dptr) != NULL) && ((dptr)->dctrl & (dbits))) _sim_debug_device (dbits, dptr, __VA_ARGS__);} while (0)
                                                                                                                                                 ^~~~~~~~~~~
./scp.c:13391:52: error: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Werror,-Wformat]
                          exp->buf_ins - ep->size, ep->size, estr);
                          ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
./scp.h:272:146: note: expanded from macro 'sim_debug'
#define sim_debug(dbits, dptr, ...) do { if ((sim_deb != NULL) && ((dptr) != NULL) && ((dptr)->dctrl & (dbits))) _sim_debug_device (dbits, dptr, __VA_ARGS__);} while (0)
                                                                                                                                                 ^~~~~~~~~~~
./scp.c:13413:19: error: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Werror,-Wformat]
                  exp->buf_size / 2, exp->buf_ins);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./scp.h:272:146: note: expanded from macro 'sim_debug'
#define sim_debug(dbits, dptr, ...) do { if ((sim_deb != NULL) && ((dptr) != NULL) && ((dptr)->dctrl & (dbits))) _sim_debug_device (dbits, dptr, __VA_ARGS__);} while (0)
                                                                                                                                                 ^~~~~~~~~~~
./scp.c:13413:38: error: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Werror,-Wformat]
                  exp->buf_size / 2, exp->buf_ins);
                  ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
./scp.h:272:146: note: expanded from macro 'sim_debug'
#define sim_debug(dbits, dptr, ...) do { if ((sim_deb != NULL) && ((dptr) != NULL) && ((dptr)->dctrl & (dbits))) _sim_debug_device (dbits, dptr, __VA_ARGS__);} while (0)
                                                                                                                                                 ^~~~~~~~~~~
./scp.c:13503:75: error: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Werror,-Wformat]
    fprintf (st, "  %" SIZE_T_FMT "d bytes of pending input Data:\n    ", snd->insoff-snd->extoff);
                    ~~~~~~~~~~~~~~~~                                      ^~~~~~~~~~~~~~~~~~~~~~~
                    %zu
./scp.c:14248:34: error: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Werror,-Wformat]
                                 i-(16*same), i - 1);
                                 ^~~~~~~~~~~
./scp.c:14248:47: error: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Werror,-Wformat]
                                 i-(16*same), i - 1);
                                              ^~~~~
./scp.c:14296:80: error: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Werror,-Wformat]
            _sim_debug_unit (reason, uptr, "%04" SIZE_T_FMT "X%-48s %s%s%s\n", i, outbuf, strbuf, ebcdicbuf, rad50buf);
                                            ~~~~~~~~~~~~~~~~~~                 ^
                                            %04zX
./scp.c:14300:30: error: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Werror,-Wformat]
                             (i-(16*same)), len - 1);
                             ^~~~~~~~~~~~~
./scp.c:14300:45: error: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Werror,-Wformat]
                             (i-(16*same)), len - 1);
                                            ^~~~~~~
./scp.c:16138:78: error: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Werror,-Wformat]
                        rptr->radix, rptr->width, rptr->offset, rptr->depth, rptr->stride, rptr->obj_size, rptr->size, rsz, rptr->desc ? rptr->desc : "",
                                                                             ^~~~~~~~~~~~
./scp.c:16138:92: error: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Werror,-Wformat]
                        rptr->radix, rptr->width, rptr->offset, rptr->depth, rptr->stride, rptr->obj_size, rptr->size, rsz, rptr->desc ? rptr->desc : "",
                                                                                           ^~~~~~~~~~~~~~
./scp.c:16138:108: error: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Werror,-Wformat]
                        rptr->radix, rptr->width, rptr->offset, rptr->depth, rptr->stride, rptr->obj_size, rptr->size, rsz, rptr->desc ? rptr->desc : "",
                                                                                                           ^~~~~~~~~~
./scp.c:16138:120: error: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Werror,-Wformat]
                        rptr->radix, rptr->width, rptr->offset, rptr->depth, rptr->stride, rptr->obj_size, rptr->size, rsz, rptr->desc ? rptr->desc : "",
                                                                                                                       ^~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
./sim_console.c:1302:113: error: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Werror,-Wformat]
sim_debug (DBG_REP, &sim_remote_console, "sim_rem_con_repeat_svc(line=%" SIZE_T_FMT "u) - interval=%d usecs\n", line, rem->repeat_interval);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                      %zu
./scp.h:272:146: note: expanded from macro 'sim_debug'
#define sim_debug(dbits, dptr, ...) do { if ((sim_deb != NULL) && ((dptr) != NULL) && ((dptr)->dctrl & (dbits))) _sim_debug_device (dbits, dptr, __VA_ARGS__);} while (0)
                                                                                                                                                 ^~~~~~~~~~~
./sim_console.c:1368:125: error: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Werror,-Wformat]
sim_debug (DBG_SAM, &sim_remote_console, "sim_rem_con_smp_collect_svc(line=%" SIZE_T_FMT "u) - interval=%d, dither=%d%%\n", line, rem->smp_sample_interval, rem->smp_sample_dither_pct);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                           %zu
./scp.h:272:146: note: expanded from macro 'sim_debug'
#define sim_debug(dbits, dptr, ...) do { if ((sim_deb != NULL) && ((dptr) != NULL) && ((dptr)->dctrl & (dbits))) _sim_debug_device (dbits, dptr, __VA_ARGS__);} while (0)
                                                                                                                                                 ^~~~~~~~~~~
2 errors generated.
./sim_tape.c:894:116: error: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Werror,-Wformat]
            return sim_messagef (SCPE_ARG, "TAR format block size of %" SIZE_T_FMT "u is not a multiple of 512\n", uptr->recsize);
                                                                     ~~~~~~~~~~~~~~~~                              ^~~~~~~~~~~~~
                                                                     %zu
./sim_tape.c:3645:83: error: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Werror,-Wformat]
                               (r != MTSE_EOM) ? "After processing" : "contains", data_total,
                                                                                  ^~~~~~~~~~
./sim_tape.c:4002:67: error: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Werror,-Wformat]
            sim_printf ("Writing %" SIZE_T_FMT "u byte record\n", rec_size);
                                 ~~~~~~~~~~~~~~~~                 ^~~~~~~~
                                 %zu
3 errors generated.
./sim_imd.c:164:96: error: format specifies type 'unsigned int' but the argument has type 'size_t' (aka 'unsigned long') [-Werror,-Wformat]
            sim_printf("SIM_IMD: Header read returned %" SIZE_T_FMT "u bytes instead of 5.\n", hdrBytes);
                                                      ~~~~~~~~~~~~~~~~                         ^~~~~~~~
                                                      %zu
1 error generated.
gmake[1]: *** [makefile:2302: BIN/pdp10] Error 1
@markpizz
Copy link
Contributor

I just tried: "gmake pdp10" on a cleanly installed FreeBSD 14.2 with the specified commit (feb155f) and do not see any problem.

Please provide the beginning output when building this way (which includes to gcc version). Also provide the specific version of FreeBSD.

@larsbrinkhoff
Copy link
Contributor Author

I don't have any info beyond what's available from the cirrus-ci.com link I posted.

@markpizz
Copy link
Contributor

I'm not sure if you're using the makefile or cmake building.

However both open-simh/simh and simh/simh build cleanly when the compiler is gcc vs cc. When using cc (aka clang), the errors you observe are reported when building open-simh/simh but not when building simh/simh.

  • Mark

@larsbrinkhoff
Copy link
Contributor Author

The SIMH build starts on line 666. https://cirrus-ci.com/task/5537648405643264?logs=main#L666

@markpizz
Copy link
Contributor

As indicated in the build output, it falls back to cc when gcc isn't available. For recent Unix environments this might actually work, while it didn't on older Unix versions. The observed failing behavior on FreeBSD building open-simh/simh (but not simh/simh) seems to be specific to FreeBSD's clang which on FreeBSD 13.x was clang 13.0.0 and on FreeBSD 14.x seems to be clang 18.1.6. Explicitly compiling on Ubuntu with clang 14.0.0 has no problems with building open-simh/simh. This might be worth fixing, or you could simply install gcc.

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

No branches or pull requests

2 participants