st-ty1 / Artix_FreshTomato

HowTo: Build FreshTomato-mips/-arm with Artix
4 stars 0 forks source link

mysql_autotools #1

Closed pedro0311 closed 2 years ago

pedro0311 commented 3 years ago

There is no way this will work. Let's take MySQL 5.5.62 with cmake. You have added (https://github.com/st-ty1/Artix_FreshTomato/blob/master/mysql_autotools/Makefile_cmake.patch):

+   @cd mysql
+   @$(MAKE) -C mysql/vio CC=$(HOSTCC) CXX=g++ AR=ar RANLIB=ranlib NM=nm LD=ld OBJDUMP=objdump
/.../

but 5.5.62 doesn't have Makefile files. Also version for autotools doesn't work, even for 5.1.73 (I've already corrected it locally for my usage). (BTW, you didn't also include updated patches for 5.5.7/5.5.62)

pedro0311 commented 3 years ago

This one works for me (5.1.73):

mysql/stamp-h1: $(OPENSSLDIR) zlib libncurses
    @cp -f mysql/configure mysql/.configure.tmp
    cd mysql && \
        CC=$(HOSTCC) CXX=g++ AR=ar RANLIB=ranlib NM=nm LD=ld OBJDUMP=objdump CFLAGS="" CPPFLAGS="" ./configure
    @cp mysql/include/config.h mysql/include/my_config.h
    @$(MAKE) -C mysql/vio
    @$(MAKE) -C mysql/mysys
    @$(MAKE) -C mysql/strings
    @$(MAKE) -C mysql/dbug
    @$(MAKE) -C mysql/regex
    @$(MAKE) -C mysql/sql gen_lex_hash
    @$(MAKE) -C mysql/scripts comp_sql
    @$(MAKE) -C mysql/extra comp_err
    @mkdir -p mysql/host
    @cp -vf mysql/sql/gen_lex_hash mysql/scripts/comp_sql mysql/extra/comp_err mysql/host
    @$(MAKE) -C mysql clean
    @cp -f mysql/.configure.tmp mysql/configure
    $(call patch_files,mysql)
    cd mysql && \
        CFLAGS="-Os -Wall $(EXTRACFLAGS) -fno-delete-null-pointer-checks -funit-at-a-time --param large-function-growth=800 \
            --param max-inline-insns-single=3000 -ffunction-sections -fdata-sections -fPIC -I$(TOP)/zlib \
            -I$(TOP)/$(OPENSSLDIR)/include -I$(TOP)/libncurses/include" \
        CPPFLAGS="-Os -Wall -fno-delete-null-pointer-checks -funit-at-a-time --param large-function-growth=800 \
            --param max-inline-insns-single=3000 -ffunction-sections -fdata-sections -fPIC -I$(TOP)/zlib \
            -I$(TOP)/$(OPENSSLDIR)/include -I$(TOP)/libncurses/include" \
        LDFLAGS="-L$(TOP)/$(OPENSSLDIR) -L$(TOP)/zlib/staged/usr/lib -L$(TOP)/libncurses/lib -fPIC -EL" \
        LIBS="-lcrypt -lz -lstdc++ -lssl -lcrypto -lncurses -lpthread" \
        $(CONFIGURE) --prefix=/usr \
            --without-debug --without-docs --without-man --with-charset=utf8 --with-extra-charsets=ascii,latin1,gb2312,gbk \
            --enable-shared --disable-static \
            --without-mysqlmanager \
            --with-pthread \
            --with-ssl \
            --without-docs \
            --with-geometry \
            --with-low-memory \
            --enable-assembler \
            --with-zlib-dir="$(TOP)/zlib/staged/usr" \
            ac_cv_c_stack_direction=-1
    @touch $@

mysql-clean:
    -@$(MAKE) -C mysql clean
    -@rm -f mysql/stamp-h1
    -@rm -rf mysql/staged mysql/host
    $(call unpatch_files,mysql)
    -@cp -f mysql/.configure.tmp mysql/configure
st-ty1 commented 3 years ago

