Bug 274654

Summary: Cannot rebuild Sendmail with OpenSSL 3.0 on FreeBSD 12.4-RELEASE
Product: Base System Reporter: Andrey Bushev <busheval>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me CC: busheval
Priority: ---    
Version: 12.4-RELEASE   
Hardware: amd64   
OS: Any   

Description Andrey Bushev 2023-10-22 17:47:09 UTC
Hi,
When I rebuilded ports after update perl5 from version 5.34 to 5.36 on my FreeBSD 12.4 server: 
# portmaster -f `pkg shlib -qR libperl.so.5.34`

Openssl-1.1.1w update to 3.0.11 too. After this I rebuilded ports:
# portmaster -f `pkg shlib -qR libcrypto.so.11`

All ports rebuilded fine, but sendmail not run now.
If I try rebuild sendmail:

# cd /usr/src/lib/libsm
# make clean && make obj && make depend && make
# cd /usr/src/lib/libsmutil
# make clean && make obj && make depend && make
# cd /usr/src/usr.sbin/sendmail
# make clean && make obj && make depend && make && make install

Error occured:
/usr/src/contrib/sendmail/src/tls.c:99:4: error: incomplete definition of type 'struct dh_st'
        dh->p = BN_bin2bn(dh512_p, sizeof(dh512_p), NULL);
        ~~^
/usr/local/include/openssl/types.h:134:16: note: forward declaration of 'struct dh_st'
typedef struct dh_st DH;
               ^
/usr/src/contrib/sendmail/src/tls.c:100:4: error: incomplete definition of type 'struct dh_st'
        dh->g = BN_bin2bn(dh512_g, sizeof(dh512_g), NULL);
        ~~^
/usr/local/include/openssl/types.h:134:16: note: forward declaration of 'struct dh_st'
typedef struct dh_st DH;
               ^
/usr/src/contrib/sendmail/src/tls.c:101:9: error: incomplete definition of type 'struct dh_st'
        if ((dh->p == NULL) || (dh->g == NULL))
             ~~^
/usr/local/include/openssl/types.h:134:16: note: forward declaration of 'struct dh_st'
typedef struct dh_st DH;
               ^
/usr/src/contrib/sendmail/src/tls.c:101:28: error: incomplete definition of type 'struct dh_st'
        if ((dh->p == NULL) || (dh->g == NULL))
....
27 warnings and 8 errors generated.
*** Error code 1

Stop.
make: stopped in /usr/src/usr.sbin/sendmail



# uname -a
FreeBSD mail 12.4-RELEASE-p6 FreeBSD 12.4-RELEASE-p6 GENERIC  amd64

# grep -v "^#" /etc/make.conf
DEFAULT_VERSIONS+= ssl=openssl bdb=18
OPTIONS_UNSET= X11
SENDMAIL_CFLAGS=-I/usr/local/include -DSASL=2
SENDMAIL_LDADD=/usr/local/lib/libsasl2.so
OPTIONS_SET= BDB6_PERMITTED


The problem is similar to the one described here:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=244937

But the solution didn't work for me.
Comment 1 Andrey Bushev 2023-10-25 09:43:04 UTC
After update to openssl-3.0.12, rust-1.73 and py39-cryptography-41.0.4 same problem.

# service sendmail start
Starting sendmail.
ld-elf.so.1: Shared object "libssl.so.11" not found, required by "sendmail"
/etc/rc.d/sendmail: WARNING: failed to start sendmail
Starting sendmail_msp_queue.
ld-elf.so.1: Shared object "libssl.so.11" not found, required by "sendmail"
/etc/rc.d/sendmail: WARNING: failed to start sendmail_msp_queue


# cd /usr/src/lib/libsm
# make clean && make obj && make depend && make
# cd /usr/src/lib/libsmutil
# make clean && make obj && make depend && make
# cd /usr/src/usr.sbin/sendmail
# make clean && make obj && make depend && make && make install

...

/usr/src/contrib/sendmail/src/tls.c:99:4: error: incomplete definition of type 'struct dh_st'
        dh->p = BN_bin2bn(dh512_p, sizeof(dh512_p), NULL);
        ~~^
/usr/local/include/openssl/types.h:134:16: note: forward declaration of 'struct dh_st'
typedef struct dh_st DH;
               ^
/usr/src/contrib/sendmail/src/tls.c:100:4: error: incomplete definition of type 'struct dh_st'
        dh->g = BN_bin2bn(dh512_g, sizeof(dh512_g), NULL);
        ~~^
/usr/local/include/openssl/types.h:134:16: note: forward declaration of 'struct dh_st'
typedef struct dh_st DH;
               ^
/usr/src/contrib/sendmail/src/tls.c:101:9: error: incomplete definition of type 'struct dh_st'
        if ((dh->p == NULL) || (dh->g == NULL))
             ~~^
/usr/local/include/openssl/types.h:134:16: note: forward declaration of 'struct dh_st'
typedef struct dh_st DH;
               ^
/usr/src/contrib/sendmail/src/tls.c:101:28: error: incomplete definition of type 'struct dh_st'
        if ((dh->p == NULL) || (dh->g == NULL))
                                ~~^
/usr/local/include/openssl/types.h:134:16: note: forward declaration of 'struct dh_st'
typedef struct dh_st DH;
               ^

...

27 warnings and 8 errors generated.
*** Error code 1

Stop.
make: stopped in /usr/src/usr.sbin/sendmail


# grep -v "^#" /etc/make.conf
DEFAULT_VERSIONS+= ssl=openssl bdb=18
OPTIONS_UNSET= X11
SENDMAIL_CFLAGS=-I/usr/local/include -DSASL=2
SENDMAIL_LDADD=/usr/local/lib/libsasl2.so
OPTIONS_SET= BDB6_PERMITTED
Comment 2 Andrey Bushev 2023-11-20 17:34:07 UTC
The problem was in the /etc/make.conf file in line:
SENDMAIL_CFLAGS=-I/usr/local/include -DSASL=2

After correcting to:
SENDMAIL_CFLAGS=-I/usr/local/include/sasl -DSASL

Sendmail be builded and work fine.