Trying to build on FreeBSD
Trying to build on FreeBSD, compilation stops at
[ 5%] Built target resources
[ 6%] Building C object CMakeFiles/lmdb.dir/lmdb/libraries/liblmdb/mdb.c.o
/tmp/executor/lmdb/libraries/liblmdb/mdb.c:5169:14: error: variable has incomplete
type 'union semun'
union semun semu;
^
/tmp/executor/lmdb/libraries/liblmdb/mdb.c:5169:8: note: forward declaration of
'union semun'
union semun semu;
^
1 error generated.
gmake[2]: *** [CMakeFiles/lmdb.dir/build.make:82: CMakeFiles/lmdb.dir/lmdb/libraries/liblmdb/mdb.c.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:445: CMakeFiles/lmdb.dir/all] Error 2
gmake: *** [Makefile:182: all] Error 2
As a workaround, in lmdb/libraries/liblmdb/mdb.c delete #ifdef _SEM_SEMUN_UNDEFINED and the next #endif.
Next issue:
[ 25%] Generating parse.tab.cpp
ld-elf.so.1: /usr/local/bin/bison: Undefined symbol "fread_unlocked@FBSD_1.6"
gmake[2]: *** [src/CMakeFiles/romlib.dir/build.make:586: src/parse.tab.cpp] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:845: src/CMakeFiles/romlib.dir/all] Error 2
Probably need something like
#if defined(OS_MACOSX) || defined(OS_SOLARIS) || defined(OS_FREEBSD) ||\
defined(OS_NETBSD) || defined(OS_OPENBSD) || defined(OS_DRAGONFLYBSD) ||\
defined(OS_ANDROID) || defined(CYGWIN) || defined(OS_AIX)
// Use fread/fwrite/fflush on platforms without _unlocked variants
#define fread_unlocked fread
#define fwrite_unlocked fwrite
#define fflush_unlocked fflush
#endif
somewhere...
https://www.freebsd.org/cgi/man.cgi?query=fread&sektion=3 says
The fread_unlocked() and fwrite_unlocked() functions are equivalent to
fread() and fwrite() respectively, except that the caller is responsible
for locking the stream with flockfile(3) before calling them. These
functions may be used to avoid the overhead of locking the stream and to
prevent races when multiple threads are operating on the same stream.
This indicates that fread_unlocked might exist on FreeBSD 13 but not on 12.1 which I am using.
Any help appreciated.
[ 6%] Building C object CMakeFiles/lmdb.dir/lmdb/libraries/liblmdb/mdb.c.o
/tmp/executor/lmdb/libraries/liblmdb/mdb.c:5169:14: error: variable has incomplete
type 'union semun'
union semun semu;
lmdb is an upstream project (https://github.com/LMDB/lmdb/); you could check if they've already fixed the problem upstream and report it to them otherwise.
[ 25%] Generating parse.tab.cpp
ld-elf.so.1: /usr/local/bin/bison: Undefined symbol "fread_unlocked@FBSD_1.6"
Apparently the bison binary you have installed crashes. Looks like it's this problem: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=253452
The conclusion there seems to be:
Short version is that project no longer distribute pre-built packages for 12.1, since this release is no longer supported. You need to build on your own, or update to a supported release.
Apparently the bison binary you have installed crashes.
You are right, I was looking in the wrong place. It's indeed an issue with the bison on my system.
Now running into
[ 57%] Building CXX object src/CMakeFiles/romlib.dir/serial.cpp.o
/tmp/executor/src/serial.cpp:200:19: error: field has incomplete type 'struct sgttyb'
struct sgttyb sgttyb;
^
/tmp/executor/src/serial.cpp:200:12: note: forward declaration of 'sgttyb'
struct sgttyb sgttyb;
^
/tmp/executor/src/serial.cpp:201:19: error: field has incomplete type 'struct tchars'
struct tchars tchars;
^
/tmp/executor/src/serial.cpp:201:12: note: forward declaration of 'tchars'
struct tchars tchars;
^
/tmp/executor/src/serial.cpp:541:19: error: variable has incomplete type
'struct sgttyb'
struct sgttyb sgttyb;
^
/tmp/executor/src/serial.cpp:200:12: note: forward declaration of 'sgttyb'
struct sgttyb sgttyb;
^
/tmp/executor/src/serial.cpp:542:19: error: variable has incomplete type
'struct tchars'
struct tchars tchars;
^
/tmp/executor/src/serial.cpp:201:12: note: forward declaration of 'tchars'
struct tchars tchars;
^
/tmp/executor/src/serial.cpp:616:21: error: use of undeclared identifier 'LPASS8'
csize = OURCS8;
^
/tmp/executor/src/serial.cpp:521:17: note: expanded from macro 'OURCS8'
#define OURCS8 (LPASS8)
^
/tmp/executor/src/serial.cpp:624:22: error: use of undeclared identifier 'ODDP'
parity = OURODDP;
^
/tmp/executor/src/serial.cpp:524:18: note: expanded from macro 'OURODDP'
#define OURODDP (ODDP)
^
/tmp/executor/src/serial.cpp:628:22: error: use of undeclared identifier 'EVENP'
parity = OUREVENP;
^
/tmp/executor/src/serial.cpp:525:19: note: expanded from macro 'OUREVENP'
#define OUREVENP (EVENP)
^
/tmp/executor/src/serial.cpp:665:27: error: use of undeclared identifier 'TANDEM'
sgttyb.sg_flags = TANDEM | CBREAK | parity;
^
/tmp/executor/src/serial.cpp:665:36: error: use of undeclared identifier 'CBREAK'
sgttyb.sg_flags = TANDEM | CBREAK | parity;
^
/tmp/executor/src/serial.cpp:683:20: error: use of undeclared identifier 'LLITOUT'
lclmode |= LLITOUT | LNOHANG | csize | LNOFLSH;
^
/tmp/executor/src/serial.cpp:683:30: error: use of undeclared identifier 'LNOHANG'
lclmode |= LLITOUT | LNOHANG | csize | LNOFLSH;
^
/tmp/executor/src/serial.cpp:683:48: error: use of undeclared identifier 'LNOFLSH'
lclmode |= LLITOUT | LNOHANG | csize | LNOFLSH;
^
/tmp/executor/src/serial.cpp:684:22: error: use of undeclared identifier 'TIOCSETP'
if(ioctl(fd, TIOCSETP, &sgttyb) < 0 || ioctl(fd, TIOCSETC, &tchars) < ...
^
/tmp/executor/src/serial.cpp:684:58: error: use of undeclared identifier 'TIOCSETC'
if(ioctl(fd, TIOCSETP, &sgttyb) < 0 || ioctl(fd, TIOCSETC, &tchars) < ...
^
/tmp/executor/src/serial.cpp:684:94: error: use of undeclared identifier 'TIOCLSET'
...&sgttyb) < 0 || ioctl(fd, TIOCSETC, &tchars) < 0 || ioctl(fd, TIOCLSET, &lclmo...
^
/tmp/executor/src/serial.cpp:704:19: error: variable has incomplete type
'struct sgttyb'
struct sgttyb sgttyb;
^
/tmp/executor/src/serial.cpp:200:12: note: forward declaration of 'sgttyb'
struct sgttyb sgttyb;
^
/tmp/executor/src/serial.cpp:705:19: error: variable has incomplete type
'struct tchars'
struct tchars tchars;
^
/tmp/executor/src/serial.cpp:201:12: note: forward declaration of 'tchars'
struct tchars tchars;
^
/tmp/executor/src/serial.cpp:714:18: error: use of undeclared identifier 'TIOCGETP'
if(ioctl(fd, TIOCGETP, &sgttyb) < 0 || ioctl(fd, TIOCGETC, &tchars) < 0)
^
/tmp/executor/src/serial.cpp:714:54: error: use of undeclared identifier 'TIOCGETC'
if(ioctl(fd, TIOCGETP, &sgttyb) < 0 || ioctl(fd, TIOCGETC, &tchars) < 0)
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
gmake[2]: *** [src/CMakeFiles/romlib.dir/build.make:2784: src/CMakeFiles/romlib.dir/serial.cpp.o] Fehler 1
gmake[1]: *** [CMakeFiles/Makefile2:846: src/CMakeFiles/romlib.dir/all] Fehler 2
gmake: *** [Makefile:182: all] Fehler 2
Ah, the serial port support code. Lots of old stuff in there. I haven't touched that code much myself.
At some point in the past, this code probably worked on various other UNIX systems which might be much closer to FreeBSD than to Linux, and it has #ifdefs for APPLE and works on Macs, so you might get it to work by experimenting with the various #ifdefs near the top.
Alternatively, you should get away with #if 0-ing everything starting from line 183 and adding a trivial empty void Executor::InitSerialDriver() {} instead. That'll just mean that the serial port driver wouldn't exist.
Looks like the right thing to do would be to use termios instead of sgtty. But indeed Serial is not important for me at the moment at all.
#if defined(__APPLE__)
// FIXME: #warning bad serial support right now
//TODO: this seems to use sgtty functions instead of termios.
#include <sgtty.h>
(...)
Alternatively, you should get away with #if 0-ing everything starting from line 183 and adding a trivial empty void Executor::InitSerialDriver() {} instead. That'll just mean that the serial port driver wouldn't exist.
This gets me to compile further. Thank you very much :+1:
Towards the end the missing Serial seems to be an issue again?
[ 89%] Built target romlib
[ 89%] Built target front-end-headless
[ 91%] Built target front-end-sdl
[ 91%] Linking CXX executable ../executor-sdl
ld: error: undefined symbol: C_ROMlib_serialopen(Executor::ParamBlockRec*, Executor::DCtlEntry*)
>>> referenced by serial.cpp
>>> serial.cpp.o:(Executor::traps::WrappedFunction<short (Executor::ParamBlockRec*, Executor::DCtlEntry*), &(C_ROMlib_serialopen(Executor::ParamBlockRec*, Executor::DCtlEntry*)), Executor::callconv::Register<Executor::callconv::D<0> (Executor::callconv::A<0>, Executor::callconv::A<1>)> >::init()::'lambda'(unsigned int)::operator()(unsigned int) const) in archive libromlib.a
ld: error: undefined symbol: C_ROMlib_serialopen(Executor::ParamBlockRec*, Executor::DCtlEntry*)
>>> referenced by serial.cpp
>>> serial.cpp.o:(Executor::traps::WrappedFunction<short (Executor::ParamBlockRec*, Executor::DCtlEntry*), &(C_ROMlib_serialopen(Executor::ParamBlockRec*, Executor::DCtlEntry*)), Executor::callconv::Register<Executor::callconv::D<0> (Executor::callconv::A<0>, Executor::callconv::A<1>)> >::init()::'lambda'(PowerCore&)::operator()(PowerCore&) const) in archive libromlib.a
ld: error: undefined symbol: C_ROMlib_serialprime(Executor::ParamBlockRec*, Executor::DCtlEntry*)
>>> referenced by serial.cpp
>>> serial.cpp.o:(Executor::traps::WrappedFunction<short (Executor::ParamBlockRec*, Executor::DCtlEntry*), &(C_ROMlib_serialprime(Executor::ParamBlockRec*, Executor::DCtlEntry*)), Executor::callconv::Register<Executor::callconv::D<0> (Executor::callconv::A<0>, Executor::callconv::A<1>)> >::init()::'lambda'(unsigned int)::operator()(unsigned int) const) in archive libromlib.a
ld: error: undefined symbol: C_ROMlib_serialprime(Executor::ParamBlockRec*, Executor::DCtlEntry*)
>>> referenced by serial.cpp
>>> serial.cpp.o:(Executor::traps::WrappedFunction<short (Executor::ParamBlockRec*, Executor::DCtlEntry*), &(C_ROMlib_serialprime(Executor::ParamBlockRec*, Executor::DCtlEntry*)), Executor::callconv::Register<Executor::callconv::D<0> (Executor::callconv::A<0>, Executor::callconv::A<1>)> >::init()::'lambda'(PowerCore&)::operator()(PowerCore&) const) in archive libromlib.a
ld: error: undefined symbol: C_ROMlib_serialctl(Executor::ParamBlockRec*, Executor::DCtlEntry*)
>>> referenced by serial.cpp
>>> serial.cpp.o:(Executor::traps::WrappedFunction<short (Executor::ParamBlockRec*, Executor::DCtlEntry*), &(C_ROMlib_serialctl(Executor::ParamBlockRec*, Executor::DCtlEntry*)), Executor::callconv::Register<Executor::callconv::D<0> (Executor::callconv::A<0>, Executor::callconv::A<1>)> >::init()::'lambda'(unsigned int)::operator()(unsigned int) const) in archive libromlib.a
ld: error: undefined symbol: C_ROMlib_serialctl(Executor::ParamBlockRec*, Executor::DCtlEntry*)
>>> referenced by serial.cpp
>>> serial.cpp.o:(Executor::traps::WrappedFunction<short (Executor::ParamBlockRec*, Executor::DCtlEntry*), &(C_ROMlib_serialctl(Executor::ParamBlockRec*, Executor::DCtlEntry*)), Executor::callconv::Register<Executor::callconv::D<0> (Executor::callconv::A<0>, Executor::callconv::A<1>)> >::init()::'lambda'(PowerCore&)::operator()(PowerCore&) const) in archive libromlib.a
ld: error: undefined symbol: C_ROMlib_serialstatus(Executor::ParamBlockRec*, Executor::DCtlEntry*)
>>> referenced by serial.cpp
>>> serial.cpp.o:(Executor::traps::WrappedFunction<short (Executor::ParamBlockRec*, Executor::DCtlEntry*), &(C_ROMlib_serialstatus(Executor::ParamBlockRec*, Executor::DCtlEntry*)), Executor::callconv::Register<Executor::callconv::D<0> (Executor::callconv::A<0>, Executor::callconv::A<1>)> >::init()::'lambda'(unsigned int)::operator()(unsigned int) const) in archive libromlib.a
ld: error: undefined symbol: C_ROMlib_serialstatus(Executor::ParamBlockRec*, Executor::DCtlEntry*)
>>> referenced by serial.cpp
>>> serial.cpp.o:(Executor::traps::WrappedFunction<short (Executor::ParamBlockRec*, Executor::DCtlEntry*), &(C_ROMlib_serialstatus(Executor::ParamBlockRec*, Executor::DCtlEntry*)), Executor::callconv::Register<Executor::callconv::D<0> (Executor::callconv::A<0>, Executor::callconv::A<1>)> >::init()::'lambda'(PowerCore&)::operator()(PowerCore&) const) in archive libromlib.a
ld: error: undefined symbol: C_ROMlib_serialclose(Executor::ParamBlockRec*, Executor::DCtlEntry*)
>>> referenced by serial.cpp
>>> serial.cpp.o:(Executor::traps::WrappedFunction<short (Executor::ParamBlockRec*, Executor::DCtlEntry*), &(C_ROMlib_serialclose(Executor::ParamBlockRec*, Executor::DCtlEntry*)), Executor::callconv::Register<Executor::callconv::D<0> (Executor::callconv::A<0>, Executor::callconv::A<1>)> >::init()::'lambda'(unsigned int)::operator()(unsigned int) const) in archive libromlib.a
ld: error: undefined symbol: C_ROMlib_serialclose(Executor::ParamBlockRec*, Executor::DCtlEntry*)
>>> referenced by serial.cpp
>>> serial.cpp.o:(Executor::traps::WrappedFunction<short (Executor::ParamBlockRec*, Executor::DCtlEntry*), &(C_ROMlib_serialclose(Executor::ParamBlockRec*, Executor::DCtlEntry*)), Executor::callconv::Register<Executor::callconv::D<0> (Executor::callconv::A<0>, Executor::callconv::A<1>)> >::init()::'lambda'(PowerCore&)::operator()(PowerCore&) const) in archive libromlib.a
ld: error: undefined symbol: SDLVideoDriver::putScrap(int, int, char*, int)
>>> referenced by sdlwin.cpp
>>> sdlwin.cpp.o:(vtable for SDLVideoDriver) in archive config/front-ends/sdl/libfront-end-sdl.a
ld: error: undefined symbol: SDLVideoDriver::getScrap(int, Executor::guestvalues::GuestWrapper<char*>*)
>>> referenced by sdlwin.cpp
>>> sdlwin.cpp.o:(vtable for SDLVideoDriver) in archive config/front-ends/sdl/libfront-end-sdl.a
ld: error: undefined symbol: we_lost_clipboard()
>>> referenced by sdlevents.cpp
>>> sdlevents.cpp.o:(SDLVideoDriver::runEventLoop()) in archive config/front-ends/sdl/libfront-end-sdl.a
c++: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[2]: *** [src/CMakeFiles/executor-sdl.dir/build.make:118: executor-sdl] Fehler 1
gmake[1]: *** [CMakeFiles/Makefile2:750: src/CMakeFiles/executor-sdl.dir/all] Fehler 2
gmake: *** [Makefile:182: all] Fehler 2
...and something about SDL. I have installed:
% sudo pkg info sdl sdl2
sdl-1.2.15_15,2
sdl2-2.0.12_3
Ah, about the serial stuff, I overlooked that: #if 0 lines 84-94 of serial.cpp, those REGISTER_FUNCTION_PTR macros generate references to some functions that I told you to remove before.
And the scrap (clipboard) code in the old SDL1 frontend is a big mess. The only reason I haven't deleted the whole thing yet is that I didn't get around to reimplementing it yet...
It's got an #ifdef __linux__ clause that actually should apply to SDL1 on X11. And apparently there's an #ifdef WIN32 that for some reason ended up inside this #ifdef __linux__ by mistake, which makes no sense at all.
Anyway, first try the #ifdef __linux__ in line 221 (change it to #ifdef __unix__ or #if 1 or something, I mean), and if all else fail, activate the #ifdef __APPLE__ code near the bottom of the file...
Thanks @autc04
Look what I have running: Executor 2000 on helloSystem FreeBSD

I am a bit surprised to see the grey background, I thought the Executor 2000 windows would be rootless?
What is the proper way to tell CMake to only configure and make the SDL2 version and not care about SDL1?
So far, there's no 'proper' way, the scripts just configure everything that has the prerequisites installed.
Rootless mode is currently implemented in the Qt and Wayland versions, not in the others. The Wayland version probably contains a few linuxisms, but the Qt version should be portable.
Then I will patch src/CMakeLists.txt so that it contains just set(FRONT_ENDS qt) for now.
Submitted a patch to FreeBSD Ports: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=254743