Bug #94202 FreeBSD12 Mysql5.7 İnstall Make install clean gcc7.4
Submitted: 4 Feb 23:22 Modified: 11 Mar 12:31
Reporter: Samet Abdullah Sarıgül Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: Errors Severity:S3 (Non-critical)
Version:mysql57-server-5.7.24_4 OS:FreeBSD (Mysql 5.7 Server)
Assigned to: CPU Architecture:x86 (FreeBSD12)
Tags: return pthread_self();

[4 Feb 23:22] Samet Abdullah Sarıgül
Description:
FreeBSD gives mysql5.7 error which I want to install with gcc7.4 on the system.

[ 39%] Building CXX object storage/perfschema/CMakeFiles/perfschema.dir/cursor_by_account.cc.o
cd /usr/ports/databases/mysql57-server/work/.build/storage/perfschema && /usr/local/bin/g++  -DBOOST_GEOMETRY_SQRT_CHECK_FINITENESS -DHAVE_CONFIG_H -DHAVE_LIBEVENT2 -DHAVE_OPENSSL -DMYSQL_SERVER -I/usr/ports/databases/mysql57-server/work/.build/include -I/usr/ports/databases/mysql57-server/work/mysql-5.7.24/extra/rapidjson/include -I/usr/ports/databases/mysql57-server/work/.build/libbinlogevents/include -I/usr/ports/databases/mysql57-server/work/mysql-5.7.24/libbinlogevents/export -I/usr/ports/databases/mysql57-server/work/mysql-5.7.24 -I/usr/ports/databases/mysql57-server/work/mysql-5.7.24/include -I/usr/ports/databases/mysql57-server/work/mysql-5.7.24/sql -I/usr/ports/databases/mysql57-server/work/.build/sql -I/usr/ports/databases/mysql57-server/work/mysql-5.7.24/regex -I/usr/ports/databases/mysql57-server/work/mysql-5.7.24/extra/yassl/include -I/usr/ports/databases/mysql57-server/work/mysql-5.7.24/libbinlogevents/include -I/usr/ports/databases/mysql57-server/work/mysql-5.7.24/sql/auth -O2 -pipe -g -Wall  -fstack-protector -isystem /usr/local/include -fno-strict-aliasing   -isystem /usr/local/include -std=c++11 -Wall -Wextra -Wformat-security -Wvla -Wimplicit-fallthrough=2 -Woverloaded-virtual -Wno-unused-parameter -O2 -pipe -g -Wall  -fstack-protector -isystem /usr/local/include -fno-strict-aliasing   -isystem /usr/local/include -std=c++11 -DDBUG_OFF -o CMakeFiles/perfschema.dir/cursor_by_account.cc.o -c /usr/ports/databases/mysql57-server/work/mysql-5.7.24/storage/perfschema/cursor_by_account.cc
In file included from /usr/ports/databases/mysql57-server/work/mysql-5.7.24/storage/perfschema/pfs_con_slice.h:24:0,
                 from /usr/ports/databases/mysql57-server/work/mysql-5.7.24/storage/perfschema/pfs_account.h:26,
                 from /usr/ports/databases/mysql57-server/work/mysql-5.7.24/storage/perfschema/cursor_by_account.h:25,
                 from /usr/ports/databases/mysql57-server/work/mysql-5.7.24/storage/perfschema/cursor_by_account.cc:22:
/usr/ports/databases/mysql57-server/work/mysql-5.7.24/sql/sql_class.h:2240:8: warning: 'template<class> class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
   std::auto_ptr<Transaction_ctx> m_transaction;
        ^~~~~~~~
In file included from /usr/local/lib/gcc7/include/c++/memory:80:0,
                 from /usr/ports/databases/mysql57-server/work/mysql-5.7.24/sql/sql_class.h:51,
                 from /usr/ports/databases/mysql57-server/work/mysql-5.7.24/storage/perfschema/pfs_con_slice.h:24,
                 from /usr/ports/databases/mysql57-server/work/mysql-5.7.24/storage/perfschema/pfs_account.h:26,
                 from /usr/ports/databases/mysql57-server/work/mysql-5.7.24/storage/perfschema/cursor_by_account.h:25,
                 from /usr/ports/databases/mysql57-server/work/mysql-5.7.24/storage/perfschema/cursor_by_account.cc:22:
/usr/local/lib/gcc7/include/c++/bits/unique_ptr.h:51:28: note: declared here
   template<typename> class auto_ptr;
                            ^~~~~~~~
In file included from /usr/ports/databases/mysql57-server/work/mysql-5.7.24/storage/perfschema/pfs_instr.h:36:0,
                 from /usr/ports/databases/mysql57-server/work/mysql-5.7.24/storage/perfschema/pfs_buffer_container.h:22,
                 from /usr/ports/databases/mysql57-server/work/mysql-5.7.24/storage/perfschema/cursor_by_account.cc:23:
/usr/ports/databases/mysql57-server/work/mysql-5.7.24/include/my_thread_os_id.h: In function 'my_thread_os_id_t my_thread_os_id()':
/usr/ports/databases/mysql57-server/work/mysql-5.7.24/include/my_thread_os_id.h:88:22: error: invalid conversion from 'pthread_t {aka pthread*}' to 'my_thread_os_id_t {aka long long unsigned int}' [-fpermissive]
   return pthread_self();
          ~~~~~~~~~~~~^~
*** Error code 1

Stop.
make[3]: stopped in /usr/ports/databases/mysql57-server/work/.build
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/databases/mysql57-server/work/.build
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/databases/mysql57-server/work/.build
*** Error code 1

Stop.
make: stopped in /usr/ports/databases/mysql57-server

How to repeat:
5.7.24/include/my_thread_os_id.h:88:22: error: invalid conversion from 'pthread_t {aka pthread*}' to 'my_thread_os_id_t {aka long long unsigned int}' [-fpermissive]
   return pthread_self();
          ~~~~~~~~~~~~^~
*** Error code 1

The most urgent help I do not know the solution of the error.

Suggested fix:
I do not know
[4 Feb 23:26] Samet Abdullah Sarıgül
static inline my_thread_os_id_t my_thread_os_id()
{
#ifdef HAVE_PTHREAD_THREADID_NP
  /*
    macOS.

    Be careful to use this version first, and to not use SYS_gettid on macOS,
    as SYS_gettid has a different meaning compared to linux gettid().
  */
  uint64_t tid64;
  pthread_threadid_np(nullptr, &tid64);
  return (pid_t)tid64;
#else
#ifdef HAVE_SYS_GETTID
  /*
    Linux.
    See man gettid
    See GLIBC Bug 6399 - gettid() should have a wrapper
    https://sourceware.org/bugzilla/show_bug.cgi?id=6399
  */
  return syscall(SYS_gettid);
#else
#ifdef _WIN32
  /* Windows */
  return GetCurrentThreadId();
#else
#ifdef HAVE_PTHREAD_GETTHREADID_NP
  /* FreeBSD 10.2 */
  return pthread_getthreadid_np();
#else
#ifdef HAVE_INTEGER_PTHREAD_SELF
#  ifdef __DragonFly__
  return syscall(SYS_lwp_gettid);
#  else
  /* Unknown platform, fallback. */
  return pthread_self();
#  endif
#else
  /* Feature not available. */
  return 0;
#endif /* HAVE_INTEGER_PTHREAD_SELF */
#endif /* HAVE_PTHREAD_GETTHREADID_NP */
#endif /* _WIN32 */
#endif /* HAVE_SYS_GETTID */
#endif /* HAVE_SYS_THREAD_SELFID */
}

It is useful to hide the code to bypass the error, but it may not work correctly.

#ifdef HAVE_INTEGER_PTHREAD_SELF
#  ifdef __DragonFly__
  return syscall(SYS_lwp_gettid);
#  else
  /* Unknown platform, fallback. */
  /* return pthread_self(); */
#  endif
#else
  /* Feature not available. */
  return 0;
#endif /* HAVE_INTEGER_PTHREAD_SELF */
[5 Feb 17:13] Terje Røsten
Hi!

Any reason you can't use clang as compiler? 

Clang is the default compiler on FreeBSD, and the standard compiler for MySQL on FreeBSD.
[12 Feb 11:31] Tor Didriksen
MySQL 5.7 is C++03 rather than C++11

In compiler_options.cmake we have:
    # GCC 6 has C++14 as default, set it explicitly to the old default.
    EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion
                    OUTPUT_VARIABLE GXX_VERSION)
    IF(GXX_VERSION VERSION_EQUAL 6.0 OR GXX_VERSION VERSION_GREATER 6.0)
      SET(COMMON_CXX_FLAGS             "${COMMON_CXX_FLAGS} -std=gnu++03")
    ENDIF()
[12 Feb 11:39] Tor Didriksen
oops, I looked at the warnings only, maybe there is a wrong feature test.
Be sure to include  -std=gnu++03 in your CXX flags though, otherwise
cmake feature tests may fail for the wrong reason.
[12 Feb 15:31] Tor Didriksen
even if I do this:
cmake <path to source> -DCMAKE_C_COMPILER=gcc7 -DCMAKE_CXX_COMPILER=g++7 -DFORCE_UNSUPPORTED_COMPILER=1 -DWITH_DEFAULT_COMPILER_OPTIONS=0

I see:
grep HAVE_PTHREAD_GETTHREADID_NP CMakeCache.txt //Test HAVE_PTHREAD_GETTHREADID_NP
HAVE_PTHREAD_GETTHREADID_NP:INTERNAL=1

grep HAVE_PTHREAD_GETTHREADID_NP CMakeFiles/*
CMakeFiles/CMakeOutput.log:Performing C SOURCE FILE Test HAVE_PTHREAD_GETTHREADID_NP succeeded with the following output:
CMakeFiles/CMakeOutput.log:/usr/local/bin/gcc7 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS  -DHAVE_PTHREAD_GETTHREADID_NP -o CMakeFiles/cmTC_7e6d3.dir/src.c.o   -c /export/home/tmp/didrik/5.7-review/CMakeFiles/CMakeTmp/src.c
CMakeFiles/CMakeOutput.log:/usr/local/bin/gcc7  -DHAVE_PTHREAD_GETTHREADID_NP    CMakeFiles/cmTC_7e6d3.dir/src.c.o  -o cmTC_7e6d3 -lm -lcrypt -lpthread -lrt -latomic -lexecinfo 

What is the error message in CMakeFiles/CMakeError.log ??
[12 Mar 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".