GLVis / glvis

Lightweight OpenGL tool for accurate and flexible finite element visualization
http://glvis.org
BSD 3-Clause "New" or "Revised" License
249 stars 51 forks source link

Build GLVis using gcc under MacOS #264

Open JianboLong opened 11 months ago

JianboLong commented 11 months ago

Has anyone successfully built GLVis on MacOS using gcc installed by brew ? Related to a previous issue, it seems there's still troubles building GLVis this way. I wonder if there's any solution ? Please see my comment to that previous issue (#178)

          Hello @ilonster @tzanio  I am having similar troubles in building GLVis 4.2 on MacOS Ventura. For other reasons, I could only build MFEM using gcc, instead of Apple's clang. I am trying to build GLVis using the same compiler and flags, but got SDK related errors (see below).  Any solutions for this ?

g++ -O3 -std=c++11 -I../mfem_build -DGLVIS_MULTISAMPLE=4 -DGLVIS_MS_LINEWIDTH=1.0 -DGLVIS_OGL3 -DGLVIS_USE_LOGO -I/usr/local/include/freetype2 -I/usr/local/include -I/usr/local/include -I/usr/local/include -DGLVIS_USE_LIBPNG -o lib/sdl_mac.o -c lib/sdl_mac.mm g++ -O3 -std=c++11 -I../mfem_build -DGLVIS_MULTISAMPLE=4 -DGLVIS_MS_LINEWIDTH=1.0 -DGLVIS_OGL3 -DGLVIS_USE_LOGO -I/usr/local/include/freetype2 -I/usr/local/include -I/usr/local/include -I/usr/local/include -DGLVIS_USE_LIBPNG -o share/logo.rgba.bin.o -c share/logo.rgba.bin.cpp lib/sdl_mac.mm:37:4: error: stray '@' in program 37 | @autoreleasepool | ^ lib/sdl_mac.mm:50:4: error: stray '@' in program 50 | @autoreleasepool | ^ lib/sdl_mac.mm:82:4: error: stray '@' in program 82 | @autoreleasepool | ^ lib/sdl_mac.mm:92:4: error: stray '@' in program 92 | @autoreleasepool | ^ lib/sdl_mac.mm:102:4: error: stray '@' in program 102 | @autoreleasepool | ^ lib/sdl_mac.mm:113:4: error: stray '@' in program 113 | @autoreleasepool | ^ In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/dispatch/dispatch.h:63, from /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:20, from /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:17, from /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:66, from /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6, from /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12, from lib/sdl_mac.mm:13: /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/os/object.h:206:1: error: expected unqualified-id before 'interface' 206 | OS_OBJECT_DECL_BASE(object, NSObject); | ^~~~~~~ /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/os/workgroup_object.h:49:1: error:expected unqualified-id before 'interface' 49 | OS_WORKGROUP_DECL(os_workgroup, WorkGroup); | ^~~~~

Originally posted by @JianboLong in https://github.com/GLVis/glvis/issues/178#issuecomment-1732658451

v-dobrev commented 10 months ago

On Mac we have some Objective C++ sources that allow us to use some Mac-specific (Cocoa) stuff. I'm not sure GCC really supports this type of sources, so I think you need to use Apple's clang compiler, clang++.

tzanio commented 10 months ago

There is also a Mac binary that you can download and use directly: https://bit.ly/glvis-mac