Discussion:
[Freetel-codec2] freedv-api
Andrew Birt
2016-08-12 08:44:27 UTC
Permalink
Hello,

This is a continuation (from the Google digital-voice group) of some of
the woes I am having compiling freedv.rx/tx using the freedv.api.

I am trying to build/compile exe. files for use on my XUbuntu 16.04
machine, principally to experiment with the 2400B mode.

Freedv 1.1 has previously been successfully built and used OK.

The test
./freedv_tx 1600 speechsample.raw - | ./freedv_rx 1600 - - | play -t raw
-r 8000 -s -2 -q -
works ok (using the exes from the api page).

My codec2 is svn 2841 (current)

In a nutshell >>>>>

Compile directory contents are:-
freedv_api.h
freedv_api.c
freedv_rx.c
freedv_tx.c
----------------------------------------------------------------------------------------------------------------------------------------------------------------------


My compile command line:-

:~/Desktop/weds$ g++
-I/home/g3nr/free-dv/src/-I/home/g3nr/free-dv/build_linux/codec2-dev/src/
freedv_api.c freedv_tx.c -o foo
----------------------------------------------------------------------------------------------------------------------------------------------------------------------

Compiler response:-

In file included from freedv_api.c:46:0:
/home/g3nr/free-dv/build_linux/codec2-dev/src/freedv_api_internal.h:138:34:
error: redefinition of ‘float quiskFilt120t480 [480]’
static float quiskFilt120t480[480] = { -0.000005050567303837,
-0.00000026701179
^
In file included from freedv_api.c:46:0:
/home/g3nr/free-dv/build_linux/codec2-dev/src/freedv_api_internal.h:59:14:
note: ‘float quiskFilt120t480 [480]’ previously declared here
static float quiskFilt120t480[480];
^
freedv_api.c: In function ‘freedv* freedv_open(int)’:
freedv_api.c:174:31: error: invalid conversion from ‘void*’ to ‘int*’
[-fpermissive]
f->codec_bits = malloc(1);
^
freedv_api.c:201:31: error: invalid conversion from ‘void*’ to ‘int*’
[-fpermissive]
f->codec_bits = malloc(1);
^
freedv_api.c:230:31: error: invalid conversion from ‘void*’ to ‘int*’
[-fpermissive]
f->codec_bits = malloc(1);
^
In file included from /usr/include/stdlib.h:492:0,
from freedv_api.c:30:
freedv_api.c: In function ‘void freedv_tx_fsk_voice(freedv*, short int*)’:
freedv_api.c:434:16: error: invalid conversion from ‘void*’ to ‘float*’
[-fpermissive]
tx_float = alloca(sizeof(float)*f->n_nom_modem_samples);
^
freedv_api.c: In function ‘void freedv_tx_fsk_data(freedv*, short int*)’:
freedv_api.c:464:16: error: invalid conversion from ‘void*’ to ‘float*’
[-fpermissive]
tx_float = alloca(sizeof(float)*f->n_nom_modem_samples);
^
freedv_api.c: In function ‘int freedv_comprx_fdmdv_700(freedv*, COMP*,
int*)’:
freedv_api.c:1202:107: error: cannot convert ‘float*’ to ‘char*’ for
argument ‘5’ to ‘void cohpsk_put_test_bits(COHPSK*, int*, short int*,
int*, char*)’
its(f->cohpsk, &f->test_frame_sync_state, error_pattern, &bit_errors,
rx_bits);

----------------------------------------------------------------------------------------------------------------------------------------------------------------------


Am I being too simplistic here? Are there file paths I haven't included
properly?

Any help please would be much appreciated.


73s Andrew G3NR
Jeroen Vreeken
2016-08-12 08:49:37 UTC
Permalink
Hi Andrew,
Post by Andrew Birt
My compile command line:-
:~/Desktop/weds$ g++
-I/home/g3nr/free-dv/src/-I/home/g3nr/free-dv/build_linux/codec2-dev/src/
freedv_api.c freedv_tx.c -o foo
You seem to be compiling C code with a C++ compiler.... hence the
warnings about void* being casted.
Try using 'gcc' instead of 'g++'

Regards,
Jeroen
Andrew Birt
2016-08-12 13:29:03 UTC
Permalink
Thanks Jeroen, g++ is my usual haunt so it's just a habit I guess !

Tried gcc instead and now it looks like it can't find the libraries (?)

eg:-

freedv_api.c: In function ‘freedv_comprx_fdmdv_700’:
freedv_api.c:1202:100: warning: passing argument 5 of
‘cohpsk_put_test_bits’ from incompatible pointer type
[-Wincompatible-pointer-types]
its(f->cohpsk, &f->test_frame_sync_state, error_pattern, &bit_errors,
rx_bits);
^
In file included from
/home/g3nr/free-dv/build_linux/codec2-dev/src/freedv_api_internal.h:44:0,
from freedv_api.c:46:
/home/g3nr/free-dv/build_linux/codec2-dev/src/codec2_cohpsk.h:55:6:
note: expected ‘char *’ but argument is of type ‘float *’
void cohpsk_put_test_bits(struct COHPSK *coh, int *state, short
error_pattern[]
^
/tmp/cc5hYYlQ.o: In function `freedv_open':
freedv_api.c:(.text+0x11a): undefined reference to `fdmdv_create'
freedv_api.c:(.text+0x13e): undefined reference to `golay23_init'
freedv_api.c:(.text+0x193): undefined reference to `fdmdv_bits_per_frame'
freedv_api.c:(.text+0x1dc): undefined reference to `fdmdv_bits_per_frame'
freedv_api.c:(.text+0x25e): undefined reference to
`fdmdv_error_pattern_size'
freedv_api.c:(.text+0x2af): undefined reference to `cohpsk_create'
freedv_api.c:(.text+0x366): undefined reference to
`cohpsk_error_pattern_size'
freedv_api.c:(.text+0x3a7): undefined reference to `fvhff_create_deframer'
freedv_api.c:(.text+0x3ec): undefined reference to `fsk_create_hbr'
freedv_api.c:(.text+0x43c): undefined reference to `fvhff_destroy_deframer'
freedv_api.c:(.text+0x4a8): undefined reference to `fsk_nin'

etc........etc.......long list..

Tried gcc -L to the free-dv/build_linux/external/dist/lib/ directory
but still doesn't want to play.

Not sure where I should be looking :-(

73s Andrew G3NR
Post by Jeroen Vreeken
Hi Andrew,
Post by Andrew Birt
My compile command line:-
:~/Desktop/weds$ g++
-I/home/g3nr/free-dv/src/-I/home/g3nr/free-dv/build_linux/codec2-dev/src/
freedv_api.c freedv_tx.c -o foo
You seem to be compiling C code with a C++ compiler.... hence the
warnings about void* being casted.
Try using 'gcc' instead of 'g++'
Regards,
Jeroen
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. http://sdm.link/zohodev2dev
_______________________________________________
Freetel-codec2 mailing list
https://lists.sourceforge.net/lists/listinfo/freetel-codec2
Jeroen Vreeken
2016-08-12 13:50:20 UTC
Permalink
Post by Andrew Birt
Thanks Jeroen, g++ is my usual haunt so it's just a habit I guess !
Tried gcc instead and now it looks like it can't find the libraries (?)
Adding -L will only tell the linker where to look for the libraries, but
it won't tell it which library you actually need.
In this case you need to specify that libcodec2 needs to be linked,
which is done with '-l' (small l).
You also don't need the freedv_api.c file as its contents are already in
the library. You need to have it .h file in the include path.

So you probably need to issue a command like this:

gcc \
-I/home/g3nr/free-dv/src/ \
-I/home/g3nr/free-dv/build_linux/codec2-dev/src/ \
freedv_tx.c \
-o foo \
-L free-dv/build_linux/external/dist/lib/ -lcodec2


Regards,
Jeroen
Andrew Birt
2016-08-22 08:40:01 UTC
Permalink
Thanks Jeroen that's fixed it! Many thanks for your help.


73s Andrew G3NR
Post by Jeroen Vreeken
Post by Andrew Birt
Thanks Jeroen, g++ is my usual haunt so it's just a habit I guess !
Tried gcc instead and now it looks like it can't find the libraries (?)
Adding -L will only tell the linker where to look for the libraries, but
it won't tell it which library you actually need.
In this case you need to specify that libcodec2 needs to be linked,
which is done with '-l' (small l).
You also don't need the freedv_api.c file as its contents are already in
the library. You need to have it .h file in the include path.
gcc \
-I/home/g3nr/free-dv/src/ \
-I/home/g3nr/free-dv/build_linux/codec2-dev/src/ \
freedv_tx.c \
-o foo \
-L free-dv/build_linux/external/dist/lib/ -lcodec2
Regards,
Jeroen
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. http://sdm.link/zohodev2dev
_______________________________________________
Freetel-codec2 mailing list
https://lists.sourceforge.net/lists/listinfo/freetel-codec2
------------------------------------------------------------------------------
Loading...