MacOs - can't install with xcode avec cmake

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


tchoune
Gnoblar
Posts: 4
Joined: Sun Feb 04, 2024 6:51 pm

MacOs - can't install with xcode avec cmake

Post by tchoune »

Good morning,
I tried to compile ogre 3D next with the manual or automatic method but I found myself having problems.
I'm running macos 14.2.1 (23C71) with Cmake 3.28.3.
I always get this error, when I try to compile have you already tried to build with macos?

here the console.log of build
https://pastebin.com/nswzf2qn

Do you have a tutorial or resources for compiling with the latest version on xcode ?

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5476
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1358

Re: MacOs - can't install with xcode avec cmake

Post by dark_sylinc »

Hi!

Yes, see the Setting Up section of the Manual.

You need to instruct CMake to use the XCode generator. The make generator will not work. We recommend the quick start scripts which contain all the commands needed.

Cheers
Matias

tchoune
Gnoblar
Posts: 4
Joined: Sun Feb 04, 2024 6:51 pm

Re: MacOs - can't install with xcode avec cmake

Post by tchoune »

Thanks for your message, I tried to run the script via terminal with sh. But I'm facing a problem during configuration:

Do I also have to pre-configure the xcode compiler in terminal via cmake? If yes, how ?
In the Dependencies folder in Ogre-Next. But unfortunately in the build folder, I don't see any xcode project.

thanks in advanced for your help !

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5476
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1358

Re: MacOs - can't install with xcode avec cmake

Post by dark_sylinc »

Hi!

This is the first time this error but I strongly suspect our CMake script really does not like the string c++ in its path.

Try moving the project to a diferent folder with only alphabetical characters, e.g. move it to /Users/tchoune/Documents/dev/cplusplus/Ogre/ogre-next/.

tchoune
Gnoblar
Posts: 4
Joined: Sun Feb 04, 2024 6:51 pm

Re: MacOs - can't install with xcode avec cmake

Post by tchoune »

Hi there!

I solved the problem by deleting freetype.framework from /Library/Framework


Thank you very much for your help, indeed I'm stupid the problem came from here path with the "++".
The solution is for me to create an xcodeproject in my directory, but the build still gives me an error with freetype I think?
But I've installed it on my system via brew (I've just checked). Do you have any idea why it can't finalize the build?

Here the console build script log :

It's my freetype brew info :

Code: Select all

tchoune@yannicks-MacBook-Pro lib % brew info freetype
==> freetype: stable 2.13.2 (bottled)
Software library to render fonts
https://www.freetype.org/
/opt/homebrew/Cellar/freetype/2.13.2 (67 files, 2.4MB) *
  Poured from bottle using the formulae.brew.sh API on 2023-09-20 at 21:56:56
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/f/freetype.rb
License: FTL
==> Dependencies
Build: pkg-config ✔
Required: libpng ✘
==> Analytics
install: 74,361 (30 days), 237,528 (90 days), 1,118,888 (365 days)
install-on-request: 4,181 (30 days), 13,982 (90 days), 83,046 (365 days)
build-error: 1 (30 days)

Thanks in advance!
Yannick

Last edited by tchoune on Tue Feb 06, 2024 9:28 am, edited 2 times in total.
tchoune
Gnoblar
Posts: 4
Joined: Sun Feb 04, 2024 6:51 pm

Re: MacOs - can't install with xcode avec cmake

Post by tchoune »

Obviously I still have problems starting a project. I used the build script. I went to Ogre/ogre-next to make the following commands:

Code: Select all

cmake -D OGRE_BUILD_RENDERSYSTEM_GL3PLUS=OFF \
       -D OGRE_BUILD_LIBS_AS_FRAMEWORKS=NO \
       -D OGRE_PLUGIN_LIB_PREFIX=lib \
       -D CMAKE_CXX_STANDARD=11 \
       -D CMAKE_INSTALL_PREFIX=/Users/tchoune/Documents/dev/cplusplus/Ogre/ogre-next/sdk \
       -D CMAKE_CXX_FLAGS="-I/usr/local/include -F/Library/Frameworks" \
       -D CMAKE_INSTALL_NAME_DIR=/Users/tchoune/Documents/dev/cplusplus/Ogre/ogre-next/sdk/lib .
