[MDEV-6016] Packaging error with cmake 2.8.12 and greater. Created: 2014-04-03  Updated: 2014-04-09  Resolved: 2014-04-09

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 5.5.36, 10.0.10
Fix Version/s: 5.5.37, 10.0.11

Type: Bug Priority: Major
Reporter: Wes Bullard Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: packaging
Environment:

Windows 7 x64, cmake 2.8.12.2


Attachments: Text File Mariadb10.txt     File cmakefix.diff    
Issue Links:
Relates
relates to MDEV-6053 Debug info for static libraries is no... Closed

 Description   

When building --target package the build process completes but then errors out while trying to package the zip file. The error is due to missing .pdb files.
This is not really a bug with mariadb as it's part of cmake but will stop mariadb from building. From my understanding this is due to cmake as of 2.8.12 will not build .pdb files for static libraries (see http://public.kitware.com/Bug/view.php?id=14600 )

I've attached the output of the errors in the building of the zip file. Also attached is a .diff file that alters the cmake/install_macros.cmake file



 Comments   
Comment by Elena Stepanova [ 2014-04-03 ]

The attached workaround was suggested by Wlad. He also had additional thoughts on the subject, I hope he will comment with those.

Meanwhile, here is a free translation of his notes:

In future users won't be able to debug static libraries (client adn embedded), and apparently cmake isn't going to fix it.

If somebody complains, we can modify compile flags from /Zi to /Z7 (see http://bazaar.launchpad.net/~maria-captains/maria/10.0/view/head:/cmake/os/Windows.cmake ). With /Z7, debuginfo will be inside the static library, in .obj files ( http://msdn.microsoft.com/en-us/library/958x11bc.aspx ), and pdb won't be needed.

Comment by Elena Stepanova [ 2014-04-03 ]

I checked the provided patch on 5.5 tree with VS 11 / cmake 2.8.12.1, and also tried it in a test tree in buildbot to check there are no problems with older VS/cmake. Now pushed into 5.5 tree which will be merged up later.

Comment by Vladislav Vaintroub [ 2014-04-04 ]

I tested the mentioned change for debuginfo format from /Zi to /Z7, and it seems to work well. The noticable change is that static libraries will be bigger in size (this of course applies to the libraries themselves, not to programs they link to). So I conclude, if the size of embedded library = 300M does not bother too many people, /Z7 should be quite ok. The whole patch is below.

=== modified file 'cmake/os/Windows.cmake'
--- cmake/os/Windows.cmake	2011-06-30 15:46:53 +0000
+++ cmake/os/Windows.cmake	2014-04-04 06:02:17 +0000
@@ -71,13 +71,15 @@
    SET(CMAKE_{type}_LINKER_FLAGS_RELEASE "${CMAKE_${type}_LINKER_FLAGS_RELEASE} /debug")
   ENDFOREACH()
   
-  # Force static runtime libraries
+  # Force static runtime libraries. 
+  # Force /Z7 instead of default /Zi to have debug symbols in static libraries.
   FOREACH(flag 
    CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO 
    CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT 
    CMAKE_CXX_FLAGS_RELEASE  CMAKE_CXX_FLAGS_RELWITHDEBINFO
    CMAKE_CXX_FLAGS_DEBUG  CMAKE_CXX_FLAGS_DEBUG_INIT)
    STRING(REPLACE "/MD"  "/MT" "${flag}" "${${flag}}")
+   STRING(REPLACE "/Zi"  "/Z7" "${flag}" "${${flag}}")
   ENDFOREACH()
   
   # Remove support for exceptions

Comment by Elena Stepanova [ 2014-04-05 ]

This change is an addition to the previous one, not a replacement, right?

Some numbers (revno 4131 is the previous patch):

VS 10 / cmake 2.8.5, revno 4130 before Zi=>Z7
141848427 mariadb-5.5.37-winx64.zip
 
VS 10 / cmake 2.8.5, revno 4130 after Zi=>Z7
186223829 mariadb-5.5.37-winx64.zip
 
VS 10 / cmake 2.8.5, revno 4131 before Zi=>Z7
141813729 mariadb-5.5.37-winx64.zip
 
VS 10 / cmake 2.8.5, revno 4131 after Zi=>Z7
186232673 mariadb-5.5.37-winx64.zip
 
 
VS 11 / cmake 2.8.12 revno 4130 after Zi=>Z7
does not work
 
VS 11 / cmake 2.8.12 revno 4131 before Zi=>Z7
147336732 mariadb-5.5.37-winx64.zip
 
VS 11 / cmake 2.8.12 revno 4131 after Zi=>Z7
213447432 mariadb-5.5.37-winx64.zip

Comment by Vladislav Vaintroub [ 2014-04-05 ]

Right, this is addition not a replacement. Bet the difference is due to mysqlserver.lib only, and is not noticable in MSIs.

Comment by Elena Stepanova [ 2014-04-05 ]

Some more sizes (mysqlserver.lib and the whole unpacked directory)

VS 10 / cmake 2.8.5, 4131 before Zi=>Z7
  141813729  mariadb-5.5.37-winx64.zip
  72740006   mysqlserver.lib
  644775646  mariadb-5.5.37-winx64
 
VS 10 / cmake 2.8.5, 4131 after Zi=>Z7
  186232673  mariadb-5.5.37-winx64.zip
  223535446  mysqlserver.lib
  800908270  mariadb-5.5.37-winx64
 
VS 11 / cmake 2.8.12 4131 before Zi=>Z7
  147336732  mariadb-5.5.37-winx64.zip
  74633374   mysqlserver.lib
  647495889  mariadb-5.5.37-winx64
 
VS 11 / cmake 2.8.12 4131 after Zi=>Z7
  213447432  mariadb-5.5.37-winx64.zip
  602570110  mysqlserver.lib
  1182596977 mariadb-5.5.37-winx64

Comment by Elena Stepanova [ 2014-04-09 ]

I created a separate issue MDEV-6053 regarding including the debug info. I think we can afford waiting a bit to see if anybody actually needs it.

Generated at Thu Feb 08 07:08:44 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.