2

Simple question really, I'm trying to compile a 32-bit code-base on a 64-bit system (ubuntu 22).

Getting the error: /usr/bin/ld: cannot find -lmysqlclient: No such file or directory

I know it's because the linker can't find the 32-bit mysqlclient library. However, upon searching I can't find the :i386 package for this Ubuntu version.

Do I need to manually download the MySQL source and compile it for 32-bit? Does anyone know of another (easier) alternative?

I think I had this issue a few years back on another distribution and ended up downloading the source code and compiling, but I'm sure there's a better way by now that will keep my distro "clean" by using packages?

Any help is appreciated!.

3
  • Everyone is phasing out 32-bit versions. Why do you need 32-bit? (There may have been a 16-bit version long ago.)
    – Rick James
    Aug 29, 2022 at 0:23
  • The Code-base I'm working on is originally from 1995, it's always been a 32-bit implementation. I've already ported parts to work on the more modern compiler(s), but the 64-bit byte types are really difficult/tedious to actually change (420,000 or so lines of code).
    – OBR_EXO
    Aug 29, 2022 at 0:39
  • Can you show us a short example of the tedious-to-change code?
    – Rick James
    Aug 29, 2022 at 13:47

1 Answer 1

1

So, I've resolved the issue, here's how...

  1. Installed the 32-bit environment for gcc and g++

    sudo apt install gcc-multilib g++-multilib sudo apt-get install libc6-dev:i386 gcc:i386 sudo apt-get install g++:i386

  2. Manually download and install the mysql-apt-config_0.8.23-1_all.deb from the MySQL website.

  3. Installed the libmysqlclient21 package from that repository.

  4. Created Soft link to the .so in the /usr/lib/mysql directory - sudo ln -sf .././i386-linux-gnu/libmysqlclient.so.21.2.30 libmysqlclient.so

  5. Discovered while it now linked, it wouldn't compile due to no dev-package for that version.

  6. Download the Ubuntu18 packages (libmysqlclient21_8.0.30-1ubuntu18.04_i386.deb, mysql-community-client-plugins_8.0.30-1ubuntu18.04_i386.deb, libmysqlclient-dev_8.0.30-1ubuntu18.04_i386.deb), force-install these.

  7. Recompiled, found a link error due to missing dependencies caused by the force install.

  8. Downloaded the missing dependency (libssl1.1_1.1.1-1ubuntu2.1~18.04.20_i386.deb), installed (forced install not necessary).

  9. make clean, make - Bingo!!! All working!

I had to make other code changes to the code-base prior to doing this, but this explains how you can get a 32-bit MySQL version working on Ubuntu 22.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .