OCC5.2 on Mac... Partial success

Finally I succeded to get OCC compiled and (partially) runnig on my Mac. Some problems still exist with dlcompat so that it is necessary to symlink from .so to .dylib but at least I have seen the first blocks from DRAWEXE. My diffs against my working Linux sources are below. I compiled until DRAWEXE which took about a week on my good old bluewhite.

Torsten

Index: src/OpenGl/OpenGl_togl_begin_layer_mode.c
===================================================================
--- src/OpenGl/OpenGl_togl_begin_layer_mode.c (revision 1)
+++ src/OpenGl/OpenGl_togl_begin_layer_mode.c (revision 4)
@@ -19,7 +19,7 @@
* Includes
*/

-#include
+#include

#include

Index: src/Standard/Standard_osd_ffi.c
===================================================================
--- src/Standard/Standard_osd_ffi.c (revision 1)
+++ src/Standard/Standard_osd_ffi.c (revision 4)
@@ -94,8 +94,8 @@
# define FAKE_DIR_ENTRY(dp) (dp->d_ino = 1)
#endif /* POSIX */

-DIR *dirp;
-struct dirent *dp;
+DIR *dirp=0;
+struct dirent *dp=0;

void tri(int taille, char *list,int l_tab);
int strcmp_joker(char *s1, char *s2);
Index: src/Standard/Standard.cxx
===================================================================
--- src/Standard/Standard.cxx (revision 1)
+++ src/Standard/Standard.cxx (revision 4)
@@ -68,6 +68,9 @@
#elif _AIX
#define MMAP_BASE_ADDRESS 0x80000000
#define MMAP_FLAGS (MAP_ANONYMOUS | MAP_PRIVATE | MAP_VARIABLE)
+#elif Darwin
+#define MMAP_BASE_ADDRESS 0x80000000
+#define MMAP_FLAGS (MAP_ANON | MAP_PRIVATE)
#elif WNT
typedef char * caddr_t;
static HANDLE hMap;
@@ -166,7 +169,7 @@
MMgt_OptAlloc = atoi((var = getenv("MMGT_OPT" )) ? var : "1" );
MMgt_Clear = atoi((var = getenv("MMGT_CLEAR" )) ? var : "1" );
MMgt_MMap = atoi((var = getenv("MMGT_MMAP" )) ? var : "1" );
- MMgt_Verbose = atoi((var = getenv("MMGT_VERBOSE" )) ? var : "0" );
+ MMgt_Verbose = atoi((var = getenv("MMGT_VERBOSE" )) ? var : "1" );
MMgt_CellSize = atoi((var = getenv("MMGT_CELLSIZE" )) ? var : "200" );
MMgt_NbPages = atoi((var = getenv("MMGT_NBPAGES" )) ? var : "10000");
MMgt_Threshold = atoi((var = getenv("MMGT_THRESHOLD")) ? var : "40000");
@@ -336,7 +339,7 @@
s s }
-#if !defined(WNT) && !defined(__FreeBSD__) && !defined(SOLARIS)
+#if !defined(WNT) && !defined(__FreeBSD__) && !defined(SOLARIS) && !defined(Darwin)
struct mallinfo info;
info = mallinfo();
cout Index: src/OSD/OSD_Csharedmemory.c
===================================================================
--- src/OSD/OSD_Csharedmemory.c (revision 1)
+++ src/OSD/OSD_Csharedmemory.c (revision 4)
@@ -3,7 +3,7 @@
#include
#include
#include
-#include
+#include

/* Modified by Stephan GARNAUD (ARM) 1992 for Matra Datavision */
Index: src/OSD/OSD_Path.cxx
===================================================================
--- src/OSD/OSD_Path.cxx (revision 1)
+++ src/OSD/OSD_Path.cxx (revision 4)
@@ -16,7 +16,7 @@
#endif

static OSD_SysType whereAmI(){
-#if defined(__digital__) || defined(__FreeBSD__) || defined(SUNOS)
+#if defined(__digital__) || defined(__FreeBSD__) || defined(SUNOS) || defined(Darwin)
return OSD_UnixBSD;
}
#elif defined(sgi) || defined(IRIX) || defined(__sun) || defined(SOLARIS) || defined(__sco__) || defined(__hpux) || defined(HPUX)
Index: src/StepFile/recfile.pc
===================================================================
--- src/StepFile/recfile.pc (revision 1)
+++ src/StepFile/recfile.pc (revision 4)
@@ -1,7 +1,7 @@
#include "stdio.h"
#include "string.h"
#include "stdlib.h"
-#include "malloc.h"
+#include "stdlib.h"
#include "recfile.ph"
/* enregistrement d'un fichier d'interface sous forme de records
gere les scopes
@@ -582,4 +582,3 @@

void steperror (char *mess);
int steplex (void);
-
Index: inc/IncludeLibrary_status.h
===================================================================
--- inc/IncludeLibrary_status.h (revision 1)
+++ inc/IncludeLibrary_status.h (revision 4)
@@ -8,7 +8,7 @@
# include
# include
#else
-#if !defined(__hpux) && !defined(HPUX) && !defined(__FreeBSD__)
+#if !defined(__hpux) && !defined(HPUX) && !defined(__FreeBSD__) && !defined(Darwin)
# include
#endif
#endif
Index: config.h
===================================================================
--- config.h (revision 0)
+++ config.h (revision 4)
@@ -0,0 +1,416 @@
+#ifdef HAVE_WOK_CONFIG_H
+
+/*---------------------------------------------------------*/
+/* This part is extracted from config.h generated on Linux */
+/*---------------------------------------------------------*/
+
+#ifdef Linux
+#define LINUX
+#define LININTEL
+#error Linux
+#elifdef Darwin
+#define DARWIN
+#error Darwin
+#endif
+
+#ifdef Darwin
+#undef DEF_IOS_OK
+#define HAVE_ALLOCA_H 1
+#define HAVE_FSTREAM 1
+#define HAVE_IOSTREAM 1
+#define HAVE_IOMANIP 1
+#define HAVE_BITS_SIGSET_H 1
+#define HAVE_DIRENT_H 1
+#define HAVE_DLFCN_H 1
+#define HAVE_DPS_DPSXCLIENT_H 1
+#define HAVE_FINITE
+#define HAVE_FLOAT_H 1
+#define HAVE_GETHOSTNAME 1
+#define HAVE_GETOPT_H 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_IOMANIP_H 1
+#define HAVE_IOS 1
+#define HAVE_ISTREAM 1
+#define HAVE_LIMITS 1
+/*#define HAVE_MALLOC_H 1*/
+#define HAVE_MEMORY_H 1
+#define HAVE_NETDB_H 1
+#define HAVE_NET_IF_H 1
+#define HAVE_PUTENV 1
+#define HAVE_PWD_H 1
+#define HAVE_REGCOMP 1
+#define HAVE_RE_COMP 1
+#define HAVE_SIGNAL_H 1
+#define HAVE_STATFS 1
+/*#define HAVE_STATVFS 1*/
+#define HAVE_STDINT_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRCSPN 1
+#define HAVE_STRDUP 1
+#define HAVE_STREAM_H 1
+#define HAVE_STRINGS_H 1
+#define HAVE_STRING_H 1
+#define HAVE_STRSTREAM_H 1
+#define HAVE_STRTOL 1
+#define HAVE_SYS_DIR_H 1
+#define HAVE_SYS_IOCTL_H 1
+#define HAVE_SYS_IPC_H 1
+#define HAVE_SYS_MMAN_H 1
+#define HAVE_SYS_PARAM_H 1
+#define HAVE_SYS_SELECT_H 1
+#define HAVE_SYS_SEM_H 1
+#define SEMUN_DEFINED
+#define HAVE_SYS_SIGNAL_H 1
+#define HAVE_SYS_SOCKET_H 1
+#define HAVE_SYS_STATVFS_H 1
+#define HAVE_SYS_STAT_H 1
+#define HAVE_SYS_TIMES_H 1
+#define HAVE_SYS_TIME_H 1
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_SYS_UNISTD_H 1
+#define HAVE_SYS_UTSNAME_H 1
+/*#define HAVE_SYS_VFS_H 1*/
+#define HAVE_TIME_H 1
+#define HAVE_UNISTD_H 1
+/*#define HAVE_VALUES_H 1*/
+#define HAVE_X11_EXTENSIONS_MULTIBUF_H 1
+#define OSTREAM_FORM_OK
+#define PACKAGE "OpenCAS"
+#define PROTOTYPES 1
+#define RETSIGTYPE void
+#define STDC_HEADERS 1
+#define VERSION "4.0DVP1"
+#ifndef _ALL_SOURCE
+/* # undef _ALL_SOURCE */
+#endif
+#endif
+
+#endif

Jules's picture

Did you inspire yourself from the forum that I posted a few months ago about building OC5 on OS X? Also what are the specs of the mac that you are using to build OC 5.2 please?

Let me know.

Jules

Torsten Sadowski's picture

Hi Jules,

Sorry for my late reply. I checked the notify box but never got notified. I tried to compile 5.1 about the same time as you (you have been an inspiration), gave up and revived my efforts with 5.2 which I found much more compatible with gcc3.3. There is still a mmap() problem which leads to crashes. The sample application does also work with fink and Qt.
My machine is a good old Blue/White and compiling everything takes several days.

If you want to you can reach me with
torsten.sadowski(a)tu-berlin.de

Torsten