Hello Nim community. Thank you for any effort looking into this.

I am facing problem with static compilation of nim program using db_mysql 
module and musl-gcc.

Downloaded `mysql-8.0.28-linux-glibc2.17-x86_64-minimal` (this is already 
compiled) and `openssl-1.1.1m` (compiled myself) to current working directory 
of project and then include headers and libs with "pass" options.

Variables (from Justfile: mysql_include, mysql_libs) are filled with proper 
mysql_config or pkg-config info. `mysql_config --libs` or `pkg-config --static 
--libs mysqlclient` same for ssl libs and includes.
    
    
    nim \
        --dynlibOverride:ssl \
        --dynlibOverride:crypto \
        -d:ssl \
        --passL:"-static" \
        --passC:"{{ssl_include}}" \
        --passL:"{{ssl_libs}}" \
        --passC:"{{mysql_include}}" \
        --passL:"{{mysql_libs}}" \
        --gcc.exe:musl-gcc \
        --gcc.linkerexe:musl-gcc \
        compile {{main_file}}
    
    
    Run

Resulting executable is statically linked but even after succesfull compilation 
program throwing error when I try to run it.

`could not load: (libmysqlclient|libmariadbclient).so(|.20|.19|.18|.17|.16|.15)`

I am willing to provide libmysqlclient.so library to my application on every 
machine but even with LD_LIBRARY_PATH or LD_PRELOAD this seems not work. Maybe 
compiled binary is searching somewhere else for this .so library?

Not able to solve this for few days, so any help is appreciate. Am I doing 
something horribly wrong?

As an alternative, does anyone know any simple "static" mysql client library to 
use instead of oracle-mysql, mariadb and such? I tried theirs C connectors but 
with same result.

Reply via email to