-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
MDEV-38499: cmake and compile errors on MacOSX when compiling mariadb from a git tree #4522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
21b2b2c to
96b27db
Compare
| # TODO: to remove the circular dependency and this workaround. | ||
| IF(APPLE AND (CMAKE_VERSION VERSION_GREATER_EQUAL "3.13")) | ||
| CHECK_LINKER_FLAG(C "LINKER:-no_warn_duplicate_libraries" HAVE_NO_WARN_DUPLICATE_LIBRARIES) | ||
| IF(HAVE_NO_WARN_DUPLICATE_LIBRARIES) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move INCLUDE(CheckLinkerFlag) here, from top-level CMake, under IF(), before using CHECK_LNKER_FLAG. I looked into documentation, it turns out CHECK_LNKER_FLAG needs CMake 3.18, thus CMAKE version check needs to be VERSION_GREATER_EQUAL "3.18"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
CMakeLists.txt
Outdated
| MARK_AS_ADVANCED(WITH_PIC) | ||
| ENDIF() | ||
|
|
||
| include(CheckLinkerFlag) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove it from top level CMake, as discussed above, and only use in the single place where the macro is used in mysys/CMakeLists.txt .
CheckLinkerFlags needs CMake 3.18, currently we declare the minimum version as 3.12, so it might not work with downlevel CMake
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
mariadb from a git tree Fix the warnings issued by a normal MacOSX compile. Problems: 1. sprintf is deprecated in favor of snprintf 2. bison incorrectly issues a warning when it sees "b4_bin" 3. MacOSX linker issues a warning about duplicate mysys/dbug/etc libraries. On 1: replaced the relevant sprintf with snprintf. On 2: worked around by adding a compiler define with a different name aliasing the character set variable used with a name that won't trigger the bison warning On 3: This is due to the fact that there's a circular dependecy between mysys and dbug (among others). Turned the warning off by suppressing the duplicate library warning.
96b27db to
81f8b6f
Compare
dr-m
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a particular reason why we are not working around the Bison bug in the earliest maintained branch (10.6)?
| if (maybe_disable_binlog(mysql)) | ||
| return -1; | ||
| sprintf(buff,"create database `%.*s`",FN_REFLEN,argv[1]); | ||
| snprintf(buff, sizeof(buff), "create database `%.*s`",FN_REFLEN,argv[1]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These PRs are about a year old?
The question is: is there anything wrong with the changes proposed?
My goal is simple: get a warning-free compile. Warnings are a bad false positive: they obscure my daily work.
Apparently a big-bang approach of fixing all of these is not going very fast. Can we go step-wise with this instead please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, we have agreed to take the iterative approach wrt sprintf->snprintf migration.
So the current "plan" is to keep this PR intact, but remove from it and backport the bison workaround and the mysys linker warnings workaround to 10.6. I'll follow up with a new PR about this. And an update to the current one.
Fix the warnings issued by a normal MacOSX compile.
Problems:
On 1: replaced the relevant sprintf with snprintf. On 2: worked around by adding a compiler define with a different name
aliasing the character set variable used with a name that
won't trigger the bison warning
On 3: This is due to the fact that there's a circular dependecy between
mysys and dbug (among others). Turned the warning off by adding a macro
to suppress the duplicate library warning.
Applied the macro to all targets that have a dependency on
the mysys/dbug/strings libraries