[CONC-426] Cmake errors during the debug build Created: 2019-07-16  Updated: 2019-07-20  Resolved: 2019-07-20

Status: Closed
Project: MariaDB Connector/C
Component/s: None
Affects Version/s: 3.1.2
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Michal Schorm Assignee: Georg Richter
Resolution: Not a Bug Votes: 0
Labels: None
Environment:

Fedora


Attachments: File CMakeError.log     File CMakeError.log_2     File CMakeOutput.log     File CMakeOutput.log_2    

 Description   

Hello,
I have a problem running the debug build of the CONC/C.

I use the following:

%{?with_debug: CFLAGS="$CFLAGS -O0 -g"}
CXXFLAGS="$CFLAGS"
export CFLAGS CXXFLAGS

-DCMAKE_BUILD_TYPE="Debug"

on standard x86_64.

What I get is:

-- Check if the system is big endian
-- Searching 16 bit integer
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of unsigned short
-- Check size of unsigned short - failed
-- Check size of unsigned int
-- Check size of unsigned int - failed
-- Check size of unsigned long
-- Check size of unsigned long - failed
CMake Error at /usr/share/cmake/Modules/TestBigEndian.cmake:50 (message):
  no suitable type found
Call Stack (most recent call first):
  CMakeLists.txt:213 (TEST_BIG_ENDIAN)
 
 
-- Configuring incomplete, errors occurred!

Which, when googled:
https://github.com/emscripten-core/emscripten/issues/400
can be worked around by setting the "SET(CMAKE_16BIT_TYPE "unsigned short")" into /usr/share/cmake/Modules/TestBigEndian.cmake
Which apparently isn't a good solution.


The next error is:

-- Configuring done
CMake Error at libmariadb/CMakeLists.txt:369 (ADD_LIBRARY):
  Cannot find source file:
 
    ../zlib/adler32.c
 
  Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
  .hpp .hxx .in .txx
 
CMake Error at libmariadb/CMakeLists.txt:369 (ADD_LIBRARY):
  No SOURCES given to target: mariadb_obj
 
CMake Error at libmariadb/CMakeLists.txt:397 (ADD_LIBRARY):
  No SOURCES given to target: libmariadb
 
CMake Error at libmariadb/CMakeLists.txt:393 (ADD_LIBRARY):
  No SOURCES given to target: mariadbclient

Which is caused by me, executing "rm -r win zlib win-iconv examples" to be extra sure, those parts are not used during the compilation. For example that I force system zlib implementation.
So the error above shouldn't IMHO happen with "-DWITH_EXTERNAL_ZLIB=YES", which I use.


The next error is FTBFS

In file included from /home/faramos/work/COCN-C_final/mariadb-connector-c/mariadb-connector-c-3.1.2-src/plugins/auth/caching_sha2_pw.c:31:
/home/faramos/work/COCN-C_final/mariadb-connector-c/mariadb-connector-c-3.1.2-src/include/ma_global.h:621:2: error: #error "Neither int or long is of 4 bytes width"
 #error "Neither int or long is of 4 bytes width"
  ^~~~~
make[2]: *** [CMakeFiles/caching_sha2_password.dir/build.make:66: CMakeFiles/caching_sha2_password.dir/plugins/auth/caching_sha2_pw.c.o] Error 1
make[2]: Entering directory '/home/faramos/work/COCN-C_final/mariadb-connector-c/mariadb-connector-c-3.1.2-src'
[  3%] Building C object CMakeFiles/caching_sha2_password.dir/plugins/auth/caching_sha2_pw.c.o
/usr/bin/cc -DHAVE_OPENSSL -DHAVE_TLS -DMARIADB_MACHINE_TYPE=\"x86_64\" -DMARIADB_SYSTEM_TYPE=\"Linux\" -Dcaching_sha2_password_EXPORTS -I/usr/include -I/home/faramos/work/COCN-C_final/mariadb-connector-c/mariadb-connector-c-3.1.2-src/include -I/home/faramos/work/COCN-C_final/mariadb-connector-c/mariadb-connector-c-3.1.2-src/plugins/auth -I/home/faramos/work/COCN-C_final/mariadb-connector-c/mariadb-connector-c-3.1.2-src/plugins/pvio  -O0 -g -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 -fPIC   -DPLUGIN_DYNAMIC=1  -o CMakeFiles/caching_sha2_password.dir/plugins/auth/caching_sha2_pw.c.o   -c /home/faramos/work/COCN-C_final/mariadb-connector-c/mariadb-connector-c-3.1.2-src/plugins/auth/caching_sha2_pw.c
make[2]: Leaving directory '/home/faramos/work/COCN-C_final/mariadb-connector-c/mariadb-connector-c-3.1.2-src'
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/caching_sha2_password.dir/all] Error 2
make: *** [Makefile:155: all] Error 2

Which may be caused by the improper workaround of the first issue.


Can reproduce same errors in your buildbot?

For the full reference, the Fedora sources can be found here:
https://src.fedoraproject.org/rpms/mariadb-connector-c/tree/master
https://src.fedoraproject.org/rpms/mariadb-connector-c/blob/master/f/mariadb-connector-c.spec



 Comments   
Comment by Georg Richter [ 2019-07-16 ]

Hi Michal,

can you please attach CMakeOutput/Error log files?

Thanks!

Comment by Georg Richter [ 2019-07-16 ]

About TestBigEndian:
Cmake issue #16283
Seems to happen only when cross compiling - possible workaround would be to disable test by setting
-DTEST_BIG_ENDIAN=0

Comment by Michal Schorm [ 2019-07-19 ]

The issue is sure appaering when building package on the smae architecture as the result. No cross-compiling ( yet ).
It may happen in our build infrastructure that packages some arches are cross-compiled on others. However, in this ticket, let's assume I'm building x86_64 package on x86_64 architecture and nothing else.

I gathered the log files with something like:

mock --chroot cat /builddir/build/BUILD/mariadb-connector-c-3.1.2-src/CMakeFiles/CMakeOutput.log > /tmp/CMakeOutput.log

Maybe you would like to see the build log nad CMake log files with some CMake debug options. You just need to specify wihch ones as I don't know them.

Comment by Georg Richter [ 2019-07-19 ]

Hmm... something seems to be broken, all the size check type tests fail, e.g.

/usr/bin/ld: CMakeFiles/cmTC_e503c.dir/CMAKE_SIZEOF_UNSIGNED_LONG.c.o: relocation R_X86_64_32S against symbol `info_size' can not be used when making a shared object; recompile with -fPIC

Comment by Michal Schorm [ 2019-07-19 ]

With added

export LDFLAGS="$LDFLAGS -fPIC"

it builds fine

Here are the same logfiles for comparsion (*.log_2)


Since the -fPIC is benefitial for the library, I'll just start using that to all future builds.
Form my side, it's fine to close the issue.

Comment by Georg Richter [ 2019-07-20 ]

Closed on user request

Generated at Thu Feb 08 03:05:14 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.