Thursday, December 15, 2011

Wanpipe Install Problem Fixed


Got this problem. Fixed it. Don't think it's important. It took a lot of time....wasted time....to figure all of this out.

Compiling WANPIPE API Development Utilities ...Failed!

        ERROR: Failed to compile WANPIPE API Tools !!!
        Please contact support at Sangoma Technologies
        email: techdesk@sangoma.com
        Please include the file setup_drv_compile.log


Let's see if we can get some detail:

[root@ana64 api]# cd /usr/src/Sangoma/wanpipe/api


[root@ana64 api]# make
make -C tdm_api
make[1]: Entering directory `/usr/src/Sangoma/wanpipe-3.5.12/api/tdm_api'
Ok.
make[1]: Leaving directory `/usr/src/Sangoma/wanpipe-3.5.12/api/tdm_api'
make -C legacy
make[1]: Entering directory `/usr/src/Sangoma/wanpipe-3.5.12/api/legacy'
make -C x25 all  APIINC=/usr/include/wanpipe
make[2]: Entering directory `/usr/src/Sangoma/wanpipe-3.5.12/api/legacy/x25'
Ok.
make[2]: Leaving directory `/usr/src/Sangoma/wanpipe-3.5.12/api/legacy/x25'
make -C chdlc all  APIINC=/usr/include/wanpipe
make[2]: Entering directory `/usr/src/Sangoma/wanpipe-3.5.12/api/legacy/chdlc'
cc -Wall -O2 -D__LINUX__ -D_DEBUG_=2 -D_GNUC_ -I../lib -I/usr/include/wanpipe -o chdlc_modem_cmd chdlc_modem_cmd.c ../lib/lib_api.c
chdlc_modem_cmd.c: In function 'handle_socket':
chdlc_modem_cmd.c:412: error: 'wp_api_hdr_t' has no member named 'error_flag'
make[2]: *** [chdlc_modem_cmd] Error 1
make[2]: Leaving directory `/usr/src/Sangoma/wanpipe-3.5.12/api/legacy/chdlc'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/usr/src/Sangoma/wanpipe-3.5.12/api/legacy'
make: *** [all] Error 2


Problem is with legacy chdlc - not using it.  This is why this problem can most likely be ignored. Nevertheless, the fix follows. First, we look for a replacement for the offending "error_flag" field that's not defined.

[root@ana64 api]# grep -r "wp_api_hdr_t\;" ../* | grep "\.h\:"
grep: warning: ../patches/kdrivers/include/linux: recursive directory loop

../patches/kdrivers/include/wanpipe_api_hdr.h:} wp_api_hdr_t;
grep: warning: ../patches/kdrivers/wanec/linux: recursive directory loop

[root@ana64 api]# vi ../patches/kdrivers/include/wanpipe_api_hdr.h
[root@ana64 api]# vim ../patches/kdrivers/include/wanpipe_api_hdr.h

This looks promising:

/* CHDLC Old backdward comptabile */
#define wp_api_rx_hdr_chdlc_error_flag                  wp_api_rx_hdr_error_flag

Let's apply a change:


[root@ana64 api]# cd /usr/src/Sangoma/wanpipe/api/legacy/chdlc/
[root@ana64 chdlc]#

Create a file called "patch" and fill it with the following:



--- chdlc_modem_cmd.c   2011-12-15 17:05:20.000000000 -0500
+++ chdlc_modem_cmd.c.chg       2011-12-15 17:16:06.000000000 -0500
@@ -409,7 +409,7 @@
                                                return;
                                        }

-                                       switch (api_rx_el->api_rx_hdr.error_flag){
+                                       switch (api_rx_el->api_rx_hdr.wp_api_rx_hdr_error_flag){

                                        case 0:
                                                /* Rx packet is good */

Apply the patch:


[root@ana64 chdlc]# patch --ignore-whitespace < patch
patching file chdlc_modem_cmd.c

Now compile the api:

[root@ana64 chdlc]# cd /usr/src/Sangoma/wanpipe/api
[root@ana64 api]# make

Problem should be gone.  There will be tons of warnings depending on the gcc version you are using. As long as you don't see "error" in the output it should be fine.

No comments: