OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

OSG Build Error on Mac OSX with XCode 7 and CMake 3.4 (or greater)


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> Build system [build]
View previous topic :: View next topic  
Author Message
ravidavi
User


Joined: 06 Nov 2015
Posts: 34

PostPosted: Mon Jul 18, 2016 6:17 am    Post subject:
OSG Build Error on Mac OSX with XCode 7 and CMake 3.4 (or greater)
Reply with quote

Hi all,

I'm surprised nobody has seen this yet, but OSG does not build on OSX when using XCode 7 and CMake 3.4+. Specifically, the Configure step can be run once, but cannot ever be run again unless the CMake cache is deleted. The error through by CMake is the infamous:
Code:
CMAKE_OSX_DEPLOYMENT_TARGET is '10.10' but CMAKE_OSX_SYSROOT:
   ""
  is not set to a MacOSX SDK with a recognized version.  Either set
  CMAKE_OSX_SYSROOT to a valid SDK or set CMAKE_OSX_DEPLOYMENT_TARGET to
  empty.

After hours of debugging, I found that this error only happens on CMake 3.4 and onward, which led me to see what changed in in that version. Basically, the OS initialization phase of CMake has changed how it uses the CMAKE_OSX_ARCHITECTURES variable, which according to CMake documentation should be set before the first call to PROJECT(). In OSG's CMakeLists.txt file, that variable is set waaaay down in line 1114:
Code:
SET(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Build architectures for OSX" FORCE)

So the fact that this ever worked was just good fortune, but it seems our luck has run out. Commenting out that line, or equivalently removing the FORCE flag, fixes the Configure-stage error for all versions of CMake.

Any thoughts on this? I think if CMAKE_OSX_ARCHITECTURES must be set in OSG, it should really be set before the first call to PROJECT. If we no longer have an OSX maintainer, then I can take a crack at coming up with a solution.

Thanks,
Ravi
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11190

PostPosted: Mon Jul 18, 2016 7:51 am    Post subject:
OSG Build Error on Mac OSX with XCode 7 and CMake 3.4 (or greater)
Reply with quote

Hi Ravi,

The OSX build support in the OSG has evolved over the year as has
CMake, but on the OSG side we've been in largely in maintenance mode
w.r.t our CMake build system i.e. we've tinkered with it to keep
things building.

On the OSX side I can't personally pitch in as I don't have an Mac and
don't have the OSX expertise to guide development, this means I have
to rely upon the community to do the testing and guide developments on
the OSX side. Unfortunately Mac's are a lesser used platform so the
pool of developers that can pitch in is smaller so the likelyhood of a
break as the platforms evolve is higher. This does mean OSX users
need to be more active relative to the wider OSG community to keep
things working, so I welcome yourself and others ptiching in.

With OSG-3.6 looming getting things sorted on all platforms is
crucial, if they are changes we need to make on the OSX side then I'm
open to suggestion/merging changes as required.

On thing I raised a couple of months back was the prospect of
increasing the minimum CMake version to 2.8. This may help things on
the OSX side.

Robert.

Robert.



On 18 July 2016 at 07:17, Ravi Mathur <> wrote:
Quote:
Hi all,

I'm surprised nobody has seen this yet, but OSG does not build on OSX when using XCode 7 and CMake 3.4+. Specifically, the Configure step can be run once, but cannot ever be run again unless the CMake cache is deleted. The error through by CMake is the infamous:

Code:
CMAKE_OSX_DEPLOYMENT_TARGET is '10.10' but CMAKE_OSX_SYSROOT:
""
is not set to a MacOSX SDK with a recognized version. Either set
CMAKE_OSX_SYSROOT to a valid SDK or set CMAKE_OSX_DEPLOYMENT_TARGET to
empty.



After hours of debugging, I found that this error only happens on CMake 3.4 and onward, which led me to see what changed in in that version. Basically, the OS initialization phase of CMake has changed how it uses the CMAKE_OSX_ARCHITECTURES variable, which according to CMake documentation (https://cmake.org/cmake/help/v3.5/variable/CMAKE_OSX_ARCHITECTURES.html) should be set before the first call to PROJECT(). In OSG's CMakeLists.txt file, that variable is set waaaay down in line 1114:

Code:
SET(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Build architectures for OSX" FORCE)



So the fact that this ever worked was just good fortune, but it seems our luck has run out. Commenting out that line, or equivalently removing the FORCE flag, fixes the Configure-stage error for all versions of CMake.

Any thoughts on this? I think if CMAKE_OSX_ARCHITECTURES must be set in OSG, it should really be set before the first call to PROJECT. If we no longer have an OSX maintainer, then I can take a crack at coming up with a solution.

Thanks,
Ravi

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=68155#68155








------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
ravidavi
User


Joined: 06 Nov 2015
Posts: 34

PostPosted: Wed Jul 20, 2016 5:15 am    Post subject:
Reply with quote

Hi Robert,

Excellent, just what I wanted to hear. I'd be happy to provide updates on the OSX side of the CMake build system. I only have one OS and compiler combo to code on (10.10.5 with XCode 7.2), but I have a decent amount of experience with general OSX/CMake development and OSG development. So I'll do my best to keep my updates generic and backwards-compatible with older CMake versions.

I agree that updating the minimum CMake to 2.8 across the board is feasible, since it's available on pretty much every platform now. Well except for maybe legacy Linux distros.

Anyway, I'll post my changes on Submissions this week. Hopefully we can get the build system up and running on OSX before your 3.6 release.
Back to top
View user's profile Send private message
ravidavi
User


Joined: 06 Nov 2015
Posts: 34

PostPosted: Thu Jul 21, 2016 5:56 am    Post subject:
Reply with quote

Fix submitted in Submissions Post.
Back to top
View user's profile Send private message
ravidavi
User


Joined: 06 Nov 2015
Posts: 34

PostPosted: Fri Jul 29, 2016 7:17 pm    Post subject:
Reply with quote

Hi Robert (and any other OSX OSG devs),

Nowadays XCode only includes the OSX 10.11 SDK, which supports deployment targets back to 10.7. So one can use the 10.11 SDK to target OSX 10.8, which is what CMake does via CMAKE_OSX_DEPLOYMENT_TARGET.

However, CMake 3.1.0 was the first major release to fully support using the 10.11 SDK regardless of which OSX version you're actually running. So in CMake < 3.1.0, OSG devs on OSX might need to manually change the CMAKE_OSX_* variables. But in CMake >= 3.1.0, the correct OSX SDK and deployment-target combo is found automatically.

So my question is, should we bump the minimum CMake version on OSX to 3.1.0 since it works for (presumably) everyone, or stick with 2.8.0 with the understanding that users will have to manually set CMAKE_OSX_SYSROOT and CMAKE_OSX_DEPLOYMENT_TARGET? My preference is to bump it, but if you choose the latter path, you may get many questions from users who get CMake errors on their initial Configure run. Or maybe not, since apparently I'm the only one complaining here. Laughing

Thanks!
Ravi
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> Build system [build] All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Compile error with Visual Studio 2017 draccagni General 2 Sat Aug 19, 2017 1:52 pm View latest post
No new posts PHPBB ERROR: A Closer Look, and Why Steal General 0 Mon Jul 10, 2017 11:03 am View latest post
No new posts PBuffer causing error when profiling ... jsmitq General 1 Thu Jun 08, 2017 4:24 pm View latest post
No new posts Error with InputStream reading osgb f... Riccardo Corsi General 28 Thu Jun 08, 2017 11:20 am View latest post
No new posts OpenGL error when using TextureBuffer MariusD General 1 Mon May 22, 2017 1:40 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP