v15 on macOS - fail to compile

Support and general discussion.
Post Reply
startmenu
Posts: 104
Joined: Sat 29 Nov, 2014 7:39 am

v15 on macOS - fail to compile

Post by startmenu » Thu 27 Jun, 2019 12:59 pm

I tried to compile PCem v15 on macOS 10.14. Though ./configure reported "checking for off64_t x86_64... no", it did generate an Makefile. And I saw these...

Code: Select all

esdi_at.c:110:35: error: unknown type name 'off64_t'; did you mean 'off_t'?
int esdi_get_sector(esdi_t *esdi, off64_t *addr)
                                  ^~~~~~~
                                  off_t
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_off_t.h:31:33: note: 
      'off_t' declared here
typedef __darwin_off_t          off_t;
                                ^
esdi_at.c:129:29: error: use of undeclared identifier 'off64_t'
                *addr = ((((off64_t) esdi->cylinder * heads) + esdi->head) *
                            ^
esdi_at.c:137:29: error: use of undeclared identifier 'off64_t'
                *addr = ((((off64_t) esdi->cylinder * heads) + esdi->head) *
                            ^
esdi_at.c:144:29: error: use of undeclared identifier 'off64_t'
                *addr = ((((off64_t) c * drive->hdd_file.hpc) + h) *
                            ^
esdi_at.c:420:9: error: unknown type name 'off64_t'; did you mean 'off_t'?
        off64_t addr;
        ^~~~~~~
        off_t
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/_types/_off_t.h:31:33: note: 
      'off_t' declared here
typedef __darwin_off_t          off_t;
                                ^
5 errors generated.
make[1]: *** [pcem-esdi_at.o] Error 1
make: *** [all-recursive] Error 1
it seems that Clang doesn't understand off64_t

TonyM
Posts: 14
Joined: Fri 15 Jul, 2016 8:11 pm

Re: v15 on macOS - fail to compile

Post by TonyM » Fri 09 Aug, 2019 3:19 pm

Did you ever find a solution to this? I'm running into the same issue on OS X 10.12.6

esdi_at.c:110:35: error: unknown type name 'off64_t'; did you mean 'off_t'?
int esdi_get_sector(esdi_t *esdi, off64_t *addr)
^~~~~~~
off_t
/usr/include/sys/_types/_off_t.h:30:25: note: 'off_t' declared here
typedef __darwin_off_t off_t;
^
esdi_at.c:129:29: error: use of undeclared identifier 'off64_t'
*addr = ((((off64_t) esdi->cylinder * heads) + esdi->head) *
^
esdi_at.c:137:29: error: use of undeclared identifier 'off64_t'
*addr = ((((off64_t) esdi->cylinder * heads) + esdi->head) *
^
esdi_at.c:144:29: error: use of undeclared identifier 'off64_t'
*addr = ((((off64_t) c * drive->hdd_file.hpc) + h) *
^
esdi_at.c:420:9: error: unknown type name 'off64_t'; did you mean 'off_t'?
off64_t addr;
^~~~~~~
off_t
/usr/include/sys/_types/_off_t.h:30:25: note: 'off_t' declared here
typedef __darwin_off_t off_t;
^
5 errors generated.
make[1]: *** [pcem-esdi_at.o] Error 1
make: *** [all-recursive] Error 1

User avatar
ruben_balea
Posts: 103
Joined: Mon 08 May, 2017 11:24 pm
Location: Spain

Re: v15 on macOS - fail to compile

Post by ruben_balea » Mon 12 Aug, 2019 6:15 am

In OS X off_t is already 64 bits so edit esdi_at.c and change the code from:

Code: Select all

#include <sys/types.h>

#include "ibm.h"
to:

Code: Select all

#include <sys/types.h>
#define off64_t off_t
#include "ibm.h"
or alternatively to:

Code: Select all

#include <sys/types.h>
typedef off_t off64_t;
#include "ibm.h"
...and try to compile again. I'm not sure which way is more appropriate.

TonyM
Posts: 14
Joined: Fri 15 Jul, 2016 8:11 pm

Re: v15 on macOS - fail to compile

Post by TonyM » Mon 12 Aug, 2019 2:35 pm

ruben_balea wrote:
Mon 12 Aug, 2019 6:15 am
In OS X off_t is already 64 bits so edit esdi_at.c and change the code from:

Code: Select all

#include <sys/types.h>

#include "ibm.h"
to:

Code: Select all

#include <sys/types.h>
#define off64_t off_t
#include "ibm.h"
or alternatively to:

Code: Select all

#include <sys/types.h>
typedef off_t off64_t;
#include "ibm.h"
...and try to compile again. I'm not sure which way is more appropriate.
Thank you! That worked. I also had to add that line to the following four files:

Code: Select all

hdd_file.c
ide.c
mfm_at.c
mfm_xebec.c
but once I did it compiled fine.

User avatar
ruben_balea
Posts: 103
Joined: Mon 08 May, 2017 11:24 pm
Location: Spain

Re: v15 on macOS - fail to compile

Post by ruben_balea » Mon 12 Aug, 2019 4:14 pm

I'm glad it helped you!
If that concerns several files it can be easier and faster to edit the Makefile instead, I noted that the provided Makefile.osx64-wx-sdl2 already has the switch -Doff64_t=__off64_t in CFLAGS variable:

Code: Select all

CFLAGS = -D__unix=1 -DPCEM_RENDER_WITH_TIMER -DPCEM_RENDER_TIMER_LOOP -Dfopen64=fopen -Dfseeko64=fseeko -Dftello64=ftello -Doff64_t=off_t -O3 -fomit-frame-pointer -msse2 -m64 $(shell wx-config --cxxflags) $(shell sdl2-config --cflags) -I/usr/local/opt/openal-soft/include -I/usr/local/include
Perhaps your autogenerated /src/Makefile is missing that option for whatever reason, edit /src/Makefile and find the CFLAGS = variable and add the switch -Doff64_t=__off64_t (separate it with a space from anything already present in that line)

Post Reply