Thanks for you comments! And yes, I see the issue in the cmake patch: Something is wrong with the configure part of host-build; cmake part is missing. Have to check this. But this will take some time, because if have dealt with this already in summer, and I have to dig into it again. Autotools version: Good to see, that it works in the end. If you will transfer your modifiaction to the source code of FT, I will delete this part out of this repo definitely. cmake issue may be still worth to look at as far as you can state, that a newer mysql version could be reasonable for FT. BR st-ty1

st-ty1 commented 2 years ago

@pedro0311: CMake version updated. Please check with mysql 5.5.62. Actually still for compiling with zlib supplied by mysql, not yet with zlib supplied by FT. Maybe not working out of the box on Debian11, but on Artix at least the building process works. BR st-ty1

st-ty1 commented 2 years ago

addenum: None of the mysql patches in FT repo for mysql-5.1.73 needed anymore for 5.5.62.

pedro0311 commented 2 years ago

OK thanks, will check it.

st-ty1 commented 2 years ago

Checked again the autotools version for mysql-5.1.73: On Artix, the patch here in my repo works as it is: without the additional handling of the configure file.

pedro0311 commented 2 years ago

So try to 'make [some target]' twice, without 'make clean' between. ;)

st-ty1 commented 2 years ago

purging step is already included in my patch! So log file seems to be ok. First with host system (amd 64), then cleaning (from line 1825), after that building target system (arm), beginning with line 1939. And resulting files are arm type, checked. log_5.1.73.txt

pedro0311 commented 2 years ago

Not quite right in my case. On Debian 10 configure is altered and I ended up with:

find patches/mysql -maxdepth 1 -type f -name '*.patch' | sort -t '\0' -n | while read FILE; do ( if patch -p0 -N -s --dry-run < $FILE 2>/dev/null; then patch -p0 -N -r - --no-backup-if-mismatch < $FILE; fi ) done
patching file mysql/sql/sql_lex.cc
patching file mysql/sql/sql_lex.h
patching file mysql/sql/sql_parse.cc
patching file mysql/sql/sql_yacc.yy
patching file mysql/Makefile.in
patching file mysql/extra/Makefile.am
patching file mysql/extra/Makefile.in
patching file mysql/include/my_global.h
patching file mysql/scripts/Makefile.am
patching file mysql/scripts/Makefile.in
patching file mysql/sql/Makefile.am
patching file mysql/sql/Makefile.in
4 out of 5 hunks FAILED
patching file mysql/config/ac-macros/alloca.m4
cd mysql && \
        CFLAGS="-O2 -Wall -DLINUX26 -DCONFIG_BCMWL5 -DCONFIG_BCMWL6 -DCONFIG_BCMWL6A -DPART_JFFS2_GAP=0UL -pipe -fno-strict-aliasing -DBCMWPA2 -DBCMARM -fno-delete-null-pointer-checks -marm  -DTCONFIG_NVRAM_64K -DLINUX_KERNEL_VERSION=132
644 -fno-delete-null-pointer-checks -funit-at-a-time --param large-function-growth=800 \

/.../

checking for restartable system calls... configure: error: in `/.../release/src-rt-6.x.4708/router/mysql':
configure: error: cannot run test program while cross compiling
See `config.log' for more details

So I have to copy original configure to prevent this problem.

st-ty1 commented 2 years ago

So, let's leave the things as they are: two different autotools versions, two nearly identical solutions.) Could these newer versions of mysql be integrated in FT source (file sizes too big?), and do they work with the current php version at all? Never checked this before, because I don't use mysql/php on my routers. If not, any continuation does not make sense for me, and I will stop this work here. (Btw, same question to samba4! Code/patches also in this repo but quite old now, so maybe not working out-of-the-box anymore. As it would take some time to reactivate them, it would be helpful to know, if an integration of samba4 in FT firmware would be beneficial someway.) BR st-ty1

pedro0311 commented 2 years ago

Regarding 5.5.62: it doesn't work (for now) so you can remove these patches: https://bitbucket.org/pedro311/mysql-5.5.62-on-arm-routers/src/master/

st-ty1 commented 2 years ago

Yes, I can see. MySQL buffer size is bigger than free RAM available on your router. Newer versions would even bigger than 5.5.62, so let's stop here.