building CLK (clock signal) under FreeBSD?

Has anyone tried building CLK under FreeBSD?
It uses scons as a build system, so the build command is just scons in the OSBindings/SDL directory.
However, the build fails here:
Code:
CC -o /zs/tingo/work/emul/CLK/Storage/Disk/DiskImage/Formats/Utility/ImplicitSectors.o -c --std=c++17 -Wall -O2 -DNDEBUG -D_REENTRANT -D_THREAD_SAFE -I/usr/local/include/SDL2 -I/usr/local/include /zs/tingo/work/emul/CLK/Storage/Disk/DiskImage/Formats/Utility/ImplicitSectors.cpp
/zs/tingo/work/emul/CLK/Storage/Disk/DiskImage/Formats/Utility/ImplicitSectors.cpp:24:2: error: unknown type name 'off_t'
        off_t byte_size = off_t(128 << size);
        ^
/zs/tingo/work/emul/CLK/Storage/Disk/DiskImage/Formats/Utility/ImplicitSectors.cpp:24:20: error: use of undeclared identifier 'off_t'
        off_t byte_size = off_t(128 << size);
                          ^
/zs/tingo/work/emul/CLK/Storage/Disk/DiskImage/Formats/Utility/ImplicitSectors.cpp:25:2: error: unknown type name 'off_t'
        off_t source_pointer = 0;
        ^
3 errors generated.
scons: *** [/zs/tingo/work/emul/CLK/Storage/Disk/DiskImage/Formats/Utility/ImplicitSectors.o] Error 1
scons: building terminated because of errors.
the build instructions claims it should build on BSD, but I'm unsure on how to correctly fix that missing 'off_t' definition (it's not missing in FreeBSD, it is defined several places).
 
Well, lseek(2) suggests off_t should be found in <unistd.h>, so the first thing I'd check would be whether this include is missing from ImplicitSectors.cpp. If it is, file a bug report with the project ;)
 
Code:
#include <stdio.h>
#include <sys/types.h>
int
main()
{
        printf("%lu\n", sizeof(off_t));
        return 0;
}
$ ./a.out
8

Check the sys/types.h. It's 64 bit in FreeBSD. maybe it need to be 32 bit. try to redefine it as 32bit

OR:
change off_t to size_t
 
Check the sys/types.h. It's 64 bit in FreeBSD. maybe it need to be 32 bit. try to redefine it as 32bit
Did you read the error message in the OP? The problem is that off_t is not declared, nothing about its size. But most certainly, a 32bit off_t would be broken, it's specifically used with lseek(2). (And I doubt <sys/types.h> is really the POSIX way to pull it in, but not so sure about that.)
change off_t to size_t
Very bad idea! Not only can off_t be larger than size_t, it's also signed while size_t is not.
 
  • Like
Reactions: a6h
I was able to make it compile by adding
Code:
#include <unistd.h>
to CLK/Storage/Storage.hpp
not sure if this is the correct way, but at least now it starts
Code:
tingo@kg-core1$ ./clksignal
Unknown machine:     
tingo@kg-core1$ ./clksignal --new=Oric
Could not find system ROMs; please install to /usr/local/share/CLK/ or /usr/share/CLK/, or provide a --rompath.
One or more of the following was needed but not found:
Oric/colour.rom (the Oric colour ROM; accepted crc32s: d50fca65)
Oric/basic11.rom (Oric BASIC 1.1; accepted crc32s: c3a92bef)
I don't have any ROMs now, so can't test more.
 
Back
Top