jart / blink

tiniest x86-64-linux emulator
ISC License
7k stars 225 forks source link

Compilation problem on NetBSD #24

Open 0-wiz-0 opened 1 year ago

0-wiz-0 commented 1 year ago

I tried building blink on NetBSD-10.99.2/amd64, but it failed with:

In file included from /usr/include/sys/signal.h:112,
                 from /usr/include/signal.h:45,
                 from blink/blinkenlights.c:24:
./blink/linux.h:461:6: error: expected ':', ',', ';', '}' or '__attribute__' before '.' token
  461 |   u8 si_signo[4];
      |      ^~~~~~~~

I suspect because sys/siginfo.h has:

#define si_signo        _info._signo
jart commented 1 year ago

Thanks for reporting this. We shouldn't be using the si_ field name prefixes in our Linux structs. I'll push a change that updates this for si_signo and all the other ones too, which should avoid this potentially happening on other platforms too.

0-wiz-0 commented 1 year ago

Thanks for looking at this. The symbol I reported this for, si_signo, has not been changed by the commit, and the build still fails on NetBSD.

jart commented 1 year ago

I fixed all the build errors on NetBSD using my SDF shell. I'm having trouble getting Blink to fully pass tests though. The system is returning weird errors like EPERM when calling mprotect().

0-wiz-0 commented 1 year ago

Thanks. I don't know what exactly blink is doing, but NetBSD by default enables PaX MPROTECT, so pages can not be mapped writable and executable at the same time. If you need this, take a look at the official way but please note that there currently is a bug - second link includes a workaround. Does that help? If not, can you describe what you are doing?