Mac OSX: build errors

Added by adaptive about 8 years ago

RTI, anyone, help?

With OSX 10.5.7, both w/wo -DWITH_COCOA, I get these errors:

/Users/gary/Documents/repo/ryzom/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp:1971:3: warning: #warning "OpenGL Driver: Missing Mac Implementation"
/Users/gary/Documents/repo/ryzom/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp: In member function 'bool NL3D::CDriverGL::setWindowStyle(NL3D::CDriverGL::EWindowStyle)':
/Users/gary/Documents/repo/ryzom/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp:1077: error: 'XSetWindowAttributes' was not declared in this scope
/Users/gary/Documents/repo/ryzom/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp:1077: error: expected ';' before 'attr'
/Users/gary/Documents/repo/ryzom/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp:1092: error: 'attr' was not declared in this scope
/Users/gary/Documents/repo/ryzom/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp:1092: error: 'False' was not declared in this scope
/Users/gary/Documents/repo/ryzom/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp:1095: error: 'CWOverrideRedirect' was not declared in this scope
/Users/gary/Documents/repo/ryzom/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp:1097: error: '_dpy' was not declared in this scope
/Users/gary/Documents/repo/ryzom/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp:1097: error: 'XChangeWindowAttributes' was not declared in this scope
make2: * [src/3d/driver/opengl/CMakeFiles/nel_drv_opengl.dir/driver_opengl_window.cpp.o] Error 1
make1:
[src/3d/driver/opengl/CMakeFiles/nel_drv_opengl.dir/all] Error 2
make: *
* [all] Error 2

Thanks!


Replies (12)

RE: Mac OSX: 'XSetWindowAttributes' was not declared in this scope - Added by rti about 8 years ago

Yay. Nice to see someone trying the Mac version :)

The error you got seems to be related to some refactoring going on in the driver recently. I just commited a version that adapts to that (r399).
I only tested the WITH_COCOA version though, I will build a X11 version now and see if I can reproduce the error.

I am very interested in how the cocoa version works on 10.5 in 32bit, since I am only worked on 10.6 64bit until now. Hope all the APIs work the same way on 10.5.

With the new version, the ryzom cmake call needs the WITH_COCOA option as well!

Hope the new version works better for you. Good luck!

RE: Mac OSX: 'XSetWindowAttributes' was not declared in this scope - Added by rti about 8 years ago

The X11 build is working as well for me. Could you re-check that with the latest version please?

RE: Mac OSX: 'XSetWindowAttributes' was not declared in this scope - Added by adaptive about 8 years ago

Thanks! That did help.

Now I'm getting this

[ 68%] Building CXX object src/3d/driver/opengl/CMakeFiles/nel_drv_opengl.dir/mac/cocoa_opengl_view.m.o
In file included from /System/Library/Frameworks/Foundation.framework/Headers/NSAffineTransform.h:5,
from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:13,
from /System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12,
from /Users/gary/Documents/repo/ext/ryzom/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.h:19,
from /Users/gary/Documents/repo/ext/ryzom/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.m:19:
/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:122: error: expected ';' before '__attribute__'

Lots more errors follow, but maybe they all stem from that.

RE: Mac OSX: 'XSetWindowAttributes' was not declared in this scope - Added by rti about 8 years ago

Foundation.framework/Headers/NSObject.h:122: error: expected ';' before '__attribute__' ??? Funny :)

Could you please do a make VERBOSE=1 to see the command line executed to compile cocoa_opengl_view.m?

Which version of the developer tools is installed?
I have XCode 3.2.3 which comes with gcc 4.2.1 (Apple Inc. build 5664)

RE: Mac OSX: 'XSetWindowAttributes' was not declared in this scope - Added by rti about 8 years ago

This might be related: https://trac.macports.org/ticket/19051
mp-gcc43 was set as gcc link. Changing it to gcc40 (apple) via gcc_select solve compilation errors

Did you do any experiments with compiler versions and system default settings? :)

RE: Mac OSX: 'XSetWindowAttributes' was not declared in this scope - Added by adaptive about 8 years ago

