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 

Proper CMAKE settings for ZLIB, bogus "optimized.lib" in link


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


Joined: 11 Mar 2009
Posts: 70

PostPosted: Wed Nov 02, 2016 9:05 pm    Post subject:
Proper CMAKE settings for ZLIB, bogus "optimized.lib" in link
Reply with quote

Hi,
I am trying to build OSG 3.4.0 on Windows/Visual Studio 2015 using CMake to generate the projects.

Everything works pretty well except the confusing settings for ZLIB_LIBRARY, ZLIB_LIBRARY_DEBUG,ZLIB_LIBRARY_RELEASE. Why 3 settings ?

I included paths to Debug and Release builds of ZLib, in the ZLIB_LIBRARY_DEBUG and ZLIB_LIBRARY_RELEASE respectively and left ZLIB_LIBRARY blank.

Although the DEBUG build is ok , my RELEASE builds ended up with library references to non-existent "optimized.lib" and "debug.lib" as well as duplicating the debug and release versions of the zlib libraries.

For example, this is pasted from the VS linker settings for and OSG project.
....-
optimized.lib
D:\OSG\3rdParty\build\lib\Release\zlib.lib
debug.lib
D:\OSG\3rdParty\build\lib\Debug\zlibd.lib
....

Andrew
Back to top
View user's profile Send private message
toddcarnes (Todd Carnes)
Newbie


Joined: 28 Oct 2016
Posts: 1

PostPosted: Wed Nov 02, 2016 9:17 pm    Post subject:
Proper CMAKE settings for ZLIB, bogus "optimized.lib" in link
Reply with quote

I just pointed the extra one to zlib's release directory as well and everything worked out for me... Although, I was building a different version, it might still work for you as well.
On Nov 2, 2016 2:04 PM, "Andrew Cunningham" < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
Hi,
I am trying to build OSG 3.4.0 on Windows/Visual Studio 2015 using CMake to generate the projects.

 Everything works pretty well except the confusing settings for ZLIB_LIBRARY, ZLIB_LIBRARY_DEBUG,ZLIB_LIBRARY_RELEASE. Why 3 settings ?

I included paths to Debug and Release builds of ZLib,  in the ZLIB_LIBRARY_DEBUG and ZLIB_LIBRARY_RELEASE respectively and left ZLIB_LIBRARY blank.

Although the DEBUG build is ok , my RELEASE builds ended up with library references to non-existent "optimized.lib" and "debug.lib"  as well as duplicating the debug and release versions of the zlib libraries.

For example, this is pasted from the VS linker settings for and OSG project.
....-
optimized.lib
D:OSG3rdPartybuildlibReleasezlib.lib
debug.lib
D:OSG3rdPartybuildlibDebugzlibd.lib
....

Andrew

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





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


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


Joined: 11 Mar 2009
Posts: 70

PostPosted: Wed Nov 02, 2016 9:39 pm    Post subject:
Reply with quote

Yup that worked. Same issue with PNG and TIFF.

Thanks!
Back to top
View user's profile Send private message
Jan Ciger
Guest





PostPosted: Wed Nov 02, 2016 10:02 pm    Post subject:
Proper CMAKE settings for ZLIB, bogus "optimized.lib" in link
Reply with quote

Hello,

On 02/11/16 22:05, Andrew Cunningham wrote:
Quote:
Hi,
I am trying to build OSG 3.4.0 on Windows/Visual Studio 2015 using CMake to generate the projects.

Everything works pretty well except the confusing settings for ZLIB_LIBRARY, ZLIB_LIBRARY_DEBUG,ZLIB_LIBRARY_RELEASE. Why 3 settings ?

I included paths to Debug and Release builds of ZLib, in the ZLIB_LIBRARY_DEBUG and ZLIB_LIBRARY_RELEASE respectively and left ZLIB_LIBRARY blank.

Although the DEBUG build is ok , my RELEASE builds ended up with library references to non-existent "optimized.lib" and "debug.lib" as well as duplicating the debug and release versions of the zlib libraries.

For example, this is pasted from the VS linker settings for and OSG project.
....-
optimized.lib
D:\OSG\3rdParty\build\lib\Release\zlib.lib
debug.lib
D:\OSG\3rdParty\build\lib\Debug\zlibd.lib
....

Andrew

That is completely normal. Visual Studio uses different C/C++ runtimes
for Debug and Release configurations and if you mix libraries compiled
against different C/C++ runtimes you will get memory corruption and
weird crashes at runtime. So it is an extremely bad idea to mix them
unless you know what you are doing (and probably even then).

Why there are 3 variables - I don't remember exactly the OSG's setup,
but typically:

* ZLIB_LIBRARY_DEBUG and ZLIB_LIBRARY_RELEASE would be internal use
CMake variables ("advanced" in CMake parlance)

* ZLIB_LIBRARY would contain something a value calculated by the script
from the two variables above like this:
"optimized;c:/foo/bar/baz/zlib.lib;debug;c:/foo/bar/baz/zlibd.lib"

The "debug" and "optimized" keywords denote which runtime is the library
meant for. This is the variable you would then normally use when
configuring linking for the target (exe or library) in the CMake script.

This is Window/Visual Studio specific pain in the backside, no other
platform that I know of has this problem with requiring separate
libraries for debugging/optimized build configurations.

Regards,

J.




------------------
Post generated by Mail2Forum
Back to top
loopy
User


Joined: 11 Mar 2009
Posts: 70

PostPosted: Wed Nov 02, 2016 10:03 pm    Post subject:
Reply with quote

Now if someone could explain how to get the OSG CMake configuration to understand that QT5WebKit and QT5WebKitWidgets has gone away in QT 5.7 and stop looking for it.
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 Fix for cmake modules for plugin exr robertosfield Submission 1 Tue Nov 14, 2017 10:17 am View latest post
No new posts osgDB::ImagePaged don't have "Pa... tang General 0 Mon Nov 13, 2017 2:51 am View latest post
No new posts "Memory: Colors" game from ... kornerr General 3 Sat Oct 28, 2017 11:19 am View latest post
No new posts osgconv "noTriStripPolygons"... KariR General 2 Tue Sep 12, 2017 1:50 pm View latest post
No new posts Broken link arennuit General 2 Mon Aug 14, 2017 10:10 am 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