Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error loading module 'mod_sql_odbc.c' #1669

Closed
bernardo-borges opened this issue May 8, 2023 · 9 comments
Closed

error loading module 'mod_sql_odbc.c' #1669

bernardo-borges opened this issue May 8, 2023 · 9 comments

Comments

@bernardo-borges
Copy link

What I Did

I have a apline docker container with mysql configuration as backend, but I want using SQL Server, i added the module mod_sql_odbc.c but when i run the program it says the files are missing.


2023-05-08 08:27:27,847 c3e39c32fe7d proftpd[1]: mod_tls/2.9: compiled using OpenSSL version 'OpenSSL 1.1.1s  1 Nov 2022' headers, but linked to OpenSSL version 'OpenSSL 1.1.1q  5 Jul 2022' library
2023-05-08 08:27:27,849 c3e39c32fe7d proftpd[1]: mod_dso/0.5: unable to load 'mod_sql_odbc.c'; check to see if '/usr/lib/proftpd/mod_sql_odbc.la' exists
2023-05-08 08:27:27,849 c3e39c32fe7d proftpd[1]: fatal: LoadModule: error loading module 'mod_sql_odbc.c': No such file or directory on line 47 of '/etc/proftpd/modules.conf'
2023-05-08 08:27:27,849 c3e39c32fe7d proftpd[1]: warning: unable to include '/etc/proftpd/modules.conf': Operation not permitted
2023-05-08 08:27:27,849 c3e39c32fe7d proftpd[1]: mod_sftp/1.0.1: compiled using OpenSSL version 'OpenSSL 1.1.1s  1 Nov 2022' headers, but linked to OpenSSL version 'OpenSSL 1.1.1q  5 Jul 2022' library
2023-05-08 08:27:27,851 c3e39c32fe7d proftpd[1] c3e39c32fe7d: ProFTPD 1.3.7f (maint) (built Mon Dec 5 2022 07:07:37 UTC) standalone mode STARTUP 

What I Expected/Wanted

I'm trying to use odbc to use Sql server instead of mysql.

ProFTPD Version and Configuration


/ # proftpd -V
Compile-time Settings:
  Version: 1.3.7f (maint)
  Platform: LINUX [Linux 5.15.90.1-microsoft-standard-WSL2 x86_64]
  Built: Mon Dec 5 2022 07:07:37 UTC
  Built With:
    configure  '--build=x86_64-alpine-linux-musl' '--host=x86_64-alpine-linux-musl' '--prefix=/usr' '--sysconfdir=/etc/proftpd' '--localstatedir=/run/proftpd' '--libexecdir=/usr/lib/proftpd' '--disable-static' '--enable-sendfile' '--enable-facl' '--enable-dso' '--enable-autoshadow' '--enable-ctrls' '--enable-ipv6' '--enable-pcre' '--disable-strip' '--disable-wtmp' '--disable-auth-pam' '--enable-openssl' '--with-shared=mod_unique_id:mod_site_misc:mod_load:mod_ban:mod_quotatab:mod_sql:mod_sql_mysql:mod_sql_postgres:mod_sql_sqlite:mod_sql_odbc:mod_dynmasq:mod_quotatab_sql:mod_ldap:mod_quotatab_ldap:mod_ratio:mod_tls:mod_rewrite:mod_radius:mod_wrap2:mod_wrap2_file:mod_wrap2_sql:mod_quotatab_file:mod_quotatab_radius:mod_facl:mod_ctrls_admin:mod_copy:mod_deflate:mod_ifversion:mod_geoip:mod_exec:mod_sftp:mod_sftp_sql:mod_shaper:mod_sql_passwd:mod_ifsession:mod_auth_otp:mod_tls_redis:mod_wrap2_redis:mod_redis:mod_memcache:mod_tls_memcache:mod_readme:mod_snmp:mod_tls_shmcache' 'build_alias=x86_64-alpine-linux-musl' 'host_alias=x86_64-alpine-linux-musl' 'CC=gcc' 'CFLAGS=-Os -fomit-frame-pointer' 'CPPFLAGS=-Os -fomit-frame-pointer' 'CXX=g++' 'CXXFLAGS=-Os -fomit-frame-pointer'

  CFLAGS: -g2 -Os -fomit-frame-pointer -Wall -fno-omit-frame-pointer -fno-strict-aliasing -Werror=implicit-function-declaration
  LDFLAGS: -L$(top_srcdir)/lib -L$(top_builddir)/lib  -rdynamic  -L/usr/lib/ -L/usr/lib
  LIBS:  -lpcreposix -lpcre -lssl -lcrypto -lsodium -lsupp -lresolv -lresolv -lcrypt  -pthread

  Files:
    Configuration File:
      /etc/proftpd/proftpd.conf
    Pid File:
      /run/proftpd/proftpd.pid
    Scoreboard File:
      /run/proftpd/proftpd.scoreboard
    Header Directory:
      /usr/include/proftpd
    Shared Module Directory:
      /usr/lib/proftpd

  Info:
    + Max supported UID: 4294967295
    + Max supported GID: 4294967295

  Features:
    + Autoshadow support
    + Controls support
    - curses support
    - Developer support
    + DSO support
    + IPv6 support
    + Largefile support
    - Lastlog support
    - Memcache support
    - ncurses support
    - NLS support
    + OpenSSL support (OpenSSL 1.1.1s  1 Nov 2022)
    + PCRE support
    + POSIX ACL support
    - Redis support
    + Sendfile support
    + Shadow file support
    + Sodium support
    + Trace support
    + xattr support

  Tunable Options:
    PR_TUNABLE_BUFFER_SIZE = 1024
    PR_TUNABLE_DEFAULT_RCVBUFSZ = 8192
    PR_TUNABLE_DEFAULT_SNDBUFSZ = 8192
    PR_TUNABLE_ENV_MAX = 2048
    PR_TUNABLE_GLOBBING_MAX_MATCHES = 100000
    PR_TUNABLE_GLOBBING_MAX_RECURSION = 8
    PR_TUNABLE_HASH_TABLE_SIZE = 40
    PR_TUNABLE_LOGIN_MAX = 256
    PR_TUNABLE_NEW_POOL_SIZE = 512
    PR_TUNABLE_PATH_MAX = 4096
    PR_TUNABLE_SCOREBOARD_BUFFER_SIZE = 80
    PR_TUNABLE_SCOREBOARD_SCRUB_TIMER = 30
    PR_TUNABLE_SELECT_TIMEOUT = 30
    PR_TUNABLE_TIMEOUTIDENT = 10
    PR_TUNABLE_TIMEOUTIDLE = 600
    PR_TUNABLE_TIMEOUTLINGER = 10
    PR_TUNABLE_TIMEOUTLOGIN = 300
    PR_TUNABLE_TIMEOUTNOXFER = 300
    PR_TUNABLE_TIMEOUTSTALLED = 3600
    PR_TUNABLE_XFER_SCOREBOARD_UPDATES = 10