localhost:~ gary$ gcc_select -l
Available versions:
gcc40 gcc42 llvm-gcc42 mp-gcc44

I got gcc44 through macport.

With VERBOSE=1 I get this error:

[ 68%] Building CXX object src/3d/driver/opengl/CMakeFiles/nel_drv_opengl.dir/mac/cocoa_opengl_view.m.o
cd /Users/gary/Documents/repo/ext/ryzom/code/nel/build-release/src/3d/driver/opengl && /opt/local/bin/c++ -Dnel_drv_opengl_EXPORTS -DHAVE_X86 -DUSE_JPEG -O3 -DNDEBUG -DNL_RELEASE -O6 -DNL_MAC_NATIVE -fPIC -I/Users/gary/Documents/repo/ext/ryzom/code/nel/include -I/Users/gary/Documents/repo/ext/ryzom/code/nel/src -I/opt/local/include/libxml2 -I/opt/local/include/freetype2 -I/Library/Frameworks/Mono.framework/Headers -o CMakeFiles/nel_drv_opengl.dir/mac/cocoa_opengl_view.m.o -c /Users/gary/Documents/repo/ext/ryzom/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.m
In file included from /System/Library/Frameworks/Foundation.framework/Headers/NSAffineTransform.h:5,
from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:13,
from /System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12,
from /Users/gary/Documents/repo/ext/ryzom/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.h:19,
from /Users/gary/Documents/repo/ext/ryzom/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.m:19:
/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:122: error: expected ';' before '__attribute__'

When I use the gcc40 I originally had (from XCode I downloaded back in the day?), with VERBOSE=1, I get this error:

[ 25%] Building CXX object src/3d/CMakeFiles/nel3d.dir/font_generator.cpp.o
In file included from /Users/gary/Documents/repo/ext/ryzom/code/nel/src/3d/font_generator.cpp:26:
/Users/gary/Documents/repo/ext/ryzom/code/nel/include/nel/3d/font_generator.h:24:22: error: ft2build.h: No such file or directory
/Users/gary/Documents/repo/ext/ryzom/code/nel/include/nel/3d/font_generator.h:25:10: error: #include expects "FILENAME" or <FILENAME>
In file included from /Users/gary/Documents/repo/ext/ryzom/code/nel/src/3d/font_generator.cpp:32:
/opt/local/include/freetype2/freetype/freetype.h:21:2: error: #error "`ft2build.h' hasn't been included yet!"
/opt/local/include/freetype2/freetype/freetype.h:22:2: error: #error "Please always use macros to include FreeType header files."
/opt/local/include/freetype2/freetype/freetype.h:23:2: error: #error "Example:"
/opt/local/include/freetype2/freetype/freetype.h:24:2: error: #error " #include <ft2build.h>"
/opt/local/include/freetype2/freetype/freetype.h:25:2: error: #error " #include FT_FREETYPE_H"
/opt/local/include/freetype2/freetype/freetype.h:34:10: error: #include expects "FILENAME" or <FILENAME>

Thanks!

RE: Mac OSX: 'XSetWindowAttributes' was not declared in this scope - Added by rti about 8 years ago

gcc42 is what I am using.

I am not sure why mp-gcc44 is not working, maybe it lacks objective-c support?
gcc40 does not have enough features afaik.

RE: Mac OSX: 'XSetWindowAttributes' was not declared in this scope - Added by adaptive about 8 years ago

Hmm, it won't let me actually select gcc 4.2.

Should I get it with macport or something?

localhost:build-release gary$ sudo gcc_select -l gcc42
Password:
Available versions:
gcc40 gcc42 llvm-gcc42 mp-gcc44
localhost:build-release gary$
localhost:build-release gary$ sudo gcc_select gcc42
Selecting version "gcc42" for gcc
localhost:build-release gary$
localhost:build-release gary$
localhost:build-release gary$ gcc --version
i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5490)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

RE: Mac OSX: 'XSetWindowAttributes' was not declared in this scope - Added by adaptive about 8 years ago

Now I'm having problems going back to 4.4:

localhost:build-release gary$ sudo gcc_select -l
Available versions:
gcc40 gcc42 llvm-gcc42 mp-gcc44
localhost:build-release gary$ sudo gcc_select mp-gcc44
Selecting version "mp-gcc44" for gcc
localhost:build-release gary$ gcc --version
gcc-mp-4.4: installation problem, cannot exec '/opt/local/bin/i686-apple-darwin9-gcc-4.0.1': No such file or directory
localhost:build-release gary$

RE: Mac OSX: 'XSetWindowAttributes' was not declared in this scope - Added by adaptive about 8 years ago

Switched to 4.2 by manipulating /opt/local/bin/gcc and /usr/bin/gcc directly. Thanks rti :)

Now, with cocoa, under 4.2, I get this error compiling NeL:

localhost:build-release gary$ make VERBOSE=1

[ 18%] Building CXX object src/3d/CMakeFiles/nel3d.dir/font_generator.cpp.o
cd /Users/gary/Documents/hg/ext/ryzom/code/nel/build-release/src/3d && /opt/local/bin/c++ -Dnel3d_EXPORTS -DHAVE_X86 -DUSE_JPEG -O3 -DNDEBUG -DNL_RELEASE -O6 -DNL_MAC_NATIVE -fPIC -I/Users/gary/Documents/hg/ext/ryzom/code/nel/include -I/Users/gary/Documents/hg/ext/ryzom/code/nel/src -I/opt/local/include/libxml2 -I/opt/local/include/freetype2 -I/Library/Frameworks/Mono.framework/Headers -o CMakeFiles/nel3d.dir/font_generator.cpp.o -c /Users/gary/Documents/hg/ext/ryzom/code/nel/src/3d/font_generator.cpp
In file included from /Users/gary/Documents/hg/ext/ryzom/code/nel/src/3d/font_generator.cpp:26:
/Users/gary/Documents/hg/ext/ryzom/code/nel/include/nel/3d/font_generator.h:24:22: error: ft2build.h: No such file or directory
/Users/gary/Documents/hg/ext/ryzom/code/nel/include/nel/3d/font_generator.h:25:10: error: #include expects "FILENAME" or <FILENAME>
In file included from /Users/gary/Documents/hg/ext/ryzom/code/nel/src/3d/font_generator.cpp:32:
/opt/local/include/freetype2/freetype/freetype.h:21:2: error: #error "`ft2build.h' hasn't been included yet!"

localhost:build-release gary$ gcc --version
i686-apple-darwin9-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5566)

RE: Mac OSX: build errors - Added by rti about 8 years ago

Hmm. I currently do not have my Mac at hand, but searching for ft2build.h on my Ubuntu machine showed, that ft2build.h does not seem to be included in the default freetype include directory.

rti@minini /usr/include % find . -name freetype.h
./freetype2/freetype/freetype.h
rti@minini /usr/include % find . -name ft2build.h
./ft2build.h

Might be the same issue on Mac OS. So, this is a problem of the FindFreetype cmake script. A similar issue already showed up with the FindLibwww script for the ryzom client. The Libwww distribution installs an additional header outside the libwww header directory as well.

For libwww, the following extension of the find script helped:

# when installing libwww on mac os x using macports the file wwwconf.h resides
# in /opt/local/include and not in the real libwww include dir :/
FIND_PATH(LIBWWW_ADDITIONAL_INCLUDE_DIR
  wwwconf.h
  PATHS
  /usr/local/include
  /usr/include
  /sw/include
  /opt/local/include
  /opt/csw/include
  /opt/include
)

# combine both include directories into one variable
IF(LIBWWW_ADDITIONAL_INCLUDE_DIR)
  SET(LIBWWW_INCLUDE_DIR ${LIBWWW_INCLUDE_DIR} ${LIBWWW_ADDITIONAL_INCLUDE_DIR})
ENDIF(LIBWWW_ADDITIONAL_INCLUDE_DIR)

This way you could make the FindFreetype script look for ft2build.h as well.

Hope that helps. If it works, feel free to submit a patch :)

rti

RE: Mac OSX: build errors - Added by rti about 8 years ago

Should be fixed with r430

(1-12/12)