freeswitch icon indicating copy to clipboard operation
freeswitch copied to clipboard

Compilation error from last git

Open ROBERT-MCDOWELL opened this issue 2 years ago • 5 comments

make[1]: Entering directory '/home/src/freeswitch/libs/apr'
make[2]: Entering directory '/home/src/freeswitch/libs/apr'
/bin/sh /home/src/freeswitch/libs/apr/libtool --silent --mode=compile gcc   -g -O2  -DHAVE_CONFIG_H -D_REENTRANT -D_GNU_SOURCE   -I./include -I/home/src/freeswitch/libs/apr/include/arch/unix -I./include/arch/unix -I/home/src/freeswitch/libs/apr/include  -o threadproc/unix/signals.lo -c threadproc/unix/signals.c && touch threadproc/unix/signals.lo
In file included from ./include/fspr_pools.h:39,
                 from /home/src/freeswitch/libs/apr/include/arch/unix/../fspr_private_common.h:24,
                 from /home/src/freeswitch/libs/apr/include/arch/unix/fspr_private.h:881,
                 from /home/src/freeswitch/libs/apr/include/arch/unix/fspr_arch_threadproc.h:18,
                 from threadproc/unix/signals.c:18:
./include/fspr_general.h:33: warning: "NSIG" redefined
   33 | #define NSIG __DARWIN_NSIG
      |
In file included from /usr/include/sys/wait.h:36,
                 from ./include/fspr.h:131,
                 from /home/src/freeswitch/libs/apr/include/arch/unix/fspr_arch_threadproc.h:17:
/usr/include/signal.h:184: note: this is the location of the previous definition
  184 | # define NSIG   _NSIG
      |
./include/fspr_general.h:33:14: error: '__DARWIN_NSIG' undeclared here (not in a function)
   33 | #define NSIG __DARWIN_NSIG
      |              ^~~~~~~~~~~~~
threadproc/unix/signals.c:127:20: note: in expansion of macro 'NSIG'
  127 | #define APR_NUMSIG NSIG
      |                    ^~~~
threadproc/unix/signals.c:136:39: note: in expansion of macro 'APR_NUMSIG'
  136 | static const char *signal_description[APR_NUMSIG];
      |                                       ^~~~~~~~~~
make[2]: *** [/home/src/freeswitch/libs/apr/build/apr_rules.mk:201: threadproc/unix/signals.lo] Error 1
make[2]: Leaving directory '/home/src/freeswitch/libs/apr'
make[1]: *** [/home/src/freeswitch/libs/apr/build/apr_rules.mk:113: all-recursive] Error 1
make[1]: Leaving directory '/home/src/freeswitch/libs/apr'
make: *** [Makefile:4511: libs/apr/libapr-1.la] Error 2

seems to be an APR issue Fedora 36 64bits GCC 12 APR 1.7.0 APR-UTIL 1.6.1

ROBERT-MCDOWELL avatar Sep 11 '22 12:09 ROBERT-MCDOWELL

__DARWIN_NSIG

I've just removed this paragraph from the source code.

kiufta avatar Sep 12 '22 20:09 kiufta

@ROBERT-MCDOWELL try

#if !defined(NSIG) && !defined(_ANSI_SOURCE) && defined(_DARWIN_C_SOURCE)
#define NSIG __DARWIN_NSIG
#endif

instead of removing

andywolk avatar Sep 13 '22 18:09 andywolk

@andywolk works, but now more errors:

file_io/unix/dir.c: In function 'fspr_dir_read':
file_io/unix/dir.c:144:5: warning: 'readdir_r' is deprecated [-Wdeprecated-declarations]
  144 |     ret = readdir_r(thedir->dirstruct, thedir->entry, &retent);
      |     ^~~
In file included from /home/src/freeswitch/libs/apr/include/arch/unix/fspr_arch_file_io.h:                                                                                                                                                   50,
                 from file_io/unix/dir.c:17:
/usr/include/dirent.h:183:12: note: declared here
  183 | extern int readdir_r (DIR *__restrict __dirp,

.....

locks/unix/proc_mutex.c: In function 'proc_mutex_proc_pthread_create':
locks/unix/proc_mutex.c:329:5: warning: 'pthread_mutexattr_setrobust_np' is deprecated: pt                                                                                                                                                   hread_mutexattr_setrobust_np is deprecated, use pthread_mutexattr_setrobust [-Wdeprecated-                                                                                                                                                   declarations]
  329 |     if ((rv = pthread_mutexattr_setrobust_np(&mattr,
      |     ^~
In file included from /usr/include/features.h:490,
                 from /usr/include/sys/types.h:25,
                 from ./include/fspr.h:113,
                 from locks/unix/proc_mutex.c:17:
/usr/include/pthread.h:951:12: note: declared here
  951 | extern int __REDIRECT_NTH (pthread_mutexattr_setrobust_np,

......

crypto/hash/hmac_ossl.c: In function 'srtp_hmac_alloc':
crypto/hash/hmac_ossl.c:106:5: warning: 'HMAC_CTX_new' is deprecated: Since OpenSSL 3.0 [-                                                                                                                                                   Wdeprecated-declarations]
  106 |     (*a)->state = HMAC_CTX_new();
      |     ^
In file included from crypto/hash/hmac_ossl.c:54:
/usr/include/openssl/hmac.h:33:33: note: declared here
   33 | OSSL_DEPRECATEDIN_3_0 HMAC_CTX *HMAC_CTX_new(void);
      |                                 ^~~~~~~~~~~~
crypto/hash/hmac_ossl.c: In function 'srtp_hmac_dealloc':
crypto/hash/hmac_ossl.c:136:5: warning: 'HMAC_CTX_free' is deprecated: Since OpenSSL 3.0 [                                                                                                                                                   -Wdeprecated-declarations]
  136 |     HMAC_CTX_free(hmac_ctx);
      |     ^~~~~~~~~~~~~
/usr/include/openssl/hmac.h:35:28: note: declared here
   35 | OSSL_DEPRECATEDIN_3_0 void HMAC_CTX_free(HMAC_CTX *ctx);
      |                            ^~~~~~~~~~~~~
crypto/hash/hmac_ossl.c: In function 'srtp_hmac_start':
crypto/hash/hmac_ossl.c:152:5: warning: 'HMAC_Init_ex' is deprecated: Since OpenSSL 3.0 [-                                                                                                                                                   Wdeprecated-declarations]
  152 |     if (HMAC_Init_ex(state, NULL, 0, NULL, NULL) == 0)
      |     ^~
/usr/include/openssl/hmac.h:43:27: note: declared here
   43 | OSSL_DEPRECATEDIN_3_0 int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
      |                           ^~~~~~~~~~~~
crypto/hash/hmac_ossl.c: In function 'srtp_hmac_init':
crypto/hash/hmac_ossl.c:164:5: warning: 'HMAC_Init_ex' is deprecated: Since OpenSSL 3.0 [-                                                                                                                                                   Wdeprecated-declarations]
  164 |     if (HMAC_Init_ex(state, key, key_len, EVP_sha1(), NULL) == 0)
      |     ^~
/usr/include/openssl/hmac.h:43:27: note: declared here
   43 | OSSL_DEPRECATEDIN_3_0 int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
      |                           ^~~~~~~~~~~~
crypto/hash/hmac_ossl.c: In function 'srtp_hmac_update':
crypto/hash/hmac_ossl.c:179:5: warning: 'HMAC_Update' is deprecated: Since OpenSSL 3.0 [-W                                                                                                                                                   deprecated-declarations]
  179 |     if (HMAC_Update(state, message, msg_octets) == 0)
      |     ^~
/usr/include/openssl/hmac.h:45:27: note: declared here
   45 | OSSL_DEPRECATEDIN_3_0 int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data,
      |                           ^~~~~~~~~~~
crypto/hash/hmac_ossl.c: In function 'srtp_hmac_compute':
crypto/hash/hmac_ossl.c:205:5: warning: 'HMAC_Update' is deprecated: Since OpenSSL 3.0 [-W                                                                                                                                                   deprecated-declarations]
  205 |     if (HMAC_Update(state, message, msg_octets) == 0)
      |     ^~
/usr/include/openssl/hmac.h:45:27: note: declared here
   45 | OSSL_DEPRECATEDIN_3_0 int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data,
      |                           ^~~~~~~~~~~
crypto/hash/hmac_ossl.c:208:5: warning: 'HMAC_Final' is deprecated: Since OpenSSL 3.0 [-Wd                                                                                                                                                   eprecated-declarations]
  208 |     if (HMAC_Final(state, hash_value, &len) == 0)
      |     ^~
/usr/include/openssl/hmac.h:47:27: note: declared here
   47 | OSSL_DEPRECATEDIN_3_0 int HMAC_Final(HMAC_CTX *ctx, unsigned char *md,

........

src/switch_apr.c: In function 'switch_md5':
src/switch_apr.c:1179:9: error: 'MD5_Init' is deprecated: Since OpenSSL 3.0 [-Werror=depre                                                                                                                                                   cated-declarations]
 1179 |         MD5_Init(&md5_context);
      |         ^~~~~~~~
In file included from src/switch_apr.c:77:
/usr/include/openssl/md5.h:49:27: note: declared here
   49 | OSSL_DEPRECATEDIN_3_0 int MD5_Init(MD5_CTX *c);
      |                           ^~~~~~~~
src/switch_apr.c:1180:9: error: 'MD5_Update' is deprecated: Since OpenSSL 3.0 [-Werror=dep                                                                                                                                                   recated-declarations]
 1180 |         MD5_Update(&md5_context, input, inputLen);
      |         ^~~~~~~~~~
/usr/include/openssl/md5.h:50:27: note: declared here
   50 | OSSL_DEPRECATEDIN_3_0 int MD5_Update(MD5_CTX *c, const void *data, size_t len);
      |                           ^~~~~~~~~~
src/switch_apr.c:1181:9: error: 'MD5_Final' is deprecated: Since OpenSSL 3.0 [-Werror=depr                                                                                                                                                   ecated-declarations]
 1181 |         MD5_Final(digest, &md5_context);
      |         ^~~~~~~~~
/usr/include/openssl/md5.h:51:27: note: declared here
   51 | OSSL_DEPRECATEDIN_3_0 int MD5_Final(unsigned char *md, MD5_CTX *c);
      |                           ^~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:2322: src/libfreeswitch_la-switch_apr.lo] Error 1
make[1]: Leaving directory '/home/src/freeswitch'
make: *** [Makefile:1449: all] Error 2

ROBERT-MCDOWELL avatar Sep 13 '22 22:09 ROBERT-MCDOWELL

Try using openssl 2.x

andywolk avatar Sep 13 '22 23:09 andywolk

removed from the OS (fedora 36) only openssl 3.x available

ROBERT-MCDOWELL avatar Sep 14 '22 00:09 ROBERT-MCDOWELL

It's the same in Ubuntu 22.04 LTS (Jammy Jellyfish). Using the changes in #1767 helped me to successfully build FreeSWITCH with OpenSSL 3.0. I also noticed that some modules are also not building with OpenSSL 3.0 so I excluded them in debian/bootstrap.sh before building.

ThomasLobker avatar Oct 23 '22 21:10 ThomasLobker

Thanks Thomas

ROBERT-MCDOWELL avatar Oct 23 '22 21:10 ROBERT-MCDOWELL

Seems like patch

https://github.com/signalwire/freeswitch/pull/1767/commits/c3df236be8eadc86a0bbbe49a9b84946726005ad

Is not match code on line 1189 official tar ball 1.10.8

I tried APR version 1.5 and just loops After

In function 'vpx_img_free',
    inlined from 'close_input_file' at tools/tiny_ssim.c:147:5:
vpx/src/vpx_image.c:245:27: warning: 'free' called on pointer 'in_7(D)' with nonzero offset 160 [-Wfree-nonheap-object]
  245 |     if (img->self_allocd) free(img);
      |                           ^
make[1]: Leaving directory '/home/volga629/rpmbuild/BUILD/freeswitch-1.10.8/libs/libvpx'
make[1]: Entering directory '/home/volga629/rpmbuild/BUILD/freeswitch-1.10.8'
make[2]: Entering directory '/home/volga629/rpmbuild/BUILD/freeswitch-1.10.8'
make[3]: Entering directory '/home/volga629/rpmbuild/BUILD/freeswitch-1.10.8'
make[4]: Entering directory '/home/volga629/rpmbuild/BUILD/freeswitch-1.10.8'
make[5]: Entering directory '/home/volga629/rpmbuild/BUILD/freeswitch-1.10.8'
make[6]: Entering directory '/home/volga629/rpmbuild/BUILD/freeswitch-1.10.8'
make[7]: Entering directory '/home/volga629/rpmbuild/BUILD/freeswitch-1.10.8'
make[8]: Entering directory '/home/volga629/rpmbuild/BUILD/freeswitch-1.10.8'

Version APR 1.7 error out


/bin/sh /home/volga629/rpmbuild/BUILD/freeswitch-1.10.8/libs/apr/libtool --silent --mode=compile gcc   -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection  -DHAVE_CONFIG_H -D_REENTRANT -D_GNU_SOURCE   -I./include -I/home/volga629/rpmbuild/BUILD/freeswitch-1.10.8/libs/apr/include/arch/unix -I./include/arch/unix -I/home/volga629/rpmbuild/BUILD/freeswitch-1.10.8/libs/apr/include  -o threadproc/unix/thread.lo -c threadproc/unix/thread.c && touch threadproc/unix/thread.lo
/bin/sh /home/volga629/rpmbuild/BUILD/freeswitch-1.10.8/libs/apr/libtool --silent --mode=compile gcc   -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection  -DHAVE_CONFIG_H -D_REENTRANT -D_GNU_SOURCE   -I./include -I/home/volga629/rpmbuild/BUILD/freeswitch-1.10.8/libs/apr/include/arch/unix -I./include/arch/unix -I/home/volga629/rpmbuild/BUILD/freeswitch-1.10.8/libs/apr/include  -o threadproc/unix/signals.lo -c threadproc/unix/signals.c && touch threadproc/unix/signals.lo
In file included from ./include/fspr_pools.h:39,
                 from /home/volga629/rpmbuild/BUILD/freeswitch-1.10.8/libs/apr/include/arch/unix/../fspr_private_common.h:24,
                 from /home/volga629/rpmbuild/BUILD/freeswitch-1.10.8/libs/apr/include/arch/unix/fspr_private.h:881,
                 from /home/volga629/rpmbuild/BUILD/freeswitch-1.10.8/libs/apr/include/arch/unix/fspr_arch_threadproc.h:18,
                 from threadproc/unix/signals.c:18:
./include/fspr_general.h:33: warning: "NSIG" redefined
   33 | #define NSIG __DARWIN_NSIG
      |
In file included from /usr/include/sys/wait.h:36,
                 from ./include/fspr.h:131,
                 from /home/volga629/rpmbuild/BUILD/freeswitch-1.10.8/libs/apr/include/arch/unix/fspr_arch_threadproc.h:17:
/usr/include/signal.h:184: note: this is the location of the previous definition
  184 | # define NSIG   _NSIG
      |
./include/fspr_general.h:33:14: error: '__DARWIN_NSIG' undeclared here (not in a function)
   33 | #define NSIG __DARWIN_NSIG
      |              ^~~~~~~~~~~~~
threadproc/unix/signals.c:127:20: note: in expansion of macro 'NSIG'
  127 | #define APR_NUMSIG NSIG
      |                    ^~~~
threadproc/unix/signals.c:136:39: note: in expansion of macro 'APR_NUMSIG'
  136 | static const char *signal_description[APR_NUMSIG];
      |                                       ^~~~~~~~~~
threadproc/unix/signals.c: In function 'fspr_signal_description_get':
threadproc/unix/signals.c:268:1: warning: control reaches end of non-void function [-Wreturn-type]
  268 | }
      | ^
threadproc/unix/signals.c: At top level:
threadproc/unix/signals.c:136:20: warning: 'signal_description' defined but not used [-Wunused-variable]
  136 | static const char *signal_description[APR_NUMSIG];
      |                    ^~~~~~~~~~~~~~~~~~
make[2]: *** [/home/volga629/rpmbuild/BUILD/freeswitch-1.10.8/libs/apr/build/apr_rules.mk:201: threadproc/unix/signals.lo] Error 1
make[2]: Leaving directory '/home/volga629/rpmbuild/BUILD/freeswitch-1.10.8/libs/apr'
make[1]: *** [/home/volga629/rpmbuild/BUILD/freeswitch-1.10.8/libs/apr/build/apr_rules.mk:113: all-recursive] Error 1
make[1]: Leaving directory '/home/volga629/rpmbuild/BUILD/freeswitch-1.10.8/libs/apr'
make: *** [Makefile:4511: libs/apr/libapr-1.la] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.LCHl5p (%build)

Question:

Is based on this

 -I/home/volga629/rpmbuild/BUILD/freeswitch-1.10.8/libs/apr/include

freeswitch is can't use system APR version ?

volga629-1 avatar Dec 02 '22 02:12 volga629-1

https://github.com/signalwire/freeswitch/pull/1921

andywolk avatar Jan 12 '23 16:01 andywolk