2018-09-05

MonetDB and SHA224_Update

在 openSUSE 升版到 LEAP 15.0 以後,我發現編譯 MonetDB Mar2018 SP1 成功,但是 MonetDB mapi library 在 load library 使用時載入失敗。一開始出現的是 SHA224_Update undefined,這是 openSSL 的 function,所以我嘗試在 configure 刪除 SHA224_Update 的部份。(更新:按照 MonetDB 的更新記錄,Mar2018 SP1 和 Aug2018 都會有這問題)

然後就出現更奇怪的結果,結果會發生 mnstr_settimeout undefined 的問題。但是這是 MonetDB stream library 的 function,所以有可能 MonetDB 在 mapi library 連結時的設定有問題。

目前還沒有解法。所以 tclmonetdb 會載入 mapi library 失敗,導致無法使用。

使用 nm 檢查 libmapi.so 的情況:
nm -D libmapi.so.10.1.0
                 U block_stream
0000000000213329 B __bss_start
                 U calloc
                 U close
                 U closedir
                 U close_stream
                 U connect
                 U __ctype_b_loc
                 w __cxa_finalize
0000000000213329 D _edata
0000000000213360 B _end
                 U __errno_location
                 U exit
                 U fclose
                 U fflush
                 U fgets
000000000000f5ac T _fini
                 U fopen
                 U __fprintf_chk
                 U fputc
                 U fputs
                 U free
                 U freeaddrinfo
                 U fwrite
                 U gai_strerror
                 U getaddrinfo
                 U gettimeofday
                 U getuid
                 w __gmon_start__
00000000000030e8 T _init
                 U isa_block_stream
                 w _ITM_deregisterTMCloneTable
                 w _ITM_registerTMCloneTable
                 w _Jv_RegisterClasses
                 U malloc
0000000000007f10 T mapi_bind
00000000000080a0 T mapi_bind_numeric
0000000000007fc0 T mapi_bind_var
000000000000a8a0 T mapi_cache_freeup
0000000000008ea0 T mapi_cache_limit
000000000000a7a0 T mapi_cache_shuffle
0000000000008110 T mapi_clear_bindings
00000000000083e0 T mapi_clear_params
00000000000074b0 T mapi_close_handle
000000000000a6a0 T mapi_connect
0000000000007780 T mapi_destroy
0000000000007740 T mapi_disconnect
0000000000006d30 T mapi_error
0000000000006d40 T mapi_error_str
000000000000bf00 T mapi_execute
0000000000006d60 T mapi_explain
0000000000006e20 T mapi_explain_query
0000000000006f00 T mapi_explain_result
000000000000c420 T mapi_fetch_all_rows
000000000000c610 T mapi_fetch_field
000000000000c740 T mapi_fetch_field_len
000000000000ab20 T mapi_fetch_line
000000000000a840 T mapi_fetch_reset
000000000000c390 T mapi_fetch_row
000000000000ad00 T mapi_finish
000000000000d1a0 T mapi_get_active
00000000000070f0 T mapi_get_autocommit
000000000000d090 T mapi_get_dbname
000000000000cc80 T mapi_get_digits
000000000000c870 T mapi_get_field_count
0000000000007060 T mapi_get_from
000000000000d0b0 T mapi_get_host
000000000000d0d0 T mapi_get_lang
000000000000c990 T mapi_get_last_id
000000000000cbe0 T mapi_get_len
000000000000cfd0 T mapi_get_maloptimizertime
000000000000d0f0 T mapi_get_mapi_version
000000000000d100 T mapi_get_monet_version
000000000000d150 T mapi_get_motd
000000000000c9f0 T mapi_get_name
000000000000cdc0 T mapi_get_query
000000000000cf70 T mapi_get_querytime
000000000000ce10 T mapi_get_querytype
000000000000c930 T mapi_get_row_count
000000000000cd20 T mapi_get_scale
000000000000d030 T mapi_get_sqloptimizertime
000000000000cb40 T mapi_get_table
000000000000ce90 T mapi_get_tableid
0000000000007020 T mapi_get_to
00000000000070a0 T mapi_get_trace
000000000000ca90 T mapi_get_type
000000000000d0e0 T mapi_get_uri
000000000000d0c0 T mapi_get_user
000000000000d190 T mapi_is_connected
0000000000007140 T mapi_log
0000000000007d70 T mapi_mapi
00000000000079d0 T mapi_mapiuri
00000000000072e0 T mapi_more_results
00000000000072d0 T mapi_needmore
00000000000073c0 T mapi_new_handle
0000000000007230 T mapi_next_result
0000000000006d50 T mapi_noexplain
0000000000008360 T mapi_param
0000000000008370 T mapi_param_numeric
0000000000008280 T mapi_param_string
0000000000008180 T mapi_param_type
000000000000c010 T mapi_ping
0000000000008570 T mapi_prepare
00000000000084e0 T mapi_prepare_handle
000000000000bf60 T mapi_query
0000000000008d90 T mapi_query_done
000000000000c1d0 T mapi_query_handle
0000000000008b80 T mapi_query_part
0000000000008a90 T mapi_query_prep
000000000000ad70 T mapi_quote
0000000000008a80 T mapi_read_response
0000000000009010 T mapi_reconnect
00000000000086b0 T mapi_release_id
000000000000a6d0 T mapi_resolve
00000000000071e0 T mapi_result_error
0000000000007200 T mapi_result_errorcode
000000000000cf10 T mapi_rows_affected
000000000000a950 T mapi_seek_row
000000000000c130 T mapi_send
00000000000085e0 T mapi_setAutocommit
0000000000008650 T mapi_set_size_header
000000000000c360 T mapi_split_line
000000000000c290 T mapi_store_field
000000000000c090 T mapi_stream_query
0000000000008450 T mapi_timeout
0000000000008750 T mapi_trace
000000000000ad40 T mapi_unquote
0000000000008770 T mapi_virtual_result
000000000000ee20 T mcrypt_BackendSum
000000000000dd30 T mcrypt_getHashAlgorithms
000000000000ee30 T mcrypt_hashPassword
000000000000dd40 T mcrypt_MD5Sum
000000000000ec70 T mcrypt_RIPEMD160Sum
000000000000deb0 T mcrypt_SHA1Sum
000000000000e060 T mcrypt_SHA224Sum
000000000000e280 T mcrypt_SHA256Sum
000000000000e4e0 T mcrypt_SHA384Sum
000000000000e830 T mcrypt_SHA512Sum
                 U MD5_Final
                 U MD5_Init
                 U MD5_Update
                 U memmove
                 U memset
                 U mnstr_destroy
                 U mnstr_errnr
                 U mnstr_error
                 U mnstr_flush
                 U mnstr_init
                 U mnstr_printf
                 U mnstr_read
                 U mnstr_read_block
                 U mnstr_set_byteorder
                 U mnstr_settimeout
                 U mnstr_write
