lyatanski created an issue (kamailio/kamailio#4429)

<!--
Kamailio Project uses GitHub Issues only for bugs in the code or feature 
requests. Please use this template only for bug reports.

If you have questions about using Kamailio or related to its configuration 
file, ask on sr-users mailing list:

  * 
https://lists.kamailio.org/mailman3/postorius/lists/sr-users.lists.kamailio.org/

If you have questions about developing extensions to Kamailio or its existing C 
code, ask on sr-dev mailing list:

  * 
https://lists.kamailio.org/mailman3/postorius/lists/sr-dev.lists.kamailio.org/

Please try to fill this template as much as possible for any issue. It helps 
the developers to troubleshoot the issue.

Note that an issue report may be closed automatically after about 2 months
if there is no interest from developers or community users on pursuing it, being
considered expired. In such case, it can be reopened by writing a comment that 
includes
the token `/notexpired`. About two weeks before considered expired, the issue is
marked with the label `stale`, trying to notify the submitter and everyone else
that might be interested in it. To remove the label `stale`, write a comment 
that
includes the token `/notstale`. Also, any comment postpone the `expire` 
timeline,
being considered that there is interest in pursuing the issue.

If there is no content to be filled in a section, the entire section can be 
removed.

You can delete the comments from the template sections when filling.

You can delete next line and everything above before submitting (it is a 
comment).
-->

### Description
db_redis module SSL_set_fd: symbol not found with CMake build.


### Troubleshooting
run kamailio with:
`loadmodule "db_redis"`

#### Reproduction

<!--
If the issue can be reproduced, describe how it can be done.
-->

#### Debugging Data

<!--
If you got a core dump, use gdb to extract troubleshooting data - full 
backtrace,
local variables and the list of the code at the issue location.

  gdb /path/to/kamailio /path/to/corefile
  bt full
  info locals
  list

If you are familiar with gdb, feel free to attach more of what you consider to
be relevant.
-->
Link order issue. The OpenSSL libraries are linked before the libhiredis_ssl 
library. The symbols are not looked up:
```
/usr/bin/cc -fPIC -O3 -DNDEBUG  -m64 
-Wl,--dependency-file=src/modules/db_redis/CMakeFiles/db_redis.dir/link.d 
-shared -Wl,-soname,db_redis.so -o src/modules/db_redis/db_redis.so 
src/modules/db_redis/CMakeFiles/db_redis.dir/db_redis_mod.c.o 
src/modules/db_redis/CMakeFiles/db_redis.dir/redis_connection.c.o 
src/modules/db_redis/CMakeFiles/db_redis.dir/redis_dbase.c.o s
rc/modules/db_redis/CMakeFiles/db_redis.dir/redis_table.c.o  
-Wl,-rpath,:::::::::::::::::::::::  /usr/lib/libssl.so  /usr/lib/libcrypto.so  
/usr/lib/libhiredis_ssl.a  /usr/lib/libhiredis.so 
 -ldl  -lresolv
```

#### Log Messages

<!--
Check the syslog file and if there are relevant log messages printed by 
Kamailio, add them next, or attach to issue, or provide a link to download them 
(e.g., to a pastebin site).
-->

```
 0(1224) DEBUG: <core> [core/cfg.y:2240]: yyparse(): loading module db_redis
 0(1224) DEBUG: <core> [core/sr_module.c:537]: ksr_locate_module(): found 
module to load </usr/local/lib/kamailio/modules/db_redis.so>
 0(1224) DEBUG: <core> [core/sr_module.c:592]: ksr_load_module(): trying to 
load </usr/local/lib/kamailio/modules/db_redis.so>
 0(1224) ERROR: <core> [core/sr_module.c:613]: ksr_load_module(): could not 
open module </usr/local/lib/kamailio/modules/db_redis.so>: Error relocating 
/usr/local/lib/kamailio/modules/db_redis.so: SSL_set_fd: symbol not found
 0(1224) CRITICAL: <core> [core/cfg.y:4091]: yyerror_at(): parse error in 
config file /etc/cscf/interrogating.cfg, line 24, column 12-21: failed to load 
module
```

#### SIP Traffic
N/A, the issue manifests during process initialization


### Possible Solutions
In `src/modules/db_redis/CMakeLists.txt` instead of
`
target_link_libraries(${module_name} PRIVATE OpenSSL::SSL OpenSSL::Crypto)
`
to enhance the pkg-config target linkage with OpenSSL
`
target_link_libraries(PkgConfig::hiredis_ssl INTERFACE OpenSSL::SSL 
OpenSSL::Crypto)
`

### Additional Information

  * **Kamailio Version** - output of `kamailio -v`

```
version: kamailio 6.1.0-dev1 (x86_64/Linux) 9bba10-dirty
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, 
USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, MEM_JOIN_FREE, Q_MALLOC, 
F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, DBG_QM_MALLOC, DBG_F_MALLOC, 
DBG_TLSF_MALLOC, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, 
USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLOCKLIST, HAVE_RESOLV_RES, 
TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_SEND_BUFFER_SIZE 
262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: 9bba10 dirty
compiled on 07:55:24 Oct 11 2025 with gcc 14.2.0
```

* **Operating System**:

<!--
Details about the operating system, the type: Linux (e.g.,: Debian 8.4, Ubuntu 
16.04, CentOS 7.1, ...), MacOS, xBSD, Solaris, ...;
Kernel details (output of `lsb_release -a` and `uname -a`)
-->

```
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.22.2
PRETTY_NAME="Alpine Linux v3.22"
HOME_URL="https://alpinelinux.org/";
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues";
```


-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/4429
You are receiving this because you are subscribed to this thread.

Message ID: <kamailio/kamailio/issues/[email protected]>
_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to