[MDEV-19740] Debug build of 10.3.15 FTBFS Created: 2019-06-12  Updated: 2023-04-27

Status: Stalled
Project: MariaDB Server
Component/s: Compiling, Server
Affects Version/s: 10.3.15, 10.2, 10.3, 10.4, 10.5
Fix Version/s: 10.4, 10.5

Type: Bug Priority: Major
Reporter: Michal Schorm Assignee: Oleksandr Byelkin
Resolution: Unresolved Votes: 0
Labels: None
Environment:

Fedora 30
Debian GNU/Linux unstable, GCC 9.2.1


Attachments: File 1.log     File 2.log     File 3.log     File 4.log     File root.log    
Issue Links:
Relates
relates to MDEV-21907 Enable -Wconversion for InnoDB and Ma... Closed
relates to MDEV-20470 MyRocks fails to compile on Debian Bu... Stalled

 Description   

While 10.3.12 debug build passed without any problem, 10.3.15 has several compilation time errors.

A workaround exists - add some "-Wno-error" to CFLAGS.


Build commands:

/usr/bin/cmake -DCMAKE_C_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_Fortran_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr -DINCLUDE_INSTALL_DIR:PATH=/usr/include -DLIB_INSTALL_DIR:PATH=/usr/lib64 -DSYSCONF_INSTALL_DIR:PATH=/etc -DSHARE_INSTALL_PREFIX:PATH=/usr/share -DLIB_SUFFIX=64 -DBUILD_SHARED_LIBS:BOOL=ON . -DBUILD_CONFIG=mysql_release -DFEATURE_SET=community -DINSTALL_LAYOUT=RPM -DDAEMON_NAME=mariadb -DDAEMON_NO_PREFIX=mariadb -DLOG_LOCATION=/var/log/mariadb/mariadb.log -DPID_FILE_DIR=/run/mariadb -DNICE_PROJECT_NAME=MariaDB -DRPM=fedora30 -DCMAKE_INSTALL_PREFIX=/usr -DINSTALL_SYSCONFDIR=/etc -DINSTALL_SYSCONF2DIR=/etc/my.cnf.d -DINSTALL_DOCDIR=share/doc/mariadb -DINSTALL_DOCREADMEDIR=share/doc/mariadb -DINSTALL_INCLUDEDIR=include/mysql -DINSTALL_INFODIR=share/info -DINSTALL_LIBDIR=lib64 -DINSTALL_MANDIR=share/man -DINSTALL_MYSQLSHAREDIR=share/mariadb -DINSTALL_MYSQLTESTDIR=share/mysql-test -DINSTALL_PLUGINDIR=lib64/mariadb/plugin -DINSTALL_SBINDIR=libexec -DINSTALL_SCRIPTDIR=bin -DINSTALL_SQLBENCHDIR=share -DINSTALL_SUPPORTFILESDIR=share/mariadb -DINSTALL_PCDIR=lib64/pkgconfig -DMYSQL_DATADIR=/var/lib/mysql -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock -DTMPDIR=/var/tmp -DENABLED_LOCAL_INFILE=ON -DENABLE_DTRACE=ON -DSECURITY_HARDENED=ON -DWITH_WSREP=ON -DWITH_INNODB_DISALLOW_WRITES=ON -DWITH_EMBEDDED_SERVER=ON -DWITH_MARIABACKUP=ON -DWITH_UNIT_TESTS=ON -DCONC_WITH_SSL=NO -DWITH_SSL=system -DWITH_ZLIB=system -DWITH_JEMALLOC=yes -DLZ4_LIBS=/usr/lib64/liblz4.so -DLZ4_LIBS=/usr/lib64/liblz4.so -DWITH_INNODB_LZ4=ON -DWITH_ROCKSDB_LZ4=ON -DPLUGIN_MROONGA=DYNAMIC -DPLUGIN_OQGRAPH=DYNAMIC -DPLUGIN_CRACKLIB_PASSWORD_CHECK=DYNAMIC -DPLUGIN_ROCKSDB=DYNAMIC -DPLUGIN_SPHINX=DYNAMIC -DPLUGIN_TOKUDB=DYNAMIC -DPLUGIN_CONNECT=DYNAMIC -DPYTHON_SHEBANG=/usr/bin/python3 -DPLUGIN_CACHING_SHA2_PASSWORD=OFF -DPLUGIN_AWS_KEY_MANAGEMENT=NO -DCONNECT_WITH_MONGO=OFF -DCONNECT_WITH_JDBC=OFF -DCMAKE_BUILD_TYPE=Debug -DWITH_ASAN=OFF -DWITH_INNODB_EXTRA_DEBUG=ON -DWITH_VALGRIND=ON
 
make -j6 VERBOSE=1


1)
Problem: "-Werror=deprecated-copy"

2)
Problem: "-Werror=pessimizing-move" "-Werror=maybe-uninitialized" "-Werror=format-overflow="

.
That's it for x86_64.
However, on armv7hl, there's more:
.

3)
Problem: "-Werror=shift-count-overflow"

4)
Problem: "-Werror=format"


So I end up with:

CFLAGS="$CFLAGS -Wno-error=deprecated-copy -Wno-error=pessimizing-move -Wno-error=maybe-uninitialized -Wno-error=format-overflow"
CFLAGS="$CFLAGS -Wno-error=shift-count-overflow -Wno-error=format"


I'm attaching build logs for each failure.
It's likely, those issuses will be on more places, those are just the first encountered.

In the attached root.log you can find packages in the buildroot for armv7hl build. (usefull for getting version of GCC, make, cmake, ...)



 Comments   
Comment by Marko Mäkelä [ 2019-06-12 ]

I removed the bogus sd_notifyf() calls from InnoDB.
mschorm, it could be useful to run

make -k -j$(nproc)

so that the build will not stop at the first error. I am sure that there are plenty of others, and many errors (for header files) could be duplicated.

armv7hl is 32-bit, right? AArch64 would be armv8, I think. The shift-count-overflow error is about shifting something by 32 bits.

Comment by Sergei Petrunia [ 2019-06-18 ]

