Error compiling Mysql-server-5.5.2

I made mysql-server version 5.5.2 of course this version is very old but useful for routers without using swap and the file size is very small.
currently I can only build on openwrt 17.01.x and 18.04.x.
i tried to build on openwrt 19.07.x but i got an error log i am including below and it seems it is related to gcc version issue in openwrt 19.07.x and i don't know how to solve this error

nour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -iremap/home/admin/jj/build_dir/target-mipsel_24kc_musl/mysql-5.5.2:mysql-5.5.2 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -fpic -fno-implicit-templates -fno-exceptions -fno-rtti -MT mysqlbinlog.o -MD -MP -MF .deps/mysqlbinlog.Tpo -c -o mysqlbinlog.o mysqlbinlog.cc
In file included from client_priv.h:18:0,
                 from mysqlbinlog.cc:31:
../include/my_global.h:915:0: warning: "isnan" redefined
 #define isnan(x) ((x) != (x))
 
In file included from ../include/my_global.h:421:0,
                 from client_priv.h:18,
                 from mysqlbinlog.cc:31:
/home/admin/jj/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl/include/math.h:78:0: note: this is the location of the previous definition
 #define isnan(x) ( \
 
mysqlbinlog.cc:1147:1: error: narrowing conversion of '18446744073709551615' from 'ulonglong {aka long long unsigned int}' to 'longlong {aka long long int}' inside { } [-Wnarrowing]
 };
 ^
mysqlbinlog.cc:1147:1: error: narrowing conversion of '18446744073709551615' from 'ulonglong {aka long long unsigned int}' to 'longlong {aka long long int}' inside { } [-Wnarrowing]
Makefile:971: recipe for target 'mysqlbinlog.o' failed
make[5]: *** [mysqlbinlog.o] Error 1
make[5]: Leaving directory '/home/admin/jj/build_dir/target-mipsel_24kc_musl/mysql-5.5.2/client'
Makefile:671: recipe for target 'all' failed
make[4]: *** [all] Error 2
make[4]: Leaving directory '/home/admin/jj/build_dir/target-mipsel_24kc_musl/mysql-5.5.2/client'
Makefile:630: recipe for target 'all-recursive' failed
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory '/home/admin/jj/build_dir/target-mipsel_24kc_musl/mysql-5.5.2'
Makefile:188: recipe for target '/home/admin/jj/build_dir/target-mipsel_24kc_musl/mysql-5.5.2/.built' failed

success build openwrt 17.01.x and 18.04


BusyBox v1.25.1 () built-in shell (ash)

     _________
    /        /\      _    ___ ___  ___
   /  LE    /  \    | |  | __|   \| __|
  /    DE  /    \   | |__| _|| |) | _|
 /________/  LE  \  |____|___|___/|___|                      lede-project.org
 \        \   DE /
  \    LE  \    /  ----------------------------------------------------------
-
   \  DE    \  /    Reboot (17.01.4, r3560-79f57e422d)
    \________\/    ----------------------------------------------------------
-

=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
root@LEDE:~# mysql -V                                                     
mysql  Ver 14.14 Distrib 5.5.2-m2, for openwrt-linux-gnu (mipsel) using readline 7.0
root@LEDE:~# mysql -u root -ppass123                                      
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.2-m2 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SHOW DATABASES;                                                    
+--------------------+
| Database           |
+--------------------+
| information_schema |
| hotspot            |
| mysql              |
| test               |
+--------------------+
4 rows in set (0.00 sec)

mysql> quit 
Bye
root@LEDE:~#

if I google that, I land on this github thread https://gist.github.com/Jamp/7b6aa391f4dcdc738b89391de2a8aa6f#gistcomment-3019541
where it lists how to deal with that.
You probably want to use the patch he lists under "Other Possible Solutions" because the stuff above is just silencing the warning which may or may not be the best thing in the world.

1 Like

I ran into the problem again. i tried to make version 5.5.4 and error
__sync_fetch_and_add_8

sys/libmysys.a ../../dbug/libdbug.a ../../strings/libmystrings.a -lpthread -lm -lpthread
/home/admin/jj/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl/bin/../lib/gcc/mipsel-openwrt-linux-musl/7.5.0/../../../../mipsel-openwrt-linux-musl/bin/ld: my_atomic-t.o: in function `test_atomic_add64':
my_atomic-t.c:(.text+0x368): undefined reference to `__sync_fetch_and_add_8'
/home/admin/jj/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl/bin/../lib/gcc/mipsel-openwrt-linux-musl/7.5.0/../../../../mipsel-openwrt-linux-musl/bin/ld: my_atomic-t.c:(.text+0x38c): undefined reference to `__sync_fetch_and_add_8'
/home/admin/jj/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl/bin/../lib/gcc/mipsel-openwrt-linux-musl/7.5.0/../../../../mipsel-openwrt-linux-musl/bin/ld: my_atomic-t.c:(.text+0x3a0): undefined reference to `__sync_fetch_and_add_8'
/home/admin/jj/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl/bin/../lib/gcc/mipsel-openwrt-linux-musl/7.5.0/../../../../mipsel-openwrt-linux-musl/bin/ld: my_atomic-t.c:(.text+0x3ac): undefined reference to `__sync_fetch_and_add_8'
/home/admin/jj/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl/bin/../lib/gcc/mipsel-openwrt-linux-musl/7.5.0/../../../../mipsel-openwrt-linux-musl/bin/ld: my_atomic-t.o: in function `do_tests':
my_atomic-t.c:(.text+0x7e0): undefined reference to `__sync_fetch_and_add_8'
/home/admin/jj/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl/bin/../lib/gcc/mipsel-openwrt-linux-musl/7.5.0/../../../../mipsel-openwrt-linux-musl/bin/ld: my_atomic-t.o:my_atomic-t.c:(.text+0x7f4): more undefined references to `__sync_fetch_and_add_8' follow
collect2: error: ld returned 1 exit status
Makefile:627: recipe for target 'my_atomic-t' failed
make[5]: *** [my_atomic-t] Error 1
make[5]: Leaving directory '/home/admin/jj/build_dir/target-mipsel_24kc_musl/mysql-5.5.4-m3/unittest/mysys'
Makefile:570: recipe for target 'all-recursive' failed

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.