000000000000dbd0 T mo_add_option
000000000000d1b0 T mo_builtin_settings
000000000000d730 T mo_find_option
000000000000dcb0 T mo_free_options
000000000000d5f0 T mo_print_options
000000000000db30 T mo_system_config
                 U opendir
                 U open_wastream
                 U __printf_chk
                 U puts
                 U readdir
                 U realloc
                 U RIPEMD160_Final
                 U RIPEMD160_Init
                 U RIPEMD160_Update
                 U sendmsg
                 U SHA1_Final
                 U SHA1_Init
                 U SHA1_Update
                 U SHA224_Final
                 U SHA224_Init
                 U SHA224_Update
                 U SHA256_Final
                 U SHA256_Init
                 U SHA256_Update
                 U SHA384_Final
                 U SHA384_Init
                 U SHA384_Update
                 U SHA512_Final
                 U SHA512_Init
                 U SHA512_Update
                 U __snprintf_chk
                 U socket
                 U socket_rastream
                 U socket_wastream
                 U __sprintf_chk
                 U sscanf
                 U __stack_chk_fail
                 U stderr
                 U stdout
                 U strcat
                 U strchr
                 U strcmp
                 U strcpy
                 U __strdup
                 U strerror
                 U strlen
                 U strncmp
                 U strncpy
                 U strrchr
                 U strstr
                 U strtod
                 U strtof
                 U strtol
                 U strtoll
                 U strtoul
                 U strtoull
                 U __xstat


修正方法如下:
sed -i 's/WIN32?//g' clients/mapilib/Makefile.ag
sed -i 's/@WIN32_TRUE@//g' clients/mapilib/Makefile.in
sed -i 's/WIN32?//g' common/stream/Makefile.ag
sed -i 's/@WIN32_TRUE@//g' common/stream/Makefile.in
然後需要重新編譯一次就可以產生正確的檔案。


這是因為 MonetDB team 想要避免多次連結的解法而產生的問題。MonetDB team 沒有考慮到,如果有使用者使用 Load Library 的方式載入 MAPI library 使用,就會產生 undefined function 的問題而無法正確載入。

沒有留言: