pam-MySQL icon indicating copy to clipboard operation
pam-MySQL copied to clipboard

pam-MySQL 1.0.0 built error for MySQL 8

Open wahjong opened this issue 2 years ago • 8 comments

I have new to meson and ninja build tool, there is errors complaining missing MYSQL type, MySQL8 (mysql-boost-8.0.15.tar.gz) built and MYSQL have been defined in /usr/local/mysql/include/mysql.h

Is that fine to comment libmariadb lines in meson.build?

#foreach dep: ['libmariadb']

deps += dependency(dep)

#endforeach

git clone https://github.com/NigelCunningham/pam-MySQL export LIBRARY_PATH=/usr/local/mysql/include meson ../pam-MySQL-build cd ../pam-MySQL /usr/local/bin/ninja

[1/92] Compiling C object libpam_mysql.so.p/src_session.c.o FAILED: libpam_mysql.so.p/src_session.c.o cc -Ilibpam_mysql.so.p -I. -I../pam-MySQL -I/usr/local/mysql/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c11 -g -DHAVE_CONFIG_H -fPIC -MD -MQ libpam_mysql.so.p/src_session.c.o -MF libpam_mysql.so.p/src_session.c.o.d -o libpam_mysql.so.p/src_session.c.o -c ../pam-MySQL/src/session.c In file included from ../pam-MySQL/src/session.c:6:0: ../pam-MySQL/src/context.h:6:3: error: unknown type name MYSQL MYSQL *mysql_hdl;

wahjong avatar Dec 20 '21 00:12 wahjong

Any hints for trouble shooting compiling pam-mysql failure?

uname -a Linux aarch64 GNU/Linux

Built MySQL8 from source mysql-boost-8.0.15.tar.gz mysql_config --include -I/usr/local/mysql/include mysql_config --libs -L/usr/local/mysql/lib -lmysqlclient -lpthread -lm -lrt -lssl -lcrypto -ldl

edit meson.build belows for trial testing

['HAVE_MYSQL_H', 'mysql.h']

foreach h : check_headers if cc.has_header(h.get(1), args: ['-I/usr/local/mysql/include']) conf_data.set(h.get(0), 1) endif endforeach

#foreach dep: ['libmariadb']

deps += dependency(dep)

#endforeach

meson ../pam-MySQL-build cd ../pam-MySQL-build /usr/local/bin/ninja

[9/93] Compiling C object libpam_mysql.so.p/src_mysql.c.o ../pam-MySQL-1.0.0/src/mysql.c: In function ‘pam_mysql_open_db’: ../pam-MySQL-1.0.0/src/mysql.c:113:59: warning: passing argument 3 of ‘mysql_options’ makes pointer from integer without a cast [-Wint-conversion] if (mysql_options(ctx->mysql_hdl, MYSQL_OPT_SSL_MODE, ssl_mode) != 0) { ^~~~~~~~ In file included from ../pam-MySQL-1.0.0/src/os_dep.h:74:0, from ../pam-MySQL-1.0.0/src/mysql.c:1: /usr/local/mysql/include/mysql.h:505:13: note: expected ‘const void *’ but argument is of type ‘int’ int STDCALL mysql_options(MYSQL *mysql, enum mysql_option option, ^~~~~~~~~~~~~ [33/93] Compiling C object test_config_file.p/mocks_mysql.c.o FAILED: test_config_file.p/mocks_mysql.c.o cc -Itest_config_file.p -I. -I../pam-MySQL-1.0.0 -I/usr/local/mysql/include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c11 -g -DHAVE_CONFIG_H -DTEST -MD -MQ test_config_file.p/mocks_mysql.c.o -MF test_config_file.p/mocks_mysql.c.o.d -o test_config_file.p/mocks_mysql.c.o -c ../pam-MySQL-1.0.0/mocks/mysql.c ../pam-MySQL-1.0.0/mocks/mysql.c:32:31: error: conflicting types for ‘mysql_store_result’ struct st_mysql_res * STDCALL mysql_store_result(MYSQL *mysql) ^~~~~~~~~~~~~~~~~~ In file included from ../pam-MySQL-1.0.0/src/os_dep.h:74:0, from ../pam-MySQL-1.0.0/mocks/mysql.c:1: /usr/local/mysql/include/mysql.h:464:20: note: previous declaration of ‘mysql_store_result’ was here MYSQL_RES *STDCALL mysql_store_result(MYSQL *mysql); ^~~~~~~~~~~~~~~~~~ ../pam-MySQL-1.0.0/mocks/mysql.c: In function ‘reset_mysql’: ../pam-MySQL-1.0.0/mocks/mysql.c:101:34: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types] mock_mysql_store_result_result = (MYSQL_RES *) 1; ^ [34/93] Linking target libpam_mysql.so FAILED: libpam_mysql.so cc -o libpam_mysql.so libpam_mysql.so.p/src_pam_mysql.c.o libpam_mysql.so.p/src_session.c.o libpam_mysql.so.p/src_args.c.o libpam_mysql.so.p/src_context.c.o libpam_mysql.so.p/src_logging.c.o libpam_mysql.so.p/src_alloc.c.o libpam_mysql.so.p/src_mysql.c.o libpam_mysql.so.p/src_strings.c.o libpam_mysql.so.p/src_configuration.c.o libpam_mysql.so.p/src_stream.c.o libpam_mysql.so.p/src_authenticate.c.o libpam_mysql.so.p/src_converse.c.o libpam_mysql.so.p/src_crypto.c.o libpam_mysql.so.p/src_crypto-sha1.c.o libpam_mysql.so.p/src_crypto-md5.c.o libpam_mysql.so.p/src_acct_mgmt.c.o libpam_mysql.so.p/src_chauthtok.c.o libpam_mysql.so.p/src_password_plain.c.o libpam_mysql.so.p/src_password_323.c.o libpam_mysql.so.p/src_password_crypt.c.o libpam_mysql.so.p/src_password_md5.c.o libpam_mysql.so.p/src_password_sha1.c.o libpam_mysql.so.p/src_password_drupal7.c.o libpam_mysql.so.p/src_password_joomla15.c.o libpam_mysql.so.p/src_password_ssha.c.o libpam_mysql.so.p/src_password_sha512.c.o libpam_mysql.so.p/src_password_sha256.c.o libpam_mysql.so.p/src_password.c.o libpam_mysql.so.p/src_md5.c.o libpam_mysql.so.p/src_pam_calls.c.o -Wl,--as-needed -Wl,--no-undefined -shared -fPIC -Wl,--start-group -Wl,-soname,libpam_mysql.so -lpam /usr/lib64/libssl.so /usr/lib64/libcrypto.so -lcrypt -Wl,--end-group libpam_mysql.so.p/src_logging.c.o: In function pam_mysql_sql_log': /pam-MySQL/src/logging.c:317: undefined reference to mysql_query' /pam-MySQL/src/logging.c:326: undefined reference to mysql_error' libpam_mysql.so.p/src_mysql.c.o: In function pam_mysql_open_db': /pam-MySQL/src/mysql.c:71: undefined reference to mysql_init' /pam-MySQL/src/mysql.c:78: undefined reference to mysql_ssl_set' /pam-MySQL/src/mysql.c:113: undefined reference to mysql_options' /pam-MySQL/src/mysql.c:120: undefined reference to mysql_real_connect' /pam-MySQL/src/mysql.c:127: undefined reference to mysql_select_db' /pam-MySQL/src/mysql.c:136: undefined reference to mysql_error' libpam_mysql.so.p/src_mysql.c.o: In function pam_mysql_close_db': /pam-MySQL/src/mysql.c:166: undefined reference to mysql_close' /pam-MySQL/src/mysql.c:168: undefined reference to mysql_server_end' libpam_mysql.so.p/src_strings.c.o: In function pam_mysql_quick_escape': /pam-MySQL/src/strings.c:172: undefined reference to mysql_escape_string' libpam_mysql.so.p/src_authenticate.c.o: In function pam_mysql_check_passwd': /pam-MySQL/src/authenticate.c:67: undefined reference to mysql_query' /pam-MySQL/src/authenticate.c:72: undefined reference to mysql_store_result' /pam-MySQL/src/authenticate.c:78: undefined reference to mysql_num_rows' /pam-MySQL/src/authenticate.c:94: undefined reference to mysql_fetch_row' /pam-MySQL/src/authenticate.c:134: undefined reference to mysql_error' /pam-MySQL/src/authenticate.c:142: undefined reference to mysql_free_result' /pam-MySQL/src/authenticate.c:145: undefined reference to mysql_store_result' /pam-MySQL/src/authenticate.c:147: undefined reference to mysql_free_result' /pam-MySQL/src/authenticate.c:144: undefined reference to mysql_next_result' libpam_mysql.so.p/src_acct_mgmt.c.o: In function pam_mysql_query_user_stat': /pam-MySQL/src/acct_mgmt.c:52: undefined reference to mysql_query' /pam-MySQL/src/acct_mgmt.c:57: undefined reference to mysql_store_result' /pam-MySQL/src/acct_mgmt.c:62: undefined reference to mysql_num_rows' /pam-MySQL/src/acct_mgmt.c:77: undefined reference to mysql_fetch_row' /pam-MySQL/src/acct_mgmt.c:94: undefined reference to mysql_error' /pam-MySQL/src/acct_mgmt.c:98: undefined reference to mysql_free_result' libpam_mysql.so.p/src_chauthtok.c.o: In function pam_mysql_update_passwd': /pam-MySQL/src/chauthtok.c:68: undefined reference to mysql_query' /pam-MySQL/src/chauthtok.c:74: undefined reference to mysql_error' libpam_mysql.so.p/src_chauthtok.c.o: In function pam_mysql_query_user_stat': /pam-MySQL/src/chauthtok.c:169: undefined reference to mysql_query' /pam-MySQL/src/chauthtok.c:174: undefined reference to mysql_store_result' /pam-MySQL/src/chauthtok.c:179: undefined reference to mysql_num_rows' /pam-MySQL/src/chauthtok.c:194: undefined reference to mysql_fetch_row' /pam-MySQL/src/chauthtok.c:211: undefined reference to mysql_error' /pam-MySQL/src/chauthtok.c:215: undefined reference to mysql_free_result' collect2: error: ld returned 1 exit status [35/93] Compiling C object test_config_file.p/mocks_context.c.o ninja: build stopped: subcommand failed.

Looking forward to any suggestion

Many thanks Wah Jong

wahjong avatar Dec 22 '21 03:12 wahjong

Any updates on this ? @wahjong did you solve this issue? In what way? Thank you

chas0amx avatar Apr 18 '22 08:04 chas0amx

@NigelCunningham is there any precompiled libpam_mysql.so with 1.0.0-beta1 version for ubuntu? It is not easy to compile with current instructions. Thank you.

chas0amx avatar Apr 18 '22 09:04 chas0amx

Sorry for the slow reply - I seem to not be getting Github emails.

Building should just be a matter of following the instructions in the README. I'll see what I can do regarding the mariadb issue above - I'm now running mySql again so I should see the error too (though I haven't so far tonight).

NigelCunningham avatar May 31 '22 12:05 NigelCunningham

Also, @wahjong, would you let me know which version of Ubuntu you were running when you got these issues? Are you still seeing them? Thanks!

NigelCunningham avatar May 31 '22 12:05 NigelCunningham

Dear Nigel

Nice to hear from you, below for your information

aarch64 GNU/Linux uname (GNU coreutils) 8.22

NAME="Amazon Linux" VERSION="2" ID="amzn" ID_LIKE="centos rhel fedora" VERSION_ID="2" PRETTY_NAME="Amazon Linux 2"

Virtualization: amazon Operating System: Amazon Linux 2 Kernel: Linux 5.10.68-62.173.amzn2.aarch64 Architecture: arm64

MySQL-8.0 https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-boost-8.0.15.tar.gz

It would be great if that is possible to install with configure make & install for pam-mysql coming version.

Best wishes Wah Jong

On Tue, May 31, 2022 at 8:29 PM Nigel Cunningham @.***> wrote:

Also, @wahjong https://github.com/wahjong, would you let me know which version of Ubuntu you were running when you got these issues? Are you still seeing them? Thanks!

— Reply to this email directly, view it on GitHub https://github.com/NigelCunningham/pam-MySQL/issues/84#issuecomment-1142070767, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC6ZZZFROTOVD6VWFWIKN6LVMYA3FANCNFSM5KMQDYAQ . You are receiving this because you were mentioned.Message ID: @.***>

wahjong avatar Jun 13 '22 13:06 wahjong

Also, @wahjong, would you let me know which version of Ubuntu you were running when you got these issues? Are you still seeing them? Thanks!

Hi Nigel

It is long time to catch up on installing pam-MySQL, indeed I have been hoping to have pam-MySQL installed on AWS EC2 instance CentOS-7, is it possible to compile pam-MySQL 1.0.0 from source without Meson 0.56 required.

Best wishes

Wah Jong

wahjong avatar Nov 16 '22 02:11 wahjong

Hi Wah Jong.

I switched away from autotools because they're so poorly documented and hard to understand. Sorry but you do need Meson. From a quick search, I think https://cbs.centos.org/koji/buildinfo?buildID=36250 should help.

Regards,

Nigel

NigelCunningham avatar Nov 25 '22 09:11 NigelCunningham