I would like to look at the MyRocks/RocksDB part after we've merged the updated versions from the upstream. (See MDEV-19795 to track the merge progress)

Comment by Sergei Petrunia [ 2019-07-09 ]

The compile command has {{ -DENABLE_DTRACE=ON }}. For me, this causes a compile failure when it attempts to run DTRACE-NOTFOUND command.

Comment by Sergei Petrunia [ 2019-07-09 ]

Looking at the errors in MyRocks:

|| In file included from /home/fedora/10.3/storage/rocksdb/rocksdb/db/memtable.h:21,
|| /home/fedora/10.3/storage/rocksdb/rocksdb/db/version_edit.h: In constructor ‘rocksdb::FdWithKeyRange::FdWithKeyRange(rocksdb::FileDescriptor, rocksdb::Slice, rocksdb::Slice, rocksdb::FileMetaData*)’:
rocksdb/db/version_edit.h|178 col 33| error: implicitly-declared ‘constexpr rocksdb::FileDescriptor::FileDescriptor(const rocksdb::FileDescriptor&)’ is deprecated [-Werror=deprecated-copy]                   
||   178 |         largest_key(_largest_key) {}
||       |                                 ^
rocksdb/db/version_edit.h|55 col 19| note: because ‘rocksdb::FileDescriptor’ has user-provided ‘rocksdb::FileDescriptor& rocksdb::FileDescriptor::operator=(const rocksdb::FileDescriptor&)’
||    55 |   FileDescriptor& operator=(const FileDescriptor& fd) {
||       |                   ^~~~~~~~

I found an explanation for this here:

https://stackoverflow.com/questions/51863588/warning-definition-of-implicit-copy-constructor-is-deprecated

As of C++11, implicit generation of the copy constructor is declared as deprecated.

§ D.2 Implicit declaration of copy functions [depr.impldec]

The implicit definition of a copy constructor as defaulted is deprecated if the class has a user-declared copy assignment operator or a user-declared destructor. The implicit definition of a copy assignment operator as defaulted is deprecated if the class has a user-declared copy constructor or a user-declared destructor (15.4, 15.8). In a future revision of this International Standard, these implicit definitions could become deleted (11.4).

https://en.cppreference.com/w/cpp/language/rule_of_three
" If a class requires a user-defined destructor, a user-defined copy
constructor, or a user-defined copy assignment operator, it almost certainly
requires all three."

Here, struct FileDescriptor has an operator= but doesn't have a
copy-constructor.

rocksdb/db/internal_stats.cc|1380 col 35| error: implicitly-declared ‘rocksdb::InternalStats::CompactionStats& rocksdb::InternalStats::CompactionStats::operator=(const rocksdb::InternalStats::CompactionStats&)’ is deprecated [-Werror=deprecated-copy]                                                                                                                                                                    
||  1380 |   cf_stats_snapshot_.comp_stats = compaction_stats_sum;
||       |                                   ^~~~~~~~~~~~~~~~~~~~
|| In file included from /home/fedora/10.3/storage/rocksdb/rocksdb/db/internal_stats.cc:11:
rocksdb/db/internal_stats.h|220 col 14| note: because ‘rocksdb::InternalStats::CompactionStats’ has user-provided ‘rocksdb::InternalStats::CompactionStats::CompactionStats(const rocksdb::InternalStats::CompactionStats&)’
||   220 |     explicit CompactionStats(const CompactionStats& c)
||       |              ^~~~~~~~~~~~~~~

The same issue as above, but here struct CompactionStats has a copy constructor but not operator=.

|| In file included from /home/fedora/10.3/storage/rocksdb/rocksdb/utilities/persistent_cache/block_cache_tier_file.h:20,
|| /home/fedora/10.3/storage/rocksdb/rocksdb/utilities/persistent_cache/persistent_cache_util.h: In instantiation of ‘T rocksdb::BoundedQueue<T>::Pop() [with T = rocksdb::BlockCacheTier::InsertOp]’:
rocksdb/utilities/persistent_cache/block_cache_tier.cc|192 col 33| required from here
rocksdb/utilities/persistent_cache/persistent_cache_util.h|51 col 23| error: moving a local object in a return statement prevents copy elision [-Werror=pessimizing-move]
||    51 |     return std::move(t);
||       |                       ^
rocksdb/utilities/persistent_cache/persistent_cache_util.h|51 col 23| note: remove ‘std::move’ call

The error is for this function:

template <class T> class BoundedQueue {
... 
  T Pop() {
    ...
    T t = std::move(q_.front());
    ...
    return std::move(t);
  }

I assume one can just remove the "std::move" from the return statement.

Comment by Sergei Petrunia [ 2019-07-09 ]

System: Fedora 30, gcc (GCC) 9.1.1 20190503 (Red Hat 9.1.1-1)

Comment by Sergei Petrunia [ 2019-07-09 ]

PR for the RocksDB upstream: https://github.com/facebook/rocksdb/pull/5553

Comment by Sergei Petrunia [ 2019-07-09 ]

Note that there are still errors for the SQL layer.

Comment by Sergei Petrunia [ 2019-07-15 ]

RocksDB part is fixed in the upstream RocksDB now. We will need to update RocksDB submodule to get it.

I can do that, but I would prefer that the SQL level part of this MDEV is addressed first. That is, the ball is in sanja's court now.

Comment by Marko Mäkelä [ 2019-08-14 ]

sanja, here are some SQL-layer low-hanging fruit, affecting many compilation units:

10.3 65d48b4a7bd7a57a27f2e9ca54473e1ae86223b5

/mariadb/10.3/sql/field.h:4292:7: error: implicitly-declared ‘List<String>& List<String>::operator=(const List<String>&)’ is deprecated [-Werror=deprecated-copy]
 4292 | class Column_definition: public Sql_alloc,
      |       ^~~~~~~~~~~~~~~~~
/mariadb/10.3/sql/sql_list.h:491:10: note: because ‘List<String>’ has user-provided ‘List<T>::List(const List<T>&) [with T = String]’
  491 |   inline List(const List<T> &tmp) :base_list(tmp) {}
/mariadb/10.3/sql/field.h: In member function ‘void Column_definition::set_column_definition(const Column_definition*)’:
/mariadb/10.3/sql/field.h:4564:13: note: synthesized method ‘Column_definition& Column_definition::operator=(const Column_definition&)’ first required here
 4564 |     *this= *def;
/mariadb/10.3/sql/item.h:2899:7: error: implicitly-declared ‘Item::Item(const Item&)’ is deprecated [-Werror=deprecated-copy]
 2899 | class Item_ident_for_show :public Item
      |       ^~~~~~~~~~~~~~~~~~~
/mariadb/10.3/sql/item.h:635:8: note: because ‘Item’ has user-provided ‘void Item::operator=(Item&)’
  635 |   void operator=(Item &);

On a quick look at my make -kj$(nproc) output, there are no InnoDB-specific errors. Probably no InnoDB files compiled because of the above problems in sql/*.h.

I may have missed a few errors; I just copied them manually, trying to filter out duplicates.

I would recommend to fix these on 10.2 already, because I am using GCC 9 for compiling that too. (GCC 9 is much better than GCC 8, because it does not need 5 minutes of CPU time to compile sql_yacc or sql_yacc_ora when using -O2.)

Comment by Marko Mäkelä [ 2019-08-15 ]

mschorm, I got "cc=gcc-9" on Debian unstable today, so I had to scratch my own itch. I pushed a few fixes to 10.2 and merged to 10.3. Note: I disable some storage engines, because I mostly work on InnoDB internals, so I do not claim that this has been fixed. Can you please test and post a log of any remaining failures?

I believe that the reason why the debug builds fail so easily is that since recently MYSQL_MAINTAINER_MODE=AUTO (the default) is interpreted as ON for debug builds.

On a related note: I usually create debug builds with

CFLAGS=-O2 CXXFLAGS=-O2 cmake …

This will trigger a few more warnings on string operations and such, and also some warnings (some of them bogus) about possibly uninitialized variables. Because of this, I often end up having to do cmake -DMYSQL_MAINTAINER_MODE=OFF, which will not only cause the -Werror to be omitted, but also some other flags, so that I will not even see the warnings.

Comment by Marko Mäkelä [ 2019-08-16 ]

To see if all issues might have been fixed now, I tried the command in the Description. First, I had to

sudo apt install libjemalloc-dev checkpolicy semodule-utils systemtap-sdt-dev

to satisfy the requirements of TokuDB, and to install the missing commands checkmodule semodule_package dtrace. Then, I ran into this issue:

CMake Error at cmake/build_depends.cmake:42 (LIST):
  LIST sub-command REMOVE_DUPLICATES requires list to be present.

which I resolved by commenting out the line. With this, we start to hit errors in RocksDB (it looks like there is only one, affecting several files):

/mariadb/10.3/storage/rocksdb/rocksdb/db/version_edit.h:178:33: error: implicitly-declared ‘constexpr rocksdb::FileDescriptor::FileDescriptor(const rocksdb::FileDescriptor&)’ is deprecated [-Werror=deprecated-copy]
  178 |         largest_key(_largest_key) {}

Setting cmake -DPLUGIN_ROCKSDB:STRING=NO helped get past that. psergey, please fix this one.

The remaining errors seem to be related to -Wmaybe-uninitialized. For TokuDB, we seem to omit the -Werror, so I think we can ignore those warnings. Here are the remaining blockers in 10.3 (which should probably be fixed in 10.2 and merged up).

First, there was a warning for Spider, for Kentoku to fix:

/mariadb/10.3/storage/spider/spd_db_mysql.cc: In member function ‘int spider_db_mbase_util::append_tables_top_down(ha_spider*, spider_fields*, spider_string*, TABLE_LIST*, TABLE_LIST**, uint*, TABLE_LIST**)’:
/mariadb/10.3/storage/spider/spd_db_mysql.cc:5338:36: error: ‘first’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 5338 |       if ((error_num = append_table(spider, fields, str, cur_table_list,
      |                        ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 5339 |         used_table_list, current_pos, cond_table_list_ptr, TRUE, first)))
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

One warning (which looks bogus) is issued both for MyISAM and Aria:

/mariadb/10.3/storage/myisam/ft_nlq_search.c: In function ‘walk_and_match’:
/mariadb/10.3/storage/myisam/ft_nlq_search.c:134:15: error: ‘subkeys.i’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  134 |     tmp_weight= subkeys.f;
/mariadb/10.3/storage/maria/ma_ft_nlq_search.c: In function ‘walk_and_match’:
/mariadb/10.3/storage/maria/ma_ft_nlq_search.c:139:15: error: ‘subkeys.i’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  139 |     tmp_weight= subkeys.f;

The rest are specific to the SQL layer:

/mariadb/10.3/sql/sql_statistics.cc: In function ‘int collect_statistics_for_table(THD*, TABLE*)’:
/mariadb/10.3/sql/sql_statistics.cc:1878:28: error: ‘index_prefix_calc.Index_prefix_calc::calc_state’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 1878 |     for (i= prefixes, state= calc_state+prefixes-1; i; i--, state--)
      |                       ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
/mariadb/10.3/sql/sql_statistics.cc:2639:21: note: ‘index_prefix_calc.Index_prefix_calc::calc_state’ was declared here
 2639 |   Index_prefix_calc index_prefix_calc(thd, table, key_info);
      |                     ^~~~~~~~~~~~~~~~~
/mariadb/10.3/sql/sql_class.h: In function ‘bool mysql_insert(THD*, TABLE_LIST*, List<Item>&, List<List<Item> >&, List<Item>&, List<Item>&, enum_duplicates, bool)’:
/mariadb/10.3/sql/sql_class.h:4124:31: error: ‘scoped_stmt_rpl’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 4124 |     current_stmt_binlog_format= format;
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/mariadb/10.3/sql/sql_insert.cc:1160:36: note: ‘scoped_stmt_rpl’ was declared here
 1160 |         ScopedStatementReplication scoped_stmt_rpl(
/mariadb/10.3/sql/table.h: In function ‘bool convert_const_to_int(THD*, Item_field*, Item**)’:
/mariadb/10.3/sql/table.h:2848:17: error: ‘*((void*)& old_maps +8)’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 2848 |   bitmap->bitmap= old;
      |   ~~~~~~~~~~~~~~^~~~~
/mariadb/10.3/sql/item_cmpfunc.cc:348:20: note: ‘*((void*)& old_maps +8)’ was declared here
  348 |     my_bitmap_map *old_maps[2];
/mariadb/10.3/sql/opt_subselect.h:296:69: error: ‘loose_scan_opt.Loose_scan_opt::best_max_loose_keypart’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  296 |       pos->loosescan_picker.loosescan_parts= best_max_loose_keypart + 1;
      |                                              ~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /mariadb/10.3/sql/sql_select.cc:52:
/mariadb/10.3/sql/opt_subselect.h:300:26: error: ‘loose_scan_opt.Loose_scan_opt::best_loose_scan_start_key’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  300 |       DBUG_PRINT("info", ("Produced a LooseScan plan, key %s, %s",
      |                          ^
In file included from /mariadb/10.3/sql/sql_select.cc:52:
/mariadb/10.3/sql/opt_subselect.h:292:24: error: ‘loose_scan_opt.Loose_scan_opt::best_loose_scan_records’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  292 |       pos->records_read=    best_loose_scan_records;
      |       ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /mariadb/10.3/sql/sql_select.cc:52:
/mariadb/10.3/sql/opt_subselect.h:301:48: error: ‘loose_scan_opt.Loose_scan_opt::best_loose_scan_key’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  301 |                           tab->table->key_info[best_loose_scan_key].name.str,
      |                                                ^~~~~~~~~~~~~~~~~~~
/mariadb/10.3/sql/sql_select.cc:6840:18: note: ‘loose_scan_opt.Loose_scan_opt::best_loose_scan_key’ was declared here
 6840 |   Loose_scan_opt loose_scan_opt;
      |                  ^~~~~~~~~~~~~~

Side note: the C++11 violations have now been merged up to 10.4.

Comment by Sergei Petrunia [ 2019-08-17 ]

In the RocksDB submodule, we are currently at:

commit e731f4402258554812c46334dc0d9483e6cc769b
Author: Sergei Petrunia <psergey@askmonty.org>
Date:   Mon Jun 24 16:08:17 2019 -0700
 
    C file should not include <cinttypes>, it is a C++ header. (#5499)
 
    Summary:
    Include <inttypes.h> instead.
    Pull Request resolved: https://github.com/facebook/rocksdb/pull/5499
 
    Differential Revision: D15966937
 
    Pulled By: miasantreble
 
    fbshipit-source-id: 2156c4329b91d26d447de94f1231264d52786350

The fix for c++11 failures is in the rocksdb's main branch :

commit 61876614dce8c9155e28d40b5d95ec1bf1cbfa47 
Author: Sergei Petrunia <psergey@askmonty.org> 
Date:   Fri Jul 12 17:26:19 2019 -0700 
 
    Fix MyRocks compile warnings-treated-as-errors on Fedora 30, gcc 9.1.1 (#5553) 
     
    Summary: 
    - Provide assignment operator in CompactionStats 
    - Provide a copy constructor for FileDescriptor 
    - Remove std::move from "return std::move(t)" in BoundedQueue 
    Pull Request resolved: https://github.com/facebook/rocksdb/pull/5553 
     
    Differential Revision: D16230170 
     
    fbshipit-source-id: fd7c6e52390b2db1be24141e25649cf62424d078 
 

So, we'll need to upgrade RocksDB (and MyRocks) from one revision to another.

Comment by Sergei Petrunia [ 2019-08-17 ]

In the RocksDB submodule, we are currently at:

commit e731f4402258554812c46334dc0d9483e6cc769b
Author: Sergei Petrunia <psergey@askmonty.org>
Date:   Mon Jun 24 16:08:17 2019 -0700
 
    C file should not include <cinttypes>, it is a C++ header. (#5499)
 
    Summary:
    Include <inttypes.h> instead.
    Pull Request resolved: https://github.com/facebook/rocksdb/pull/5499
 
    Differential Revision: D15966937
 
    Pulled By: miasantreble
 
    fbshipit-source-id: 2156c4329b91d26d447de94f1231264d52786350

The fix for c++11 failures is in the rocksdb's main branch :

commit 61876614dce8c9155e28d40b5d95ec1bf1cbfa47 
Author: Sergei Petrunia <psergey@askmonty.org> 
Date:   Fri Jul 12 17:26:19 2019 -0700 
 
    Fix MyRocks compile warnings-treated-as-errors on Fedora 30, gcc 9.1.1 (#5553) 
     
    Summary: 
    - Provide assignment operator in CompactionStats 
    - Provide a copy constructor for FileDescriptor 
    - Remove std::move from "return std::move(t)" in BoundedQueue 
    Pull Request resolved: https://github.com/facebook/rocksdb/pull/5553 
     
    Differential Revision: D16230170 
     
    fbshipit-source-id: fd7c6e52390b2db1be24141e25649cf62424d078 
 

So, we'll need to upgrade RocksDB (and MyRocks) from one revision to another.

  • The new commit is 42 commits ahead
  • Upstream MyRocks is already using a revision of RocksDB that's newer, so the commits that we'll need to merge are known to work with MyRocks.
Comment by Oleksandr Byelkin [ 2019-08-19 ]

OK to push after small changes we have discussed

Comment by Sergei Petrunia [ 2019-09-02 ]

The MyRocks part is not yet fixed.
and if somebody is going to update RocksDB, they should keep in mind: MDEV-20470 - there are other compile failures that should be fixed by updating to a newer RocksDB.
(MDEV-20470 requires an even newer RocksDB than this MDEV)

Comment by Michal Schorm [ 2019-09-06 ]

Downstream status update:

I made a debug build of the latest released versions: 10.3.17 & 10.4.7
Instead of hunting the rogue conpilation flags, I disabled the '-Werror'. (interesting reading)

Now the patch is really easy:
https://src.fedoraproject.org/rpms/mariadb/blob/master/f/mariadb-debug_build.patch
and I haven't encountered any aditional issues.

Here are the build logs:
10.4.7
10.3.17


EDIT:
Actually, I encountered one more issue.
On PPC64le, the 10.3.17 fail, because it IMHO use unexpanded CMake variable as a build flag:
https://kojipkgs.fedoraproject.org//work/tasks/1566/37451566/build.log
10.4.7 built fine on PPC64le:
https://kojipkgs.fedoraproject.org//work/tasks/4639/37454639/build.log

Comment by Marko Mäkelä [ 2019-11-18 ]

mschorm, I would greatly appreciate it if you could check the current status of this.
I spent some effort to fix optimized GCC 9.2.1 builds on amd64 and i686 (both -DCMAKE_BUILD_TYPE=RelWithDebInfo and -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS=-O2 -DCMAKE_CXX_FLAGS=-O2. But I don’t normally compile some storage engines, such as MyRocks and Connect.

Some time ago, I built -DWITH_UBSAN=ON and addressed an InnoDB issue (MDEV-20917). There were many undefined behaviour warnings for plugin/auth_ed25519/ref10 and the sql directory, among them also some that ought to correspond to -Wshift-count-overflow. In fact, there appears to be so much undefined behaviour that the -DWITH_UBSAN=ON executable that was produced by clang-9 would crash already on bootstrap. Only when building it with GCC 9.2.1, I got something where most tests could be executed.

In the light of the UBSAN experiment, I think that we should spend effort to address the warnings, instead of disabling them. Undefined behaviour grants compilers the permission to perform insane ‘optimizations’, making the code base a ticking time bomb, such as in MDEV-15587.

Comment by Michal Schorm [ 2020-03-10 ]

Hello,
I'm back with current results.

First of all - the overall status is much better. The number of issues decreased dramatically.
However few new emerged with introduction of GCC 10 into Fedora 32.


I tested most recent versions of MariaDB: 10.3.22 and 10.4.12
All of them were build for Fedora 30, 31, 32 (alpha), Rawhide (developement branch).
Results for F30 and F31 should be more or less identical; same goes for the other pair F32 and Rawhide. The main change between them is the said GCC 10.


MariaDB 10.3.22:

  • GCC 9 - x86_64: success. Works out of the box.
  • GCC 10 - x86_64: new issue: '-Wno-error=class-memaccess'; otherwise fine.

    [ 48%] Building CXX object libmysqld/CMakeFiles/sql_embedded.dir/__/sql/sql_class.cc.o
    cd /builddir/build/BUILD/mariadb-10.3.22/libmysqld && /usr/bin/c++  -DEMBEDDED_LIBRARY -DHAVE_CONFIG_H -DHAVE_OPENSSL -DMYSQL_SERVER -D_FILE_OFFSET_BITS=64 -I/builddir/build/BUILD/mariadb-10.3.22/include -I/builddir/build/BUILD/mariadb-10.3.22/libmysqld -I/builddir/build/BUILD/mariadb-10.3.22/sql  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=0 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -O0 -g -D_FORTIFY_SOURCE=0 -pie -fPIC -Wl,-z,relro,-z,now -fstack-protector --param=ssp-buffer-size=4 -fPIC -fno-rtti -O -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -Wno-uninitialized -DENABLED_DEBUG_SYNC -ggdb3 -DSAFE_MUTEX -Wall -Wextra -Wformat-security -Wno-format-truncation -Wno-init-self -Wno-nonnull-compare -Wno-unused-parameter -Woverloaded-virtual -Wnon-virtual-dtor -Wvla -Wwrite-strings -Werror   -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=0 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -O0 -g -D_FORTIFY_SOURCE=0 -o CMakeFiles/sql_embedded.dir/__/sql/sql_class.cc.o -c /builddir/build/BUILD/mariadb-10.3.22/sql/sql_class.cc
    In file included from /builddir/build/BUILD/mariadb-10.3.22/include/my_sys.h:20,
                     from /builddir/build/BUILD/mariadb-10.3.22/include/waiting_threads.h:19,
                     from /builddir/build/BUILD/mariadb-10.3.22/sql/sql_class.h:24,
                     from /builddir/build/BUILD/mariadb-10.3.22/sql/sql_class.cc:33:
    /builddir/build/BUILD/mariadb-10.3.22/sql/sql_class.cc: In constructor 'THD::THD(my_thread_id, bool)':
    /builddir/build/BUILD/mariadb-10.3.22/include/m_string.h:60:49: error: 'void* memset(void*, int, size_t)' clearing an object of non-trivial type 'struct Ha_data'; use assignment or value-initialization instead [-Werror=class-memaccess]
       60 | # define bzero(A,B)             memset((A),0,(B))
          |                                                 ^
    /builddir/build/BUILD/mariadb-10.3.22/sql/sql_class.cc:733:3: note: in expansion of macro 'bzero'
      733 |   bzero(ha_data, sizeof(ha_data));
          |   ^~~~~
    In file included from /builddir/build/BUILD/mariadb-10.3.22/sql/sql_class.cc:33:
    /builddir/build/BUILD/mariadb-10.3.22/sql/sql_class.h:1920:8: note: 'struct Ha_data' declared here
     1920 | struct Ha_data
          |        ^~~~~~~
    cc1plus: all warnings being treated as errors
    
    

  • alternative architectures: aarch64, ppc64le, s390x: success, same as x86_64.
  • armv7hl: failure: need to add "-Wno-error=shift-count-overflow -Wno-error=maybe-uninitialized" AND same as i686

    [  7%] Building C object libmariadb/libmariadb/CMakeFiles/mariadb_obj.dir/mariadb_stmt.c.o
    cd /builddir/build/BUILD/mariadb-10.3.22/libmariadb/libmariadb && /usr/bin/cc -DHAVE_CONFIG_H -DHAVE_OPENSSL -DHAVE_TLS -DLIBICONV_PLUG -DMARIADB_MACHINE_TYPE=\"armv7l\" -DMARIADB_SYSTEM_TYPE=\"Linux\" -D_FILE_OFFSET_BITS=64 -I/builddir/build/BUILD/mariadb-10.3.22/libmariadb/include -I/builddir/build/BUILD/mariadb-10.3.22/libmariadb/plugins/auth -I/builddir/build/BUILD/mariadb-10.3.22/libmariadb/plugins/pvio -I/builddir/build/BUILD/mariadb-10.3.22/libmariadb/libmariadb  -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=0 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -march=armv7-a -mfpu=vfpv3-d16 -mtune=generic-armv7-a -mabi=aapcs-linux -mfloat-abi=hard -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -O0 -g -D_FORTIFY_SOURCE=0 -Wno-error=class-memaccess -pie -fPIC -Wl,-z,relro,-z,now -fstack-protector --param=ssp-buffer-size=4 -fPIC -Wunused -Wlogical-op -Wno-uninitialized -Wall -Wextra -Wformat-security -Wno-init-self -Wwrite-strings -Wshift-count-overflow -Wdeclaration-after-statement -Wno-undef -Wno-unknown-pragmas -O -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing  -Wno-uninitialized -DENABLED_DEBUG_SYNC -ggdb3 -DSAFE_MUTEX -Wall -Wdeclaration-after-statement -Wextra -Wformat-security -Wno-format-truncation -Wno-init-self -Wno-nonnull-compare -Wno-unused-parameter -Wvla -Wwrite-strings -Werror    -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=0 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -march=armv7-a -mfpu=vfpv3-d16 -mtune=generic-armv7-a -mabi=aapcs-linux -mfloat-abi=hard -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -O0 -g -D_FORTIFY_SOURCE=0 -Wno-error=class-memaccess -D HAVE_COMPRESS -D LIBMARIADB -D THREAD -fPIC -o CMakeFiles/mariadb_obj.dir/mariadb_stmt.c.o   -c /builddir/build/BUILD/mariadb-10.3.22/libmariadb/libmariadb/mariadb_stmt.c
    In file included from /builddir/build/BUILD/mariadb-10.3.22/libmariadb/libmariadb/mariadb_stmt.c:46:
    /builddir/build/BUILD/mariadb-10.3.22/libmariadb/libmariadb/mariadb_stmt.c: In function 'mysql_net_store_length':
    /builddir/build/BUILD/mariadb-10.3.22/libmariadb/include/ma_global.h:914:85: error: right shift count >= width of type [-Werror=shift-count-overflow]
      914 | #define int8store(T,A)       do { uint def_temp= (uint) (A), def_temp2= (uint) ((A) >> 32); \
          |                                                                                     ^~
    /builddir/build/BUILD/mariadb-10.3.22/libmariadb/libmariadb/mariadb_stmt.c:476:3: note: in expansion of macro 'int8store'
      476 |   int8store(packet, length);
          |   ^~~~~~~~~
    cc1: all warnings being treated as errors
    

    [ 11%] Building C object libmariadb/libmariadb/CMakeFiles/mariadb_obj.dir/ma_context.c.o
    cd /builddir/build/BUILD/mariadb-10.3.22/libmariadb/libmariadb && /usr/bin/cc -DHAVE_CONFIG_H -DHAVE_OPENSSL -DHAVE_TLS -DLIBICONV_PLUG -DMARIADB_MACHINE_TYPE=\"armv7l\" -DMARIADB_SYSTEM_TYPE=\"Linux\" -D_FILE_OFFSET_BITS=64 -I/builddir/build/BUILD/mariadb-10.3.22/libmariadb/include -I/builddir/build/BUILD/mariadb-10.3.22/libmariadb/plugins/auth -I/builddir/build/BUILD/mariadb-10.3.22/libmariadb/plugins/pvio -I/builddir/build/BUILD/mariadb-10.3.22/libmariadb/libmariadb  -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=0 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -march=armv7-a -mfpu=vfpv3-d16 -mtune=generic-armv7-a -mabi=aapcs-linux -mfloat-abi=hard -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -O0 -g -D_FORTIFY_SOURCE=0 -Wno-error=class-memaccess -Wno-error=shift-count-overflow -pie -fPIC -Wl,-z,relro,-z,now -fstack-protector --param=ssp-buffer-size=4 -fPIC -Wunused -Wlogical-op -Wno-uninitialized -Wall -Wextra -Wformat-security -Wno-init-self -Wwrite-strings -Wshift-count-overflow -Wdeclaration-after-statement -Wno-undef -Wno-unknown-pragmas -O -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing  -Wno-uninitialized -DENABLED_DEBUG_SYNC -ggdb3 -DSAFE_MUTEX -Wall -Wdeclaration-after-statement -Wextra -Wformat-security -Wno-format-truncation -Wno-init-self -Wno-nonnull-compare -Wno-unused-parameter -Wvla -Wwrite-strings -Werror    -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=0 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -march=armv7-a -mfpu=vfpv3-d16 -mtune=generic-armv7-a -mabi=aapcs-linux -mfloat-abi=hard -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -O0 -g -D_FORTIFY_SOURCE=0 -Wno-error=class-memaccess -Wno-error=shift-count-overflow -D HAVE_COMPRESS -D LIBMARIADB -D THREAD -fPIC -o CMakeFiles/mariadb_obj.dir/ma_context.c.o   -c /builddir/build/BUILD/mariadb-10.3.22/libmariadb/libmariadb/ma_context.c
    /builddir/build/BUILD/mariadb-10.3.22/libmariadb/libmariadb/ma_context.c: In function 'my_context_spawn':
    /builddir/build/BUILD/mariadb-10.3.22/libmariadb/libmariadb/ma_context.c:104:3: error: 'u.a[1]' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      104 |   makecontext(&c->spawned_context, my_context_spawn_internal, 2,
          |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      105 |               u.a[0], u.a[1]);
          |               ~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    

  • i686 (aslo apply for armv7hl): failure, following error:

    [ 62%] Building CXX object storage/innobase/CMakeFiles/innobase.dir/page/page0zip.cc.o
    cd /builddir/build/BUILD/mariadb-10.3.22/storage/innobase && /usr/bin/c++  -DBTR_CUR_ADAPT -DBTR_CUR_HASH_ADAPT -DCOMPILER_HINTS -DHAVE_C99_INITIALIZERS -DHAVE_CONFIG_H -DHAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE=1 -DHAVE_IB_LINUX_FUTEX=1 -DHAVE_LZ4=1 -DHAVE_LZ4_COMPRESS_DEFAULT=1 -DHAVE_LZMA=1 -DHAVE_NANOSLEEP=1 -DHAVE_SCHED_GETCPU=1 -DLINUX_NATIVE_AIO=1 -DMUTEX_EVENT -DUNIV_ZIP_DEBUG -DWITH_INNODB_DISALLOW_WRITES -D_FILE_OFFSET_BITS=64 -I/builddir/build/BUILD/mariadb-10.3.22/include -I/builddir/build/BUILD/mariadb-10.3.22/storage/innobase/include -I/builddir/build/BUILD/mariadb-10.3.22/storage/innobase/handler -I/builddir/build/BUILD/mariadb-10.3.22/libbinlogevents/include -I/builddir/build/BUILD/mariadb-10.3.22/sql  -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=0 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m32 -march=i686 -mtune=generic -msse2 -mfpmath=sse -mstackrealign -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -O0 -g -D_FORTIFY_SOURCE=0 -Wno-error=class-memaccess -pie -fPIC -Wl,-z,relro,-z,now -fstack-protector --param=ssp-buffer-size=4 -fPIC -fno-rtti -O -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -Wno-uninitialized -DENABLED_DEBUG_SYNC -ggdb3 -DSAFE_MUTEX -Wall -Wextra -Wformat-security -Wno-format-truncation -Wno-init-self -Wno-nonnull-compare -Wno-unused-parameter -Woverloaded-virtual -Wnon-virtual-dtor -Wvla -Wwrite-strings -Werror -DUNIV_DEBUG    -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=0 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m32 -march=i686 -mtune=generic -msse2 -mfpmath=sse -mstackrealign -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -O0 -g -D_FORTIFY_SOURCE=0 -Wno-error=class-memaccess -DUNIV_LINUX -D_GNU_SOURCE=1  -fvisibility=hidden -o CMakeFiles/innobase.dir/page/page0zip.cc.o -c /builddir/build/BUILD/mariadb-10.3.22/storage/innobase/page/page0zip.cc
    /builddir/build/BUILD/mariadb-10.3.22/storage/innobase/page/page0zip.cc: In function 'ulint page_zip_validate_low(const page_zip_des_t*, const ib_page_t*, const dict_index_t*, ulint)':
    /builddir/build/BUILD/mariadb-10.3.22/storage/innobase/page/page0zip.cc:3435:20: error: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'ulint' {aka 'unsigned int'} [-Werror=format=]
     3435 |     page_zip_fail(("page_zip_validate:"
          |                    ^~~~~~~~~~~~~~~~~~~~
     3436 |             " min_rec_flag"
          |             ~~~~~~~~~~~~~~~
     3437 |             " (%s%lu,%lu,0x%02lx)\n",
          |             ~~~~~~~~~~~~~~~~~~~~~~~~
     3438 |             sloppy ? "ignored, " : "",
     3439 |             page_get_space_id(page),
          |             ~~~~~~~~~~~~~~~~~~~~~~~
          |                              |
          |                              ulint {aka unsigned int}
    /builddir/build/BUILD/mariadb-10.3.22/storage/innobase/page/page0zip.cc:143:53: note: in definition of macro 'page_zip_fail'
      143 | # define page_zip_fail(fmt_args) page_zip_fail_func fmt_args
          |                                                     ^~~~~~~~
    /builddir/build/BUILD/mariadb-10.3.22/storage/innobase/page/page0zip.cc:3437:20: note: format string is defined here
     3437 |             " (%s%lu,%lu,0x%02lx)\n",
          |                  ~~^
          |                    |
          |                    long unsigned int
          |                  %u
    /builddir/build/BUILD/mariadb-10.3.22/storage/innobase/page/page0zip.cc:3435:20: error: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'ulint' {aka 'unsigned int'} [-Werror=format=]
     3435 |     page_zip_fail(("page_zip_validate:"
          |                    ^~~~~~~~~~~~~~~~~~~~
     3436 |             " min_rec_flag"
          |             ~~~~~~~~~~~~~~~
     3437 |             " (%s%lu,%lu,0x%02lx)\n",
          |             ~~~~~~~~~~~~~~~~~~~~~~~~
    ......
     3440 |             page_get_page_no(page),
          |             ~~~~~~~~~~~~~~~~~~~~~~
          |                             |
          |                             ulint {aka unsigned int}
    /builddir/build/BUILD/mariadb-10.3.22/storage/innobase/page/page0zip.cc:143:53: note: in definition of macro 'page_zip_fail'
      143 | # define page_zip_fail(fmt_args) page_zip_fail_func fmt_args
          |                                                     ^~~~~~~~
    /builddir/build/BUILD/mariadb-10.3.22/storage/innobase/page/page0zip.cc:3437:24: note: format string is defined here
     3437 |             " (%s%lu,%lu,0x%02lx)\n",
          |                      ~~^
          |                        |
          |                        long unsigned int
          |                      %u
    cc1plus: all warnings being treated as errors
    make[2]: *** [storage/innobase/CMakeFiles/innobase.dir/build.make:1002: storage/innobase/CMakeFiles/innobase.dir/page/page0zip.cc.o] Error 1
    make[2]: Leaving directory '/builddir/build/BUILD/mariadb-10.3.22'
    make[1]: *** [CMakeFiles/Makefile2:4738: storage/innobase/CMakeFiles/innobase.dir/all] Error 2
    make[1]: *** Waiting for unfinished jobs....
    

MariaDB 10.4.12:

  • Same as 10.3.22, with following adition on x86_64: "-Wno-error=enum-conversion"

    [  7%] Building C object strings/CMakeFiles/strings.dir/json_lib.c.o
    cd /builddir/build/BUILD/mariadb-10.4.12/strings && /usr/bin/cc -DDISABLE_MYSQL_THREAD_H -DHAVE_CONFIG_H -D_FILE_OFFSET_BITS=64 -I/builddir/build/BUILD/mariadb-10.4.12/wsrep-lib/include -I/builddir/build/BUILD/mariadb-10.4.12/wsrep-lib/wsrep-API/v26 -I/builddir/build/BUILD/mariadb-10.4.12/include  -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=0 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -O0 -g -D_FORTIFY_SOURCE=0 -Wno-error=class-memaccess -pie -fPIC -Wl,-z,relro,-z,now -fstack-protector --param=ssp-buffer-size=4 -fPIC -O -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing  -Wno-uninitialized -DENABLED_DEBUG_SYNC -ggdb3 -DSAFE_MUTEX -Wall -Wdeclaration-after-statement -Wextra -Wformat-security -Wno-format-truncation -Wno-init-self -Wno-nonnull-compare -Wno-unused-parameter -Wvla -Wwrite-strings -Werror    -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=0 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC -O0 -g -D_FORTIFY_SOURCE=0 -Wno-error=class-memaccess -o CMakeFiles/strings.dir/json_lib.c.o   -c /builddir/build/BUILD/mariadb-10.4.12/strings/json_lib.c
    /builddir/build/BUILD/mariadb-10.4.12/strings/json_lib.c: In function 'smart_read_value':
    /builddir/build/BUILD/mariadb-10.4.12/strings/json_lib.c:1875:12: error: implicit conversion from 'enum json_value_types' to 'enum json_types' [-Werror=enum-conversion]
     1875 |   return je->value_type;
          |          ~~^~~~~~~~~~~~
    cc1: all warnings being treated as errors
    


Neither armv7hl nor i686 are crucial architectures these days. Thus the main message is rather positive - it works better on important architectures.

I tried to make most of the builds in a separate public space, where the builds could be examined later -with some degree of success. So I should be able to give you the full build logs, if they would be any good for you.

I didn't make 10.5.1 builds, but I'm looking forward doing them too, with some future 10.5 release.

Comment by Marko Mäkelä [ 2020-03-10 ]

I hope that I fixed the WITH_INNODB_EXTRA_DEBUG, although I was unable to repeat it on GCC 10 on 64-bit, or GCC 9 on 32-bit (IA-32). For some reason, the 32-bit configuration for GCC 10 failed on my system (Debian unstable), and I was unable to reproduce the warning.

I wonder why you enable that flag, though. It only enables UNIV_ZIP_DEBUG, which was used in internal testing when I developed the InnoDB ROW_FORMAT=COMPRESSED back in 2004 and 2005. I would say that it is well past its ‘best before’ date.

Comment by Marko Mäkelä [ 2020-03-13 ]

The 10.2 branch now compiles for me with both the GCC 10.0.1 and clang 10.0.0 that are available in Debian Sid (unstable). These fixes will likely miss the 10.5.2 release.
Strangely, some warnings seem to depend not only on optimization settings but also the size of the generated code, or something like that. In MDEV-21933 I fixed a warning that was only reported on the 10.5 branch, not for the corresponding code in the 10.2 branch. In MDEV-21907 (introducing -Wconversion for InnoDB on 10.5) there were significant differences between some GCC with the same major version: GCC 5.3.0 i386 debug flagged more warnings than GCC 5.4.0 amd64 debug ASAN.

Comment by Marko Mäkelä [ 2020-03-13 ]

Also 10.3 compiles now for me. The GCC 10 -Wstringop-overflow depends on how code is optimized. Although some code is almost identical between 10.2 and 10.3, I only got the warning for 10.3 or later. Fixed also in 10.2 by simplifying some code.

Comment by Marko Mäkelä [ 2020-03-16 ]

In 10.4, MDEV-5313 and MDEV-16188 introduced some type mismatch, triggering GCC 10 -Wenum-conversion and clang 10 -Wimplicit-int-float-conversion.

Comment by Marko Mäkelä [ 2020-03-16 ]

It looks like my fixes for GCC 10 and clang 10 could reach the 10.5.2 release after all. But I am building a very limited set of storage engines.

Comment by Marko Mäkelä [ 2020-03-17 ]

In my experience, cmake -DWITH_ASAN=ON will cause GCC to emit even more warnings. I just fixed one -Wmaybe-uninitialized in 10.2 that was flagged by GCC for an 10.5 ASAN build. I also have the feeling that GCC is reporting some bogus -Wstringop-overflow when -fsanitize=address is enabled.

Comment by Marko Mäkelä [ 2020-04-01 ]

I think that we should by default enable all warnings, and have MYSQL_MAINTAINER_MODE only enable -Werror. Currently, a debug version of 10.1 cannot be built with GCC 10 or clang 10 because of various -Werror. That would not be changed by me; I think that 10.1 is already too close to its end of life. But, with my pending change, if you specify cmake -DMYSQL_MAINTAINER_MODE=OFF, you will not lose useful warnings. (And we will enjoy those warnings also for non-debug builds by default.)

Comment by Roel Van de Paar [ 2020-04-11 ]

Just small note to confirm that 10.1, debug, can not be build with GCC 7.5.0 without `-DMYSQL_MAINTAINER_MODE=OFF`:

10.1.45 c8e0c524af83149e77c88e9a6fd763221dea9277

/test/10.1_dbg/storage/myisam/ft_nlq_search.c: In function ‘walk_and_match’:
/test/10.1_dbg/storage/myisam/ft_nlq_search.c:139:15: error: ‘subkeys.i’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
     tmp_weight= subkeys.f;
     ~~~~~~~~~~^~~~~~~~~~~

Adding `-DMYSQL_MAINTAINER_MODE=OFF` enables the build to complete. Interestingly, `-DMYSQL_MAINTAINER_MODE=0` does not work and still aborts the build as above.

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