cmake .
make -j4 install

Unfortunately, I don't have the files requested in SDK: $PWD/sdk/plugins_tools_d.cfg and $PWD/sdk/plugins_tools.cfg, I only have in $PWD/sdk :

Code: Select all

tchoune@yannicks-MacBook-Pro sdk % ls -l
total 0
drwxr-xr-x  14 tchoune  staff   448 Feb  6 13:06 CMake
drwxr-xr-x  18 tchoune  staff   576 Feb  6 13:06 Media
drwxr-xr-x  61 tchoune  staff  1952 Feb  6 14:27 bin
drwxr-xr-x   4 tchoune  staff   128 Feb  6 13:09 include
drwxr-xr-x  21 tchoune  staff   672 Feb  6 14:27 lib

I did find a file in SDK/bin/plugins_tools.cfg that I'm replacing with :

Code: Select all

# Defines plugins to load

# Define plugin folder
PluginFolder=/Users/tchoune/Documents/dev/cplusplus/Ogre/ogre-next/sdk/lib

# Define plugins
Plugin=RenderSystem_NULL

Once I've copied the EmptyProject folder from sample 2.0 and renamed it "gameone" and made a symbolic link in

Code: Select all

~/Document/dev/cplusplus/gameone/Dependencies/Ogre

to the

Code: Select all

~/Document/dev/cplusplus/Ogre/ogre-next/

folder

I changed the project variable in ./gameone/CMakeList.txt to : project( gameone )

and run the following commands in the gameone build folder:

Code: Select all

tchoune@yannicks-MacBook-Pro build % cmake -DCMAKE_BUILD_TYPE=Debug -DOGRE_BUILD_LIBS_AS_FRAMEWORKS=0 -DOGRE_STATIC=1 ..
CMake Deprecation Warning at CMakeLists.txt:13 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- OgreNext lib name prefix is Ogre
-- Detected DLL build of OgreNext
-- Found SDL2
-- Detected Metal RenderSystem. Linking against it.
-- Copying Hlms data files from Ogre repository
-- Copying Common data files from Ogre repository
-- Copying DLLs and generating Plugins.cfg for Debug
-- Copying DLLs and generating Plugins.cfg for Release
-- Copying DLLs and generating Plugins.cfg for RelWithDebInfo
-- Copying DLLs and generating Plugins.cfg for MinSizeRel
-- Generating /Users/tchoune/Documents/dev/cplusplus/gameone/bin/Data/resources2.cfg from template
		/Users/tchoune/Documents/dev/cplusplus/gameone/CMake/Templates/Resources.cfg.in
-- Copying OgreSamplesCommon cpp and header files to
		/Users/tchoune/Documents/dev/cplusplus/gameone/include/OgreCommon
		/Users/tchoune/Documents/dev/cplusplus/gameone/src/OgreCommon/
-- Configuring done (0.1s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/tchoune/Documents/dev/cplusplus/gameone/build
tchoune@yannicks-MacBook-Pro build % make                                                                               
... In file included from /Users/tchoune/Documents/dev/cplusplus/gameone/src/OgreCommon/Utils/TestUtils.cpp:8: In file included from /Users/tchoune/Documents/dev/cplusplus/gameone/Dependencies/Ogre/OgreMain/include/OgreRoot.h:34: In file included from /Users/tchoune/Documents/dev/cplusplus/gameone/Dependencies/Ogre/OgreMain/include/OgreSceneManagerEnumerator.h:33: In file included from /Users/tchoune/Documents/dev/cplusplus/gameone/Dependencies/Ogre/OgreMain/include/OgreSceneManager.h:40: In file included from /Users/tchoune/Documents/dev/cplusplus/gameone/Dependencies/Ogre/OgreMain/include/OgreAutoParamDataSource.h:33: In file included from /Users/tchoune/Documents/dev/cplusplus/gameone/Dependencies/Ogre/OgreMain/include/OgreLight.h:35: In file included from /Users/tchoune/Documents/dev/cplusplus/gameone/Dependencies/Ogre/OgreMain/include/OgreMovableObject.h:36: In file included from /Users/tchoune/Documents/dev/cplusplus/gameone/Dependencies/Ogre/OgreMain/include/Math/Array/OgreObjectData.h:32: In file included from /Users/tchoune/Documents/dev/cplusplus/gameone/Dependencies/Ogre/OgreMain/include/Math/Array/OgreArrayAabb.h:44: In file included from /Users/tchoune/Documents/dev/cplusplus/gameone/Dependencies/Ogre/OgreMain/include/Math/Array/NEON/Single/OgreArrayAabb.h:38: In file included from /Users/tchoune/Documents/dev/cplusplus/gameone/Dependencies/Ogre/OgreMain/include/Math/Simple/OgreAabb.h:41: In file included from /Users/tchoune/Documents/dev/cplusplus/gameone/Dependencies/Ogre/OgreMain/include/Math/Simple/C/OgreAabb.h:176: /Users/tchoune/Documents/dev/cplusplus/gameone/Dependencies/Ogre/OgreMain/include/Math/Simple/C/OgreAabb.inl:109:16: warning: use of bitwise '&' with boolean operands [-Wbitwise-instead-of-logical] return ( Math::Abs( dist.x ) <= sumHalfSizes.x ) & ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/tchoune/Documents/dev/cplusplus/gameone/Dependencies/Ogre/OgreMain/include/Math/Simple/C/OgreAabb.inl:109:16: note: cast one or both operands to int to silence this warning /Users/tchoune/Documents/dev/cplusplus/gameone/Dependencies/Ogre/OgreMain/include/Math/Simple/C/OgreAabb.inl:109:16: warning: use of bitwise '&' with boolean operands [-Wbitwise-instead-of-logical] return ( Math::Abs( dist.x ) <= sumHalfSizes.x ) & ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ && /Users/tchoune/Documents/dev/cplusplus/gameone/Dependencies/Ogre/OgreMain/include/Math/Simple/C/OgreAabb.inl:109:16: note: cast one or both operands to int to silence this warning /Users/tchoune/Documents/dev/cplusplus/gameone/Dependencies/Ogre/OgreMain/include/Math/Simple/C/OgreAabb.inl:130:16: warning: use of bitwise '&' with boolean operands [-Wbitwise-instead-of-logical] return ( Math::Abs( dist.x ) + other.mHalfSize.x <= mHalfSize.x ) & ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/tchoune/Documents/dev/cplusplus/gameone/Dependencies/Ogre/OgreMain/include/Math/Simple/C/OgreAabb.inl:130:16: note: cast one or both operands to int to silence this warning /Users/tchoune/Documents/dev/cplusplus/gameone/Dependencies/Ogre/OgreMain/include/Math/Simple/C/OgreAabb.inl:130:16: warning: use of bitwise '&' with boolean operands [-Wbitwise-instead-of-logical] return ( Math::Abs( dist.x ) + other.mHalfSize.x <= mHalfSize.x ) & ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ && /Users/tchoune/Documents/dev/cplusplus/gameone/Dependencies/Ogre/OgreMain/include/Math/Simple/C/OgreAabb.inl:130:16: note: cast one or both operands to int to silence this warning /Users/tchoune/Documents/dev/cplusplus/gameone/Dependencies/Ogre/OgreMain/include/Math/Simple/C/OgreAabb.inl:142:16: warning: use of bitwise '&' with boolean operands [-Wbitwise-instead-of-logical] return ( Math::Abs( dist.x ) <= mHalfSize.x ) & ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/tchoune/Documents/dev/cplusplus/gameone/Dependencies/Ogre/OgreMain/include/Math/Simple/C/OgreAabb.inl:142:16: note: cast one or both operands to int to silence this warning /Users/tchoune/Documents/dev/cplusplus/gameone/Dependencies/Ogre/OgreMain/include/Math/Simple/C/OgreAabb.inl:142:16: warning: use of bitwise '&' with boolean operands [-Wbitwise-instead-of-logical] return ( Math::Abs( dist.x ) <= mHalfSize.x ) & ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ && /Users/tchoune/Documents/dev/cplusplus/gameone/Dependencies/Ogre/OgreMain/include/Math/Simple/C/OgreAabb.inl:142:16: note: cast one or both operands to int to silence this warning 10 warnings generated. [100%] Linking CXX executable /Users/tchoune/Documents/dev/cplusplus/gameone/bin/Debug/gameone.app/Contents/MacOS/gameone ld: warning: search path '/Users/tchoune/Documents/dev/cplusplus/gameone/Dependencies/Ogre/build/lib/$(PLATFORM_NAME)/$(CONFIGURATION)' not found ld: library 'RenderSystem_Metal1' not found clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: *** [/Users/tchoune/Documents/dev/cplusplus/gameone/bin/Debug/gameone.app/Contents/MacOS/gameone] Error 1 make[1]: *** [CMakeFiles/gameone.dir/all] Error 2 make: *** [all] Error 2

and the Ogre/build/lib/.. :

Code: Select all

tchoune@yannicks-MacBook-Pro gameone % cd /Users/tchoune/Documents/dev/cplusplus/gameone/Dependencies/Ogre/build/lib/
tchoune@yannicks-MacBook-Pro lib % ls
Debug		RelWithDebInfo	macosx
tchoune@yannicks-MacBook-Pro lib % cd Debug 
tchoune@yannicks-MacBook-Pro Debug % ls
Ogre.framework		libOgreSamplesCommon.a

it makes a mistake I don't understand. Have there been any differences between the tutorial and the engine's evolutions in terms of folder and file locations?

Thanks in advance,
Yannick

Last edited by tchoune on Tue Feb 06, 2024 3:14 pm, edited 10 times in total.
tchoune
Gnoblar
Posts: 4
Joined: Sun Feb 04, 2024 6:51 pm

Re: MacOs - can't install with xcode avec cmake

Post by tchoune »

Any ideas ? :)
i have tried with cmake gui and choose Xcode configuration, but doesn't work
Image

Last edited by tchoune on Wed Feb 07, 2024 9:58 pm, edited 1 time in total.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5476
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1358

Re: MacOs - can't install with xcode avec cmake

Post by dark_sylinc »

Sigh. macOS always gives me problems.

It seems you found a bug. isOgreNext() is supposed to determine whether OgreNext was compiled with CMake option OGRE_USE_NEW_PROJECT_NAME set or unset, but the code path is broken for macOS.

As a quick workaround you can manually replace isOgreNext in CMake/Dependencies/OGRE.cmake with:

Code: Select all

macro( isOgreNext RESULT_VARIABLE )
    set( ${RESULT_VARIABLE} FALSE )
    #or set( ${RESULT_VARIABLE} TRUE ) if OGRE_USE_NEW_PROJECT_NAME is set
endmacro()

I'll open a ticket on github to track the bug.

Update: Ticket opened.

tchoune
Gnoblar
Posts: 4
Joined: Sun Feb 04, 2024 6:51 pm

Re: MacOs - can't install with xcode avec cmake

Post by tchoune »

After much trial and error, I finally managed to build the solution.
Even with a different folder name.
It's just that the tutorial isn't complete.
On CMake with the emptyproject that I renamed to Gameone for the test. The value key is missing: CMAKE_BUILD_TYPE = Debug. Once this is set, the project is configured and generated with the xcode solution.

Image

tchoune
Gnoblar
Posts: 4
Joined: Sun Feb 04, 2024 6:51 pm

Re: MacOs - can't install with xcode avec cmake

Post by tchoune »

To continue my installation adventure. I potentially have a problem with the EmptyProject, when I build it without having modified anything in it, it generates an error, but the compilation goes ahead.
I don't have enough experience to know if this is a normal error.

An icon in the finder appears, but nothing is displayed on the screen.

Image