I am trying to compile PJSIP 2.1 with Video support on Ubuntu but I get the following error when running 'make' :
In file included from ../src/pjmedia/ffmpeg_util.c:26:0:
../src/pjmedia/ffmpeg_util.h:50:12: warning: ‘enum CodecID’ declared inside parameter list [enabled by default]
enum CodecID *codec_id);
^
../src/pjmedia/ffmpeg_util.h:50:12: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
../src/pjmedia/ffmpeg_util.h:53:7: warning: ‘enum CodecID’ declared inside parameter list [enabled by default]
pjmedia_format_id *fmt_id);
^
../src/pjmedia/ffmpeg_util.c:65:18: error: field ‘codec_id’ has incomplete type
enum CodecID codec_id;
^
../src/pjmedia/ffmpeg_util.c:167:13: error: conflicting types for ‘pjmedia_format_id_to_CodecID’
pj_status_t pjmedia_format_id_to_CodecID(pjmedia_format_id fmt_id,
^
In file included from ../src/pjmedia/ffmpeg_util.c:26:0:
../src/pjmedia/ffmpeg_util.h:49:13: note: previous declaration of ‘pjmedia_format_id_to_CodecID’ was here
pj_status_t pjmedia_format_id_to_CodecID(pjmedia_format_id fmt_id,
^
../src/pjmedia/ffmpeg_util.c: In function ‘pjmedia_format_id_to_CodecID’:
../src/pjmedia/ffmpeg_util.c:173:35: warning: comparison between pointer and integer [enabled by default]
if (t->id==fmt_id && t->codec_id != PIX_FMT_NONE) {
^
../src/pjmedia/ffmpeg_util.c:174:6: error: dereferencing pointer to incomplete type
*codec_id = t->codec_id;
^
../src/pjmedia/ffmpeg_util.c:174:6: warning: statement with no effect [-Wunused-value]
../src/pjmedia/ffmpeg_util.c:179:5: error: dereferencing pointer to incomplete type
*codec_id = PIX_FMT_NONE;
^
../src/pjmedia/ffmpeg_util.c:179:5: warning: statement with no effect [-Wunused-value]
../src/pjmedia/ffmpeg_util.c: At top level:
../src/pjmedia/ffmpeg_util.c:183:55: error: parameter 1 (‘codec_id’) has incomplete type
pj_status_t CodecID_to_pjmedia_format_id(enum CodecID codec_id,
^
make[2]: *** [output/pjmedia-i686-pc-linux-gnu/ffmpeg_util.o] Error 1
make[2]: Leaving directory `/home/gboutmy/Downloads/pjproject-2.1.0/pjmedia/build'
make[1]: *** [pjmedia] Error 2
make[1]: Leaving directory `/home/gboutmy/Downloads/pjproject-2.1.0/pjmedia/build'
make: *** [all] Error 1
I have installed the required dependencies and have no idea what the problem is. Reading the error messages it looks like it comes from error in the PJSIP code?
EDIT : I renamed enum CodecID to enum AVCodecID according to Getting “field has incomplete type” and "conflicting types" but now i'm getting the following error :
../lib/libpjmedia-codec-i686-pc-linux-gnu.a(ffmpeg_vid_codecs.o): In function `ffmpeg_codec_encode_whole.isra.7':
ffmpeg_vid_codecs.c:(.text+0x1374): undefined reference to `avcodec_encode_video2'
collect2: error: ld returned 1 exit status
make[2]: *** [../bin/pjmedia-test-i686-pc-linux-gnu] Error 1
make[2]: Leaving directory `/home/gboutmy/Downloads/pjproject-2.1.0/pjmedia/build'
make[1]: *** [pjmedia-test] Error 2
make[1]: Leaving directory `/home/gboutmy/Downloads/pjproject-2.1.0/pjmedia/build'
make: *** [all] Error 1
Seems that you miss libavcodec/avcodec.h and, most probably, also libavformat/avformat.h. This should be because ffmpeg include folder is not into gcc's list of directories to look for header files.
From your update seems that pjsip is building against a newer ffmpeg version that the one available in Ubuntu's repositories. As you've built it yourself, you can configure pjsip to use your version by running:
./configure --with-ffmpeg=<YOUR_FFMPEG_FOLDER>
or
#Copy all library ffmpeg library files into one folder
CFLAGS="-I<YOUR_FFMPEG_FOLDER>" LDFLAGS="-L<YOUR_FFMPEG_LIB_FOLDER>" ./configure
The answer to the original question :
While compiling PJSIP I find that CodecID enum has been deprecated from ffmpeg. However it's been replaced by AV_CodecID and also the enum values have a leading AV_ added to them.
Thus after changing CodecID to AV_CodecID, please change the enums in ffmpeg_util.c.
For example this is what the table looks like after the change :
/* Conversion table between pjmedia_format_id and CodecID */
static const struct ffmpeg_codec_table_t
{
pjmedia_format_id id;
enum AVCodecID codec_id;
} ffmpeg_codec_table[] =
{
{PJMEDIA_FORMAT_H261, AV_CODEC_ID_H261},
{PJMEDIA_FORMAT_H263, AV_CODEC_ID_H263},
{PJMEDIA_FORMAT_H263P, AV_CODEC_ID_H263P},
{PJMEDIA_FORMAT_H264, AV_CODEC_ID_H264},
{PJMEDIA_FORMAT_MPEG1VIDEO, AV_CODEC_ID_MPEG1VIDEO},
{PJMEDIA_FORMAT_MPEG2VIDEO, AV_CODEC_ID_MPEG2VIDEO},
{PJMEDIA_FORMAT_MPEG4, AV_CODEC_ID_MPEG4},
{PJMEDIA_FORMAT_MJPEG, AV_CODEC_ID_MJPEG}
};
Related
https://github.com/noyesno/awka
For the above repo, I got the following error when I try to compile it on macOS (gcc is just clang). I have no idea how to fix the problem according to the error message. It compiles fine on Linux.
I also tried the real gcc from Homebrew to compile the package. It also show the same error. How can I fix this problem on macOS?
$ ./configure
$ make
...
gcc -O -Dawka_LIBDIR=\"/usr/local/lib\" -Dawka_INCDIR=\"/usr/local/include\" -c -o print.o print.c
print.c:52:11: error: expected parameter declarator
int PROTO(sprintf, (char *, const char *,...)) ;
^
print.c:52:11: error: expected ')'
print.c:52:11: note: to match this '('
print.c:52:11: error: conflicting types for '__builtin___sprintf_chk'
int PROTO(sprintf, (char *, const char *,...)) ;
^
print.c:52:11: note: '__builtin___sprintf_chk' is a builtin with type 'int (char *, int, unsigned long, const char *, ...)'
3 errors generated.
make[1]: *** [<builtin>: print.o] Error 1
make[1]: Leaving directory '/private/tmp/awka/awka'
make: *** [Makefile:48: awka_exe] Error 2
I'm not going to spend ages on this, but it looks as though configure is gripping stdio.h looking for sprintf. It is unable to find it in the header, and so it adds the #define:
NO_SPRINTF_IN_STDIO
which it sets to 1, and uses it to add its own prototype for sprintf. Unfortunately, this appears to be a macro in this case, which replaces sprintf with '__builtin___sprintf_chk' instead (which has additional string length checks by the looks of it).
Possible solutions:
Comment out the line in print.c, and make sure stdio.h is included somewhere.
After running configure, search for where it defines NO_SPRINTF_IN_STDIO and set that var to 1?
Fix the configure to so a more rigorous test?
I'm trying to compile the git-credential-libsecret.c in /usr/share/doc/git/contrib/credential/libsecret by running sudo make on the Makefile there.
However, this fails with the following output:
gcc -g -O2 -Wall -pthread -I/usr/include/libsecret-1 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -o git-credential-libsecret.o -c git-credential-libsecret.c
git-credential-libsecret.c: In function ‘keyring_get’:
git-credential-libsecret.c:87:2: error: unknown type name ‘SecretService’
SecretService *service = NULL;
^
git-credential-libsecret.c:95:2: warning: implicit declaration of function ‘secret_service_get_sync’ [-Wimplicit-function-declaration]
service = secret_service_get_sync(0, NULL, &error);
^
git-credential-libsecret.c:95:10: warning: assignment makes pointer from integer without a cast [enabled by default]
service = secret_service_get_sync(0, NULL, &error);
^
git-credential-libsecret.c:103:2: warning: implicit declaration of function ‘secret_service_search_sync’ [-Wimplicit-function-declaration]
items = secret_service_search_sync(service,
^
git-credential-libsecret.c:106:9: error: ‘SECRET_SEARCH_LOAD_SECRETS’ undeclared (first use in this function)
SECRET_SEARCH_LOAD_SECRETS | SECRET_SEARCH_UNLOCK,
^
git-credential-libsecret.c:106:9: note: each undeclared identifier is reported only once for each function it appears in
git-credential-libsecret.c:106:38: error: ‘SECRET_SEARCH_UNLOCK’ undeclared (first use in this function)
SECRET_SEARCH_LOAD_SECRETS | SECRET_SEARCH_UNLOCK,
^
git-credential-libsecret.c:117:3: error: unknown type name ‘SecretItem’
SecretItem *item;
^
git-credential-libsecret.c:118:3: error: unknown type name ‘SecretValue’
SecretValue *secret;
^
git-credential-libsecret.c:122:3: warning: implicit declaration of function ‘secret_item_get_secret’ [-Wimplicit-function-declaration]
secret = secret_item_get_secret(item);
^
git-credential-libsecret.c:122:10: warning: assignment makes pointer from integer without a cast [enabled by default]
secret = secret_item_get_secret(item);
^
git-credential-libsecret.c:123:3: warning: implicit declaration of function ‘secret_item_get_attributes’ [-Wimplicit-function-declaration]
attributes = secret_item_get_attributes(item);
^
git-credential-libsecret.c:123:14: warning: assignment makes pointer from integer without a cast [enabled by default]
attributes = secret_item_get_attributes(item);
^
git-credential-libsecret.c:131:3: warning: implicit declaration of function ‘secret_value_get_text’ [-Wimplicit-function-declaration]
s = secret_value_get_text(secret);
^
git-credential-libsecret.c:131:5: warning: assignment makes pointer from integer without a cast [enabled by default]
s = secret_value_get_text(secret);
^
git-credential-libsecret.c:138:3: warning: implicit declaration of function ‘secret_value_unref’ [-Wimplicit-function-declaration]
secret_value_unref(secret);
^
make: *** [git-credential-libsecret.o] Error 1
From what I can tell the errors are stemming from the unknown type name issues and them spiralling out as the unknown types are used "incorrectly" later on.
As near as I can tell, however, the types are perfectly well defined in the locations provided in the source files:
grep -Enr "#include.*secret\.h" git-credential-libsecret.c
30:#include <libsecret/secret.h>
Per the gcc call, this will be found at /usr/include/libsecret-1, and indeed:
ls /usr/include/libsecret-1/libsecret
secret-attributes.h secret-enum-types.h secret-item.h secret-paths.h secret-schema.h secret-service.h secret-value.h
secret-collection.h secret.h secret-password.h secret-prompt.h secret-schemas.h secret-types.h
This header itself doesn't define SecretService (grep -E "^typedef" secret.h gives nothing), because the SecretService is defined in secret-service.h:
grep -nE "^typedef.*SecretService;" /usr/include/libsecret-1/libsecret/secret-service.h
53:typedef struct _SecretService SecretService;
And secret-service is included in secret.h:
grep -En "^#include.*service" /usr/include/libsecret-1/libsecret/secret.h
40:#include <libsecret/secret-service.h>
Similar investigations yield the same for SecretItem and SecretValue.
Am I missing something? Why doesn't the file build as expected?
I'm running Cygwin on top of Windows 7. I'm having trouble trying to install the checkinstall utility from source, and the culprit appears to be gcc.
When I run /.configure, I get the error:
-bash: ./configure: No such file or directory
So I continue with make, and get output that fails with lots of errors, presumably caused by gcc. The output can be seen in its entirety here, but below are the first and last few lines of it.
$ make
for file in locale/checkinstall-*.po ; do \
case ${file} in \
locale/checkinstall-template.po) ;; \
*) \
out=`echo $file | sed -s 's/po/mo/'` ; \
msgfmt -o ${out} ${file} ; \
if [ $? != 0 ] ; then \
exit 1 ; \
fi ; \
;; \
esac ; \
done
make -C installwatch
make[1]: Entering directory '/cygdrive/b/Users/Me/Desktop/checkinstall-1.6.2/installwatch'
gcc -Wall -c -D_GNU_SOURCE -DPIC -fPIC -D_REENTRANT -DVERSION=\"0.7.0beta7\" installwatch.c
In file included from /usr/local/include/sys/param.h:33:0,
from installwatch.c:31:
/usr/local/include/sys/types.h:10:2: error: #error Only Win32 target is supported!
#error Only Win32 target is supported!
^~~~~
In file included from /usr/local/include/sys/param.h:33:0,
from installwatch.c:31:
/usr/local/include/sys/types.h:90:3: error: unknown type name ‘time_t’
time_t tv_sec; /* Seconds */
^~~~~~
In file included from installwatch.c:33:0:
/usr/local/include/sys/stat.h:10:2: error: #error Only Win32 target is supported!
#error Only Win32 target is supported!
^~~~~
In file included from /usr/local/include/sys/stat.h:14:0,
from installwatch.c:33:
/usr/local/include/io.h:199:28: error: expected ‘,’ or ‘;’ before ‘_findfirst32’
_CRTIMP intptr_t __cdecl _findfirst32(const char *_Filename,struct _finddata32_t *_FindData);
^~~~~~~~~~~~
...
installwatch.c: In function ‘fopen’:
installwatch.c:2560:51: error: expected ‘)’ before ‘result’
logg("%" PRIdPTR "\tfopen\t%s\t#%s\n",(intptr_t)result,
^~~~~~
installwatch.c:2560:8: warning: format ‘%s’ expects a matching ‘char *’ argument [-Wformat=]
logg("%" PRIdPTR "\tfopen\t%s\t#%s\n",(intptr_t)result,
^~~
installwatch.c:2560:8: warning: format ‘%s’ expects a matching ‘char *’ argument [-Wformat=]
installwatch.c:2575:51: error: expected ‘)’ before ‘result’
logg("%" PRIdPTR "\tfopen\t%s\t#%s\n",(intptr_t)result,
^~~~~~
installwatch.c:2575:8: warning: format ‘%s’ expects a matching ‘char *’ argument [-Wformat=]
logg("%" PRIdPTR "\tfopen\t%s\t#%s\n",(intptr_t)result,
^~~
installwatch.c:2575:8: warning: format ‘%s’ expects a matching ‘char *’ argument [-Wformat=]
installwatch.c: At top level:
installwatch.c:2600:7: error: conflicting types for ‘getcwd’
char *getcwd(char *buffer,size_t size) {
^~~~~~
In file included from /usr/local/include/sys/stat.h:14:0,
from installwatch.c:33:
/usr/local/include/io.h:279:17: note: previous declaration of ‘getcwd’ was here
char *__cdecl getcwd (char *, int) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
^~~~~~
installwatch.c:2664:30: error: unknown type name ‘uid_t’
int lchown(const char *path, uid_t owner, gid_t group) {
^~~~~
installwatch.c:2664:43: error: unknown type name ‘gid_t’
int lchown(const char *path, uid_t owner, gid_t group) {
^~~~~
installwatch.c:2749:5: error: conflicting types for ‘mkdir’
int mkdir(const char *pathname, mode_t mode) {
^~~~~
In file included from /usr/local/include/sys/stat.h:14:0,
from installwatch.c:33:
/usr/local/include/io.h:280:15: note: previous declaration of ‘mkdir’ was here
int __cdecl mkdir (const char *) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
^~~~~
installwatch.c:2983:7: error: conflicting types for ‘realpath’
char *realpath(const char *file_name,char *resolved_name) {
^~~~~~~~
installwatch.c:556:6: note: previous implicit declaration of ‘realpath’ was here
if(!realpath(path,resolved_path)) {
^~~~~~~~
installwatch.c:3309:5: error: conflicting types for ‘utime’
int utime (const char *pathname, const struct utimbuf *newtimes) {
^~~~~
In file included from /usr/local/include/utime.h:6:0,
from installwatch.c:47:
/usr/local/include/sys/utime.h:115:26: note: previous definition of ‘utime’ was here
__CRT_INLINE int __cdecl utime(const char *_Filename,struct utimbuf *_Utimbuf) {
^~~~~
installwatch.c: In function ‘true_stat’:
installwatch.c:153:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
installwatch.c: In function ‘true_lstat’:
installwatch.c:161:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
installwatch.c: In function ‘true_mknod’:
installwatch.c:157:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
In file included from installwatch.c:35:0:
installwatch.c: In function ‘open’:
installwatch.c:2842:20: warning: ‘mode_t {aka short unsigned int}’ is promoted to ‘int’ when passed through ‘...’
mode = va_arg(ap, mode_t);
^
installwatch.c:2842:20: note: (so you should pass ‘int’ not ‘mode_t {aka short unsigned int}’ to ‘va_arg’)
installwatch.c:2842:20: note: if this code is reached, the program will abort
At top level:
installwatch.c:1040:12: warning: ‘__instw_printdirent64’ defined but not used [-Wunused-function]
static int __instw_printdirent64(struct dirent64 *entry) {
^~~~~~~~~~~~~~~~~~~~~
make[1]: *** [Makefile:22: installwatch.o] Error 1
make[1]: Leaving directory '/cygdrive/b/Users/Me/Desktop/checkinstall-1.6.2/installwatch'
make: *** [Makefile:11: all] Error 2
I'm sorry in advance if I'm going about this the wrong way, but I'm completely out of my depth with this code and the errors being thrown. I've tried using the Cygwin installer to reinstall gcc_core and other gcc packages several times to no effect.
I was in the process of using this guide to compile the latest version of gcc from source before I ran into fatal errors with that too, and decided to start from the beginning and determine whether the problem can be solved without adding yet more bloat to my Cygwin installation. Thanks in advance, it's much appreciated.
The checkinstall app does not appear to be configured to run on cygwin. It is configured for several specific Linux distribution families, and has a generic source release.
I have downloaded and unpacked the checkinstall-1.6.2.tar.gz file; it expands into the checkinstall-1.6.2 directory. There you find the checkinstall shell script. I don't have the time to wade through several thousand lines of shell code. It appears to require you build and install the installwatch program, which I guess will register a file change handler in order to identify all new and changed files and directories. I suspect that handler would need to change to work properly in cygwin. You might have success posting to one of the Cygwin mailing lists.
HTH
Doug
src/libavcodec/h264_slice.c: In function 'ff_h264_execute_decode_slices': src/libavcodec/h264_slice.c:2757:36: error: incompatible types when assigning to type 'atomic_int' from type 'int'
sl->er.error_count = 0;
^ src/libavcodec/h264_slice.c:2781:48: error: invalid operands to binary
+ (have 'atomic_int' and 'atomic_int')
h->slice_ctx[0].er.error_count += h->slice_ctx[i].er.error_count;
^ make: *** [libavcodec/h264_slice.o] Error 1 make: *** Waiting for unfinished jobs....
I compile ffmpeg for android. whether the problem is my environment configure or source code?
I think it is source code problem. I change it as below:
sl->er.error_count = 0;
atomic_store(&sl->er.error_count, 0);
h->slice_ctx[0].er.error_count += h->slice_ctx[i].er.error_count;
atomic_fetch_add(&h->slice_ctx[0].er.error_count, atomic_load(&h->slice_ctx[i].er.error_count));
https://stackoverflow.com/questions/43423803/document-classification-tool-in-c-compilation-error/43432470#43432470
In above link-
I get 3 errors after adding -fnested_functions as
gcc -c ./rainbow.c -fnested-functions process_wv.c test_file.c test_hdb_file.c
(The 3 files process_wv, test_file, test_hdb_file are removed from rainbow.c and added as seperate .c files to the directory now)
Output:-
./bow/libbow.h:1345:8: note: forward declaration of 'struct argp_child'
struct argp_child; /* forward declare this type */
^
./rainbow.c:655:5: error: function definition is not allowed here
{
^
./rainbow.c:663:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
#endif VPC_ONLY
^
//
./rainbow.c:734:3: warning: implicit declaration of function 'do_indexing' is invalid in C99
[-Wimplicit-function-declaration]
do_indexing ();
^
./rainbow.c:1175:49: warning: passing 'int *' to parameter of type 'socklen_t *' (aka 'unsigned int *') converts between
pointers to integer types with different sign [-Wpointer-sign]
newsockfd = accept(rainbow_sockfd, &cli_addr, &clilen);
^~~~~~~
/usr/include/sys/socket.h:681:69: note: passing argument to parameter here
int accept(int, struct sockaddr * __restrict, socklen_t * __restrict)
^
./rainbow.c:1586:30: error: use of undeclared identifier 'test_file'
bow_map_filenames_from_dir (test_file.c, 0, dir, "");
^
P.S Why is test_file.c unidentified (bow_map_filenames_from_dir in docnames.c) in rainbow.c even though they are inside the same bow-20020213 folder (Permissions are 755 for all)
Regards
taking this .. as a starting point:
./bow/libbow.h:1345:8: note: forward declaration of 'struct argp_child'
struct argp_child; /* forward declare this type */
The linked code has a major problem in not including all the header files (in any specific header file) that that specific header file needs.
BTW: the 'struct argp_child' is defined in the ./argp/argp.h header file.
I did the following:
downloaded all the files via the .zip facility
expanded the .zip file to ~/src_bow on my ubuntu linux computer
cd ~/src_bow
./configure
edited the resulting 'Makefile' to define the macro:
CFLAGS = -g -O -Wall -Wextra -std=gnu11 -Wimplicit
then entered:
make -f Makefile
The result was hundreds of warnings, notes and errors
Most of the compiler output messages were about syntax, incomplete struct definitions, ignored modifiers and conversions However, there were many many other problems exposed.
After fixing a couple of hundred of the problems I stopped.
To answer your question, the root of the problems you are having has to do with the appropriate header files not being included in other header files that need the information in the header files that are not being included in each header file.