@Castaglia
Copy link
Member

The mod_sql_odbc module requires one of two libraries; see:

It looks like your ./configure command didn't supply the necessary flags for selecting the ODBC library to use.

@bernardo-borges
Copy link
Author

bernardo-borges commented May 17, 2023

I run this but it fails

/proftpd-files # ./configure \
     LD_LIBRARY_PATH=/usr/local/odbc/lib \
     LDFLAGS=-L/usr/local/odbc/lib \
     LIBS=-lodbc \
    --with-modules=mod_sql:mod_sql_odbc \
     --with-includes=/usr/local/odbc/include \
     --with-libraries=/usr/local/odbc/lib
checking build system type... x86_64-pc-linux-musl
checking host system type... x86_64-pc-linux-musl
checking target system type... x86_64-pc-linux-musl
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in /proftpd-files:
configure: error: C compiler cannot create executables
See config.log for more details

and on config.log

`/proftpd-files # tail -f config.log
#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
#define PR_BUILD_OPTS " 'LD_LIBRARY_PATH=/usr/local/odbc/lib' 'LDFLAGS=-L/usr/local/odbc/lib' 'LIBS=-lodbc' '--with-modules=mod_sql:mod_sql_odbc' '--with-includes=/usr/local/odbc/include' '--with-libraries=/usr/local/odbc/lib'"
#define PR_PLATFORM "LINUX"

configure: exit 77`

@Castaglia
Copy link
Member

You should just need to specify LIBS; the configure script and Makefile set the LDFLAGS as needed:

# ./configure \
     LIBS=-lodbc \
    --with-modules=mod_sql:mod_sql_odbc \
     --with-includes=/usr/local/odbc/include \
     --with-libraries=/usr/local/odbc/lib

When the configure script fails, you often need to look at the entire config.log generated; tail by default doesn't show enough of the relevant lines from the file for determining what the issues might be.

@bernardo-borges
Copy link
Author

You're right , It gives
gcc: error: unrecognized command-line option '-qversion'; did you mean '--version'? gcc: fatal error: no input files

@Castaglia
Copy link
Member

Interesting. What does gcc --version show? Usually the shell commands generated by Autoconf are able to deal with most C compilers properly...

@bernardo-borges
Copy link
Author

It returns

/ # gcc --version
gcc (Alpine 12.2.1_git20220924-r10) 12.2.1 20220924
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

@Castaglia
Copy link
Member

OK, thanks. Looks like you're using Alpine, then -- which specific version? With that info, I can attempt to reproduce this behavior locally.

@bernardo-borges
Copy link
Author

Yes , alpine:3.18.0

@Castaglia
Copy link
Member

Using this Dockerfile, I was able to get ProFTPD 1.3.7f to build and startup successfully:

FROM alpine:3.18.0

RUN apk update && apk add \
  bash \
  git \
  gdb \
  make \
  gcc \
  vim \
  build-base \
  mariadb-dev \
  openssh \
  openssl \
  openssl-dev \
  unixodbc-dev \
  zlib-dev

RUN ssh-keygen -A
EXPOSE 2121

CMD ["bash"]

And, in that container, to build the source code:

./configure LIBS=-lodbc --with-modules=mod_sql:mod_sql_odbc
make
make install

Interestingly, I saw the same error you did in the generated config.log file, before I properly installed the unixodbc-dev package. The gcc error seen is quite misleading, and didn't indicate the actual cause (the missing library) as one would hope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants