Troubleshooting building cgx 2.19 from source on Mac OS

I’m trying to build cgx 2.19 from source on Mac OS.

I’ve tried following the Mac instructions from 2015 (noting that they apply to a different version of macOS). When I run sudo make in the /usr/local/CalculiX/cgx_2.19/src folder I get the following error:

parser.c:91:3: error: implicit declaration of function 'DrawCommandLine' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  DrawCommandLine(keystroke, strlen(keystroke) + *curshft);

It seems like the function definition for DrawCommandLine is not getting included. I’m not very familiar with C/C++ but it seems that this function is included in cgx.c which itself is included by MakeFile.inc

Any ideas what’s going on?

in parser.c, change the first line:

#include <cgx.h>
/*#include <extUtil.h>

in pickfunctions.c, correct line 4597:

  return;

correct the makefile:

LFLAGS =
-L/usr/lib -lGL -lGLU
-L/usr/X11R6/lib -lX11 -lXi -lXmu -lXext -lXt -lSM -lICE
-lm -lpthread

Hi mparente,

Thanks for your reply. I’ve implemented the changes as you suggested, and the compilation does get a lot further. Now it seems to exit on the following error:

ld: library not found for -lSystem
collect2: error: ld returned 1 exit status
make: *** [cgx] Error 1

do you have XQuartz installed ?

Marco

Yes I do.

I think I’ve managed to get past the ld error by including this in the LFLAGS section in the makefile:

-L /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib \

It seems the compilation runs without errors, but ends with a lot of warnings like this:

ld: warning: object file (/var/tmp//ccrWCwNi.o) was built for newer macOS version (12.0) than being linked (10.17.4)
ld: warning: object file (/var/tmp//cck4ppOP.o) was built for newer macOS version (12.0) than being linked (10.17.4)
ld: warning: object file (/var/tmp//cc8xH23e.o) was built for newer macOS version (12.0) than being linked (10.17.4)

ok. I have this on my .bashrc:

export LIBRARY_PATH=“$LIBRARY_PATH:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib”

on my Mac, after I open a .frd results file, I have to manually resize the cgx application window, for the model to show up. I first change its size to a small window then resize it to a normal one and the model shows up.

Marco

1 Like

Thank you so much. It’s working now. I indeed need to resize the window down until I get the following warning:

GLUT: Warning in cgx: glutReshapeWindow: non-positive width or height not allowed

Then when I resize up, the model is viewable.

Thanks again, you’ve been incredibly helpful.

:smile: glad to help

Best Regards
Marco

I had compiled it for macOS 10.13 some time ago but window was blank and I thought it didn’t work…thanks for the tip! Anyone knows what’s behind this behaviour?