tommyjlong / app_rtsp_sip

Asterisk Application - Two-way audio with your Camera using RTSP and SIP to an Asterisk Channel
23 stars 10 forks source link

Compilation Error Asterisk 18.14 on Raspberry pi 4 #5

Closed FrancescoTalotta closed 7 months ago

FrancescoTalotta commented 2 years ago

Hello, when I try to compile Asterisk 18.14 with your module I get the following errors:

[CC] app_rtsp_sip.c -> app_rtsp_sip.o
In file included from /home/openhabian/Downloads/asterisk-18.14.0/include/pj/types.h:33,
                 from /home/openhabian/Downloads/asterisk-18.14.0/include/pjsip/sip_config.h:27,
                 from /home/openhabian/Downloads/asterisk-18.14.0/include/pjsip/sip_types.h:34,
                 from /home/openhabian/Downloads/asterisk-18.14.0/include/pjsip.h:24,
                 from /home/openhabian/Downloads/asterisk-18.14.0/include/pjsua-lib/pjsua.h:30,
                 from app_rtsp_sip.c:88:
/home/openhabian/Downloads/asterisk-18.14.0/include/pj/config.h:264:6: error: #error Endianness must be declared for this processor
 #    error Endianness must be declared for this processor
      ^~~~~
In file included from /home/openhabian/Downloads/asterisk-18.14.0/include/pj/types.h:33,
                 from /home/openhabian/Downloads/asterisk-18.14.0/include/pjsip/sip_config.h:27,
                 from /home/openhabian/Downloads/asterisk-18.14.0/include/pjsip/sip_types.h:34,
                 from /home/openhabian/Downloads/asterisk-18.14.0/include/pjsip.h:24,
                 from /home/openhabian/Downloads/asterisk-18.14.0/include/pjsua-lib/pjsua.h:30,
                 from app_rtsp_sip.c:88:
/home/openhabian/Downloads/asterisk-18.14.0/include/pj/config.h:1377:4: error: #error "PJ_IS_LITTLE_ENDIAN is not defined!"
 #  error "PJ_IS_LITTLE_ENDIAN is not defined!"
    ^~~~~
/home/openhabian/Downloads/asterisk-18.14.0/include/pj/config.h:1381:4: error: #error "PJ_IS_BIG_ENDIAN is not defined!"
 #  error "PJ_IS_BIG_ENDIAN is not defined!"
    ^~~~~
In file included from /home/openhabian/Downloads/asterisk-18.14.0/include/pj/limits.h:28,
                 from /home/openhabian/Downloads/asterisk-18.14.0/include/pj/types.h:34,
                 from /home/openhabian/Downloads/asterisk-18.14.0/include/pjsip/sip_config.h:27,
                 from /home/openhabian/Downloads/asterisk-18.14.0/include/pjsip/sip_types.h:34,
                 from /home/openhabian/Downloads/asterisk-18.14.0/include/pjsip.h:24,
                 from /home/openhabian/Downloads/asterisk-18.14.0/include/pjsua-lib/pjsua.h:30,
                 from app_rtsp_sip.c:88:
/home/openhabian/Downloads/asterisk-18.14.0/include/pj/compat/limits.h:39:4: warning: #warning "limits.h is not found or not supported. LONG_MIN and LONG_MAX " "will be defined by the library in pj/compats/limits.h and " "overridable in config_site.h" [-Wcpp]
 #  warning "limits.h is not found or not supported. LONG_MIN and LONG_MAX " \
    ^~~~~~~
In file included from app_rtsp_sip.c:82:
/home/openhabian/Downloads/asterisk-18.14.0/include/asterisk/module.h:565:22: fatal error: opening dependency file .app_rtsp_sip.o.d: Permission denied
  static const struct ast_module_info *ast_module_info = &__mod_info
                      ^~~~~~~~~~~~~~~
app_rtsp_sip.c:4224:1: note: in expansion of macro ‘AST_MODULE_INFO’
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "RTSP-SIP Application",
 ^~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [/home/openhabian/Downloads/asterisk-18.14.0/Makefile.rules:165: app_rtsp_sip.o] Error 1
make: *** [Makefile:396: apps] Error 2

How to solve this problem?

Thank you

tommyjlong commented 2 years ago

The port I did for app_rtsp_sip as explained in the README.md was for Asterisk 17.x.

For 18.x, it is very likely that Asterisk restructured things and made file changes which now breaks the compile. I can put support for 18.x on my list of things to do, but it may be some time before I get around to it.

pergolafabio commented 2 years ago

thnx for feedback , usefull info for @TECH7Fox too He added this app also in the Asterisk Add-on for HA, it also uses 18.x , compiled correct for amd64 and i386 But seems indeed RPI is architecture is giving issues

tommyjlong commented 2 years ago

@FrancescoTalotta Can you tell me more about the environment you are compiling in? Things like.... are you using an RaspberryPi? Which one? Which Linux distribution are you using? It appears you are using OpenHABian, I don't know much about it, but here it says it comes as an image, or can run on Buster...which one do you use?

Anyway, I'm not sure whether I can recreate this, but wanted to gather the information.

FrancescoTalotta commented 2 years ago

Hello, I'm using a Raspberry Pi 4 Model B Rev 1.4 with 8Gb of RAM. The operating system is Raspbian GNU/Linux 10 (buster) with the openhabian mods. The kernel is Linux 5.10.103-v7l+

TECH7Fox commented 2 years ago

Hi, I'm also getting this issue (except for the limits.sh not found) on certain architectures. Here is the Github action: https://github.com/TECH7Fox/asterisk-hass-addons/runs/7943524795?check_suite_focus=true#step:7:3351

But it's basicly this part:

 > [build 15/25] RUN     menuselect/menuselect --disable BUILD_NATIVE menuselect.makeopts;     JOBS=$(( $(nproc) + $(nproc) / 2 ));     make -j ${JOBS} all;     DESTDIR="/opt/asterisk" make install;     DESTDIR="/opt/asterisk" make samples:
#23 1051.5       |    ^~~~~
#23 1051.5 /usr/src/asterisk/include/pj/config.h:1377:4: error: #error "PJ_IS_LITTLE_ENDIAN is not defined!"
#23 1051.5  1377 | #  error "PJ_IS_LITTLE_ENDIAN is not defined!"
#23 1051.5       |    ^~~~~
#23 1051.5 /usr/src/asterisk/include/pj/config.h:1381:4: error: #error "PJ_IS_BIG_ENDIAN is not defined!"
#23 1051.5  1381 | #  error "PJ_IS_BIG_ENDIAN is not defined!"
#23 1051.5       |    ^~~~~
#23 1054.0 make[1]: *** [/usr/src/asterisk/Makefile.rules:165: app_rtsp_sip.o] Error 1
#23 1054.0 make[1]: *** Waiting for unfinished jobs....
#23 1089.9 make: *** [Makefile:395: apps] Error 2

It only happens on aarch64, armhf and armv7. Amd64 and i386 are working fine.

Hope this helps. Thanks anyway for your work on this module! :)

tommyjlong commented 2 years ago

@FrancescoTalotta, if you would, for the app_rtsp_sip.c file; above the line that says: #include <asterisk.h> add the following lines of code:

/* Uncomment the next 2 lines if compiling on ARM */
#define PJ_IS_BIG_ENDIAN 0
#define PJ_IS_LITTLE_ENDIAN 1

And see if it works.

Note: I have not been able to determine what is causing the limits.h warning.

-----Just Some Notes ------- After some poking around...... The app_rtsp_sip application depends on a couple of functions in the PJSIP project. At configure/build time, the PJSIP project under Asterisk goes through a series of checks to see what the hardware is capable of or compatible with and in general configures itself for the target processor and endianess it tests for. As a note, ARMv6 and newer processors are bi-endian, meaning they can support either endian type. From what research I have done, most Raspberry Pi's are setup to run in little endian mode. The hardware checks that PJSIP runs at build time confirms this on a RaspberryPiZeroW that I have used to test this out on (its the only Rpi I have at the moment).

PJSIP's config.h file has ways of making use of these discovered capabilities. For x86 processors, config.h knows when its target is a x86 processor and config.h sets the PJ_IS_LITTLE_ENDIAN and PJ_IS_BIG_ENDIAN defines. config.h also knows when its an ARM processors but ARM processors are bi-endian, meaning they can support either endian type, and config.h doesn't know which one. It appears that only the build process tells config.h what the endianess is at compile time by passing in these values as compiler define flags and as such are not stored away in a *.h file.

When Asterisk compiles the apps, apparently Asterisk does not pass along these endianess compile flags and thus causes the compile failures logged above.

FrancescoTalotta commented 2 years ago

It worked.

Thank you!

tommyjlong commented 7 months ago

Adding the following cross-reference for those using app_rtsp_sip with Home Assistant Asterisk AddOn https://github.com/TECH7Fox/asterisk-hass-addons/issues/313

tommyjlong commented 7 months ago

Closing.