freeswitch icon indicating copy to clipboard operation
freeswitch copied to clipboard

Compilation error apr_general.h:33:14: error

Open sbasurto opened this issue 3 years ago • 3 comments

__DARWIN_NSIG’ undeclared here (not in a function) When compiling v1.10 or development version I get this error at apr

./include/apr_general.h:33:14: error: ‘__DARWIN_NSIG’ undeclared here (not in a function)
33 | #define NSIG __DARWIN_NSIG

To Reproduce Steps to reproduce the behavior:

  1. Clone repository
git clone https://github.com/signalwire/freeswitch.git

or

git clone -b v1.10 https://github.com/signalwire/freeswitch.git
  1. And follow the normal process to compile and install
cd  freeswitch
./bootstrap.sh
./configure --enable-core-pgsql-support
make

Expected behavior Clear compilation without errors

Package version or git hash "f9bb8940c29f55c89fa1e0697e8e614b355bfff2" OS: Linux localhost 5.15.11-gentoo gcc (Gentoo 11.2.0 p1) 11.2.0

Is worth to mention that if I remove the line 33 from libs/apr/include/apr_general.h it compile without error

But then I get (I do not know if they are related)

src/switch_core_media.c:2244:111: error: argument 2 of type ‘switch_core_media_flag_t[15]’ with mismatched bound [-Werror=array-parameter=]
 2244 | SWITCH_DECLARE(void) switch_media_handle_set_media_flags(switch_media_handle_t *smh, switch_core_media_flag_t flags[SCMF_MAX])

Any advice to work around these errors would be appreciated.

sbasurto avatar Jan 14 '22 00:01 sbasurto

I do my homework and I finally get Freeswitch to compile with the following steps:

  1. Remove line 33 from libs/apr/include/apr_general.h, this fix the error apr_general.h:33:14
#define NSIG __DARWIN_NSIG <- REMOVE THIS LINE
  1. Export CPPFLAGS as follow (this fix src/switch_core_media.c:2244:111: error: argument 2 and other errors because gcc 11)
# export CPPFLAGS="-Wno-array-parameter -Wno-error=deprecated-declarations -Wno-error=array-bounds"

With these two changes I compile Freeswitch without any errors with gcc 11.

Also write a tiny guide to Install Freeswitch in Gentoo

I hope this help some one, meanwhile those errors are fixed.

sbasurto avatar Jan 14 '22 19:01 sbasurto

try

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

instead of removing

andywolk avatar Sep 13 '22 23:09 andywolk

i am running the same error here and would like some assist to anyone who can help me sort this out.

voipadmin@freeswitch:/usr/local/src/freeswitch-1.10.7.-release$ export CPPFLAGS="-Wno-array-parameter -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error -Wno-error=stringop-truncation" voipadmin@freeswitch:/usr/local/src/freeswitch-1.10.7.-release$ sudo make make all-recursive make[1]: Entering directory '/usr/local/src/freeswitch-1.10.7.-release' CC src/libfreeswitch_la-switch_core_media.lo src/switch_core_media.c:2244:111: error: argument 2 of type ‘switch_core_media_flag_t[15]’ with mismatched bound [-Werror=array-parameter=] 2244 | SWITCH_DECLARE(void) switch_media_handle_set_media_flags(switch_media_handle_t *smh, switch_core_media_flag_t flags[SCMF_MAX]) | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~ In file included from ./src/include/switch.h:144, from src/switch_core_media.c:33: ./src/include/switch_core_media.h:206:111: note: previously declared as ‘switch_core_media_flag_t[]’ 206 | SWITCH_DECLARE(void) switch_media_handle_set_media_flags(switch_media_handle_t *smh, switch_core_media_flag_t flags[]); | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:2328: src/libfreeswitch_la-switch_core_media.lo] Error 1 make[1]: Leaving directory '/usr/local/src/freeswitch-1.10.7.-release' make: *** [Makefile:1292: all] Error 2 voipadmin@freeswitch:/usr/local/src/freeswitch-1.10.7.-release$ ./bootstrap.sh -bash: ./bootstrap.sh: No such file or directory voipadmin@freeswitch:/usr/local/src/freeswitch-1.10.7.-release$

tekboxodoo avatar Nov 28 '23 10:11 tekboxodoo