I don't know if the current SDL code source is reliable (normally it is), but here is what I got when I try to compile it by myself.
/usr/include/spa-0.2/spa/utils/string.h: In "spa_strtod" function:
/usr/include/spa-0.2/spa/utils/string.h:325:9: error: ISO C90 prohibits mixing declarations and code [-Werror=declaration-after-statement]
325 | locale_t prev = uselocale(locale);
| ^~~~~~~~
cc1: some warnings are treated as errors
make: *** [Makefile:627:build/SDL_pipewire.lo] Error 1
I'm on Arch, I'm using gcc as C/C++ compiler. Please help me because I need to recompile SDL myself to maybe solve another problem I got with the library.
Related
I'm trying to compile an android kernel using clang and I'm getting warnings that I don’t care about. For compilation I use the command make -j3 CC=clang O=output, so I cannot just add the -Wno-everything argument as if I were using the command clang file.c. As I understand it, I can disable some warnings by adding #pragma to the file that causes the error. But also I have one strange error that does not reference any file:
warning: unknown warning option '-Wno-vectorizer-no-neon' [-Wunknown-warning-option]
How can I turn off all warnings? Or at least this one.
PS: Sorry for my English.
The solution was to add the -Wno-everything argument to the ARCH_CPPFLAGS parameter in the Makefile.
I tried to modify a part of code of a project "CRIU", whose code is in https://github.com/checkpoint-restore/criu. I changed some codes in criu/pie/restorer.c, in detail, I add some new variables in function __export_restore_task. However, when compiling the project, using a gcc-9 would produce an error as below.
In file included from criu/cr-restore.c:47:
criu/pie/restorer-blob.h:3:9: error: ISO C99 requires whitespace after the macro name [-Werror]
3 | #define restorer_sym__export_restore_task.cold 0x47a1
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
criu/pie/restorer-blob.h:6: error: "restorer_sym__export_restore_task" redefined [-Werror]
6 | #define restorer_sym__export_restore_task 0x2270
|
criu/pie/restorer-blob.h:3: note: this is the location of the previous definition
3 | #define restorer_sym__export_restore_task.cold 0x47a1
|
It seems like there is a new and unnecessary symbol #define restorer_sym__export_restore_task.cold 0x47a1. After removing this line I could compile the project successfully.
However, using a gcc 5.4.0 to compile the project wouldn't produce this problem, so I thought it might be the problem of gcc's version. Another reason might be something with the stack cause I added some variables while compiling the original version of the project won't have this problem. Anyway, is it possible to compile the program without .cold symbol even using gcc-9?
For a detail information you can refer to my pull request, https://github.com/checkpoint-restore/criu/pull/1711
Using a flag -fno-reorder-blocks-and-partition can solve this problem, because the flag forbid gcc to generate the hot and cold symbol.
#define restorer_sym__export_restore_task.cold 0x47a1
means the same as
#define restorer_sym__export_restore_task .cold 0x47a1
and it defines restorer_sym__export_restore_task symbol. As it is defined again - you get the warning. You treat the warning as errors.
Change
restorer_sym__export_restore_task.cold to restorer_sym__export_restore_task_cold and it will compile fine
I'm trying to use graphviz as a library for a C++ project, following the libguide provided here. However I'm having problems even compiling the examples in the appendix. When I try to compile demo.c using gcc I get the following output:
$ gcc -I/usr/local/Cellar/graphviz/2.28.0/include/ demo.c -L/usr/local/Cellar/graphviz/2.28.0/lib/ -lgvc -lgraph -lcdt
demo.c: In function ‘main’:
demo.c:14: error: ‘Agdirected’ undeclared (first use in this function)
demo.c:14: error: (Each undeclared identifier is reported only once
demo.c:14: error: for each function it appears in.)
demo.c:15: error: too many arguments to function ‘agnode’
demo.c:16: error: too many arguments to function ‘agnode’
demo.c:17: error: too many arguments to function ‘agedge’
Agdirected is found in cgraph.h, but if I change the includes in demo.c to
#include <graphviz/gvc.h>
#include <graphviz/cgraph.h>
Then all hell breaks loose (mostly conflicting declarations between the two headers). How can I include the necessary headers without the headache of all these conflicts?
Mac OS X 10.8.3, Graphviz 2.28.0, GCC 4.2.1
It seems after some experimentation that adding the flag
#define WITH_CGRAPH
has the effect of including cgraph.h, which gets rid of the "'Agdirected' undeclared" error.
The other errors can be fixed by changing the command line option in gcc from -lgraph to -lcgraph
The libguide you are using is the cgraph version, which assumes Graphviz 2.30 or later. With that version, the #define WITH_CGRAPH is already provided.
I'm starting development, and yet having lots of problems coming out from the moment I 'm trying to go a little bit out of bounds.
I usually work with CodeBlocks and just tried once to compile using MinGW.
I'm just starting to do program with the GTK library, my other programs were console applications.
So I've downloaded MiniFMOD 1.70 and 1.60 on http://www.fmod.org/index.php/download.
When I compile the main.cpp on a C++ console application project
I get this message (for both MiniFMOD versions).
||=== tryfmod170, Debug ===|
C:\Documents and Settings\Vincent\Bureau\minifmod170\lib\music.h|266|error: redefinition of typedef 'FMUSIC_MODULE'|
C:\Documents and Settings\Vincent\Bureau\minifmod170\lib\minifmod.h|26|note: previous declaration of 'FMUSIC_MODULE' was here|
C:\Documents and Settings\Vincent\Bureau\minifmod170\lib\Fmusic.c|117|error: conflicting types for 'FMUSIC_LoadSong'|
C:\Documents and Settings\Vincent\Bureau\minifmod170\lib\minifmod.h|56|note: previous declaration of 'FMUSIC_LoadSong' was here|
||=== Build finished: 2 errors, 0 warnings ===|
I'm sure it is a pretty simple error but I assume I'm quickly getting confused between all the file types,variables,structures and platforms...a
If somebody could help me I would be very grateful
It looks like you are including music.h and minifmod.h both of which have typedefs for FMUSIC_MODULE. I think you just need minifmod.h as it is the interface header, music.h is an internal header.
Im trying to compile z/lib on z/OS USS(thats right a mainframe). ive got gmake and the c89 compiler (which im assuming is c89 standards compliant) and USS is supposed to be POSIX compliant.
But zlib seems to be tripping up on
struct internal_state FAR *state; /* not visible by applications */
with the following error(s)
c89 -O3 -DUSE_MMAP -D_XOPEN_SOURCE_EXTENDED=1 -D_POSIX_SOURCE -c -o example.o example.c
ERROR CCN3277 ./zlib.h:92 Syntax error: possible missing ';' or ','?
ERROR CCN3007 ./zlib.h:92 "struct internal_state" is undefined.
ERROR CCN3166 ./zlib.h:103 Definition of function FAR requires parentheses.
ERROR CCN3276 ./zlib.h:103 Syntax error: possible missing '{'?
ERROR CCN3273 ./zlib.h:124 Missing type in declaration of gz_header.
ERROR CCN3166 ./zlib.h:126 Definition of function gz_header requires parentheses.
ERROR CCN3276 ./zlib.h:126 Syntax error: possible missing '{'?
WARNING CCN3137 ./zlib.h:1346 Declaration must declare at least one declarator, tag, or the members of an enumeration.
ERROR CCN3275 ./zlib.h:1350 Unexpected text z encountered.
ERROR CCN3282 ./zlib.h:1350 The type of the parameters must be specified in a prototype.
ERROR CCN3275 ./example.c:95 Unexpected text file encountered.
ERROR CCN3045 ./example.c:95 Undeclared identifier gzFile.
ERROR CCN3046 ./example.c:96 Syntax error.
ERROR CCN3045 ./example.c:98 Undeclared identifier file.
ERROR CCN3019 ./example.c:523 Expecting an array or a pointer to object type.
ERROR CCN3280 ./example.c:527 Function argument assignment between types "const char*" and "int" is not allowed.
CCN0793(I) Compilation failed for file ./example.c. Object file not created.
FSUM3065 The COMPILE step ended with return code 12.
FSUM3017 Could not compile example.c. Correct the errors and try again.
gmake: *** [example.o] Error 3
when i progressively take out the FAR * (i think its a far pointer but im really not that sure) the errors go away. But as this is a library, im not sure what other artifacts are going to be produced by removing this.
has anybody got any ideas?
any old mainframe heads out there?
it turns out there is a previous version of zlib that compiles on USS, version 1.1.4 or close to that. Its a back level, but i presume this works because it is before the implementation of the FAR pointer in the latest code. So atm i think ive got it to work.
thanks for all your help.
Regards
Mark.
FAR is not a C89 keyword, it is a Microsoft/Intelism and is probably #defined somewhere. If not, you need to define it as nothing:
#define FAR
However, this will probably only fix one of many problems. I would guess that the library uses some form of conditional compilation to handle things like FAR pointers - you need to read the docs to find which configuration is most suitabkle for your platform.
I'd use xlc instead of c89 since xlc is your system default compiler but you'll still probably have issues. I'd subscribe to the MVS-OE email list, the people on it are quite helpful. The link to info about the list appears to be down now so send email to
LISTSERV#VM.MARIST.EDU
with the message: INFO MVS-OE
FWIW, IBM provides a prebuilt version of zlib that includes support for the compression hardware (so-called zEDC) available on recent-vintage mainframes. See zlib for zEnterprise Data Compression