Re: [Maria-developers] [Commits] Rev 3227: Fix embedded build on Windows. in file:///H:/bzr/5.5/
Hi, Vladislav! On Jan 20, Vladislav Vaintroub wrote:
revno: 3227 revision-id: wlad@montyprogram.com-20120120155435-y8tyd01st3fpbq1e parent: wlad@montyprogram.com-20120120113906-f6wcj47dyo6jyt45 committer: Vladislav Vaintroub <wlad@montyprogram.com> branch nick: 5.5 timestamp: Fri 2012-01-20 16:54:35 +0100 message: Fix embedded build on Windows.
=== modified file 'mysys/CMakeLists.txt' --- a/mysys/CMakeLists.txt 2012-01-20 00:57:58 +0000 +++ b/mysys/CMakeLists.txt 2012-01-20 15:54:35 +0000 @@ -46,7 +46,7 @@ SET (MYSYS_SOURCES ${MYSYS_SOURCES} my_addr_resolve.c) ENDIF()
-IF(WITH_SAFEMALLOC OR NOT HAVE_CXX_NEW) +IF(NOT HAVE_CXX_NEW) ADD_DEFINITIONS( -DUSE_MYSYS_NEW)
Why is that? I thought that WITH_SAFEMALLOC is always off on Windows? Note, that we should always use mysys/new.cc when safemalloc is enabled. Regards, Sergei
-----Original Message----- From: Sergei Golubchik [mailto:serg@askmonty.org] Sent: Freitag, 20. Januar 2012 17:23 To: maria-developers@lists.launchpad.net; wlad@askmonty.org Subject: Re: [Commits] Rev 3227: Fix embedded build on Windows. in file:///H:/bzr/5.5/
Hi, Vladislav!
On Jan 20, Vladislav Vaintroub wrote:
revno: 3227 revision-id: wlad@montyprogram.com-20120120155435-y8tyd01st3fpbq1e parent: wlad@montyprogram.com-20120120113906-f6wcj47dyo6jyt45 committer: Vladislav Vaintroub <wlad@montyprogram.com> branch nick: 5.5 timestamp: Fri 2012-01-20 16:54:35 +0100 message: Fix embedded build on Windows.
=== modified file 'mysys/CMakeLists.txt' --- a/mysys/CMakeLists.txt 2012-01-20 00:57:58 +0000 +++ b/mysys/CMakeLists.txt 2012-01-20 15:54:35 +0000 @@ -46,7 +46,7 @@ SET (MYSYS_SOURCES ${MYSYS_SOURCES} my_addr_resolve.c) ENDIF()
-IF(WITH_SAFEMALLOC OR NOT HAVE_CXX_NEW) +IF(NOT HAVE_CXX_NEW) ADD_DEFINITIONS( -DUSE_MYSYS_NEW)
Why is that? Well, when I added WITH_SAFEMALLOC , build started to fail. Thus I removed it again. The build started to fail because I forgot that WITH_SAFEMALLOC is no more Boolean, and is set AUTO on Windows, so it was compiled in.
I'm not surprised that embedded build failed, yet I'm surprised that normal server was built on Windows. On Windows, one cannot have multiply defined symbols, and since there is already one "new" in C runtime library, it actually had to fail.
Note, that we should always use mysys/new.cc when safemalloc is enabled. This was my thought exactly, when I added it. But I guess, in this case my_new.cc might need some smarter tricks in order to replace system new().If I'm not mistaken, the old MySQL version of this file used "weak" attributes or something similar.
A more general thought on WITH_SAFEMALLOC: May I suggest to get back to a configuration where WITH_SAFEMALLOC is Boolean and either ON or OFF, and ignore it in non-debug builds. The triple value logic adds some confusion for me? Maybe, we should make WITH_SAFEMALLOC OFF even in debug compilation, it was not ON even back in autotools days (one had to compile with --with-debug-full to get it). Wlad
Hi, Vladislav! On Jan 20, Vladislav Vaintroub wrote:
-----Original Message----- From: Sergei Golubchik [mailto:serg@askmonty.org] Sent: Freitag, 20. Januar 2012 17:23 To: maria-developers@lists.launchpad.net; wlad@askmonty.org Subject: Re: [Commits] Rev 3227: Fix embedded build on Windows. in file:///H:/bzr/5.5/
On Jan 20, Vladislav Vaintroub wrote:
revno: 3227 revision-id: wlad@montyprogram.com-20120120155435-y8tyd01st3fpbq1e parent: wlad@montyprogram.com-20120120113906-f6wcj47dyo6jyt45 committer: Vladislav Vaintroub <wlad@montyprogram.com> branch nick: 5.5 timestamp: Fri 2012-01-20 16:54:35 +0100 message: Fix embedded build on Windows.
=== modified file 'mysys/CMakeLists.txt' --- a/mysys/CMakeLists.txt 2012-01-20 00:57:58 +0000 +++ b/mysys/CMakeLists.txt 2012-01-20 15:54:35 +0000 @@ -46,7 +46,7 @@ SET (MYSYS_SOURCES ${MYSYS_SOURCES} my_addr_resolve.c) ENDIF()
-IF(WITH_SAFEMALLOC OR NOT HAVE_CXX_NEW) +IF(NOT HAVE_CXX_NEW) ADD_DEFINITIONS( -DUSE_MYSYS_NEW)
Why is that? Well, when I added WITH_SAFEMALLOC , build started to fail. Thus I removed it again. The build started to fail because I forgot that WITH_SAFEMALLOC is no more Boolean, and is set AUTO on Windows, so it was compiled in.
I'm not surprised that embedded build failed, yet I'm surprised that normal server was built on Windows. On Windows, one cannot have multiply defined symbols, and since there is already one "new" in C runtime library, it actually had to fail.
Note, that we should always use mysys/new.cc when safemalloc is enabled. This was my thought exactly, when I added it. But I guess, in this case my_new.cc might need some smarter tricks in order to replace system new().If I'm not mistaken, the old MySQL version of this file used "weak" attributes or something similar.
I thought that it was me who added WITH_SAFEMALLOC to that IF(). But now I've checked and indeed, I did not. I did it in the top-level CMakeLists.txt: 193 # force -DUSE_MYSYS_NEW unless already done by HAVE_CXX_NEW 194 IF(HAVE_CXX_NEW) 195 SET(DUSE_MYSYS_NEW "-DUSE_MYSYS_NEW") 196 ENDIF() 197 198 IF(WITH_SAFEMALLOC MATCHES "ON") 199 ADD_DEFINITIONS( -DSAFEMALLOC ${DUSE_MYSYS_NEW}) 200 ELSEIF(WITH_SAFEMALLOC MATCHES "AUTO" AND NOT WIN32) 201 SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC") 202 SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC ${DUSE_MYSYS_NEW"} 203 ENDIF() which is supposed to add -DUSE_MYSYS_NEW to the debug flags if safemalloc is used and HAVE_CXX_NEW is set (is HAVE_CXX_NEW is unset, -DUSE_MYSYS_NEW is added in mysys, independently from safemalloc). This should be enough and no additional safemalloc checks in mysys/CMakeLists.txt should be needed, as far as I understand it. Regards, Sergei
participants (2)
-
Sergei Golubchik
-
Vladislav Vaintroub