Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-21206

Can't link/include C library 'zlib', aborting. during MariaDb installation

Details

    Description

      While installing MariaDB its unable to link Zlib library and ended with below error.

      I will use the following settings for compiling and testing:
       
        cflags        (mysql_config) = -I/opt/alu-rp/mysql/include/mysql -I/opt/alu-rp/mysql/include/mysql/..
        embedded      (mysql_config) = 
        ldflags       (guessed     ) = 
        libs          (mysql_config) = -L/opt/alu-rp/mysql/lib -lmariadb -lpthread *-lzlib* -ldl -lm -lgnutls
        mysql_config  (guessed     ) = mysql_config
        nocatchstderr (default     ) = 0
        nofoundrows   (default     ) = 0
        nossl         (default     ) = 0
        testdb        (default     ) = test
        testhost      (default     ) = 
        testpassword  (default     ) = 
        testport      (default     ) = 
        testsocket    (default     ) = 
        testuser      (guessed     ) = 
       
      To change these settings, see 'perl Makefile.PL --help' and
      'perldoc DBD::mysql::INSTALL'.
       
      Checking if libs are available for compiling...
      Can't link/include C library 'zlib', aborting.
      

      But I could see the zlib need to be accessed as -lz

      [root@motiveche076 ~]# pkg-config zlib --libs
      -lz
      

      Attachments

        Issue Links

          Activity

            robertbindar Robert Bindar added a comment -

            Hi RagulR! I'm trying to investigate this and I can't figure out whether mysql_config was wrong to suggest you `-lzlib` and it should've instead suggested `-lz`, or it shouldn't suggest `-lzlib` at all. Is it possible to remove the `-lzlib` flag by hand in whatever you are compiling and see if the error goes away?

            robertbindar Robert Bindar added a comment - Hi RagulR ! I'm trying to investigate this and I can't figure out whether mysql_config was wrong to suggest you `-lzlib` and it should've instead suggested `-lz`, or it shouldn't suggest `-lzlib` at all. Is it possible to remove the `-lzlib` flag by hand in whatever you are compiling and see if the error goes away?
            RagulR Ragul added a comment -

            Thanks for the investigation, Robert.
            Yes, I currently overriding the flag '-lzlib' as '-lz' to unblock my installation.

            But I could see the zlib need to be accessed as -lz instead of '-lzlib'

             
            [root@~]# pkg-config zlib --libs
            -lz
            

            RagulR Ragul added a comment - Thanks for the investigation, Robert. Yes, I currently overriding the flag '-lzlib' as '-lz' to unblock my installation. But I could see the zlib need to be accessed as -lz instead of '-lzlib'   [root@~]# pkg-config zlib --libs -lz
            robertbindar Robert Bindar added a comment -

            Good that you unblocked your installation! So ideally mysql_config/mariadb_config should output `-lzlib` only when running the script from within a build-from-sources mariadb server (and that server is built with -DWITH_ZLIB=bundled) and in that case it is correct, because the bundled version of zlib results in a static library called 'libzlib.a'.
            But for binary tarballs it should never happen, mysql_config should call mariadb_config behind the scenes and that should only return '-lmariadb' (in theory) as linking flag starting with 10.2 (for sure it should never return '-lzlib' because we don't even ship any libzlib.a in our tarballs).

            I would appreciate a lot if you could help me understand why mysql_config behaves that way for you.
            I need to know some internal values from within the script, you can obtain them by going into the script and add something like this before the script exits:
            > echo "########"
            > echo $basedir
            > ls -l $basedir/bin/
            > echo $me

            Let me know if you need help with that.

            robertbindar Robert Bindar added a comment - Good that you unblocked your installation! So ideally mysql_config/mariadb_config should output `-lzlib` only when running the script from within a build-from-sources mariadb server (and that server is built with -DWITH_ZLIB=bundled) and in that case it is correct, because the bundled version of zlib results in a static library called 'libzlib.a'. But for binary tarballs it should never happen, mysql_config should call mariadb_config behind the scenes and that should only return '-lmariadb' (in theory) as linking flag starting with 10.2 (for sure it should never return '-lzlib' because we don't even ship any libzlib.a in our tarballs). I would appreciate a lot if you could help me understand why mysql_config behaves that way for you. I need to know some internal values from within the script, you can obtain them by going into the script and add something like this before the script exits: > echo "########" > echo $basedir > ls -l $basedir/bin/ > echo $me Let me know if you need help with that.
            robertbindar Robert Bindar added a comment -

            Also RagulR, I would appreciate a lot if you could try your installation without any '-lz' or '-lzlib' at all.

            robertbindar Robert Bindar added a comment - Also RagulR , I would appreciate a lot if you could try your installation without any '-lz' or '-lzlib' at all.
            robertbindar Robert Bindar added a comment -

            Fixed with b082716892071fdc3c961e9afaa011e0f6beb102

            robertbindar Robert Bindar added a comment - Fixed with b082716892071fdc3c961e9afaa011e0f6beb102

            People

              robertbindar Robert Bindar
              RagulR Ragul
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.