3dfxdev / EDGE

EDGE Source Code
http://edge2.sf.net
74 stars 10 forks source link

compiler error seen on OpenBSD #20

Closed ryan-sg closed 7 years ago

ryan-sg commented 8 years ago

wow you are fast, had merged in the pull requests before i could finish writing the below comment on the pull request :-D there was one patch i did not share:

mmkay, in ddf/main.c:

--- a/ddf/main.cc
+++ b/ddf/main.cc
@@ -195,7 +195,7 @@ public:
        define_c() : name(NULL), value(NULL)
        { }

-       define_c(char *_N, char *_V) : name(_N), value(_V)
+       define_c(char *n_N, char *v_V) : name(n_N), value(v_V)
        { }

        ~define_c()

without this, all compilers I have fail. any ideas? I don't know what I'm doing here :-) The closest clue i think i see is in the clang output, _N being defined by /usr/include/ctype.h on my system..

gcc 4.2.1:

20:10 ryan@iddqd:hyper3DGE$ gmake -f Makefiles/Makefile.bsd
mkdir -p obj_bsd/coal
mkdir -p obj_bsd/ddf
mkdir -p obj_bsd/deh_edge
mkdir -p obj_bsd/edge
mkdir -p obj_bsd/md5_conv
mkdir -p obj_bsd/md5_conv/kmq2
mkdir -p obj_bsd/epi
mkdir -p obj_bsd/glbsp
mkdir -p obj_bsd/timidity
mkdir -p obj_bsd/opllib
g++ -O2 -ffast-math -fno-strict-aliasing -Wall -pipe -I. -DBSD -DUSE_OGG -I/usr/local/include -I/usr/local/include/SDL2 -I/usr/X11R6/include -D_REENTRANT -I/usr/X11R6/include -I/usr/local/include/libcpuid -o obj_bsd/ddf/main.o -c ddf/main.cc 
ddf/main.cc:198: error: expected ',' or '...' before numeric constant
ddf/main.cc: In constructor 'define_c::define_c(char*)':
ddf/main.cc:198: error: '_V' was not declared in this scope
ddf/main.cc:198: error: invalid conversion from 'int' to 'char*'
ddf/main.cc: In function 'void DDF_MainAddDefine(char*, char*)':
ddf/main.cc:221: error: no matching function for call to 'define_c::define_c(char*&, char*&)'
ddf/main.cc:198: note: candidates are: define_c::define_c(char*)
ddf/main.cc:195: note:                 define_c::define_c()
ddf/main.cc:186: note:                 define_c::define_c(const define_c&)
Makefiles/Makefile.bsd:133: recipe for target 'obj_bsd/ddf/main.o' failed
gmake: *** [obj_bsd/ddf/main.o] Error 1

gcc 4.9.3:

20:10 ryan@iddqd:hyper3DGE$ CXX=eg++ gmake -f Makefiles/Makefile.bsd
mkdir -p obj_bsd/coal
mkdir -p obj_bsd/ddf
mkdir -p obj_bsd/deh_edge
mkdir -p obj_bsd/edge
mkdir -p obj_bsd/md5_conv
mkdir -p obj_bsd/md5_conv/kmq2
mkdir -p obj_bsd/epi
mkdir -p obj_bsd/glbsp
mkdir -p obj_bsd/timidity
mkdir -p obj_bsd/opllib
eg++ -O2 -ffast-math -fno-strict-aliasing -Wall -pipe -I. -DBSD -DUSE_OGG -I/usr/local/include -I/usr/local/include/SDL2 -I/usr/X11R6/include -D_REENTRANT -I/usr/X11R6/include -I/usr/local/include/libcpuid -o obj_bsd/ddf/main.o -c ddf/main.cc 
In file included from ddf/../epi/headers.h:26:0,
                 from ddf/../epi/epi.h:22,
                 from ddf/local.h:22,
                 from ddf/main.cc:19:
ddf/main.cc:198:17: error: expected ',' or '...' before numeric constant
  define_c(char *_N, char *_V) : name(_N), value(_V)
                 ^
ddf/main.cc: In constructor 'define_c::define_c(char*)':
ddf/main.cc:198:49: error: '_V' was not declared in this scope
  define_c(char *_N, char *_V) : name(_N), value(_V)
                                                 ^
ddf/main.cc:198:51: error: invalid conversion from 'int' to 'char*' [-fpermissive]
  define_c(char *_N, char *_V) : name(_N), value(_V)
                                                   ^
ddf/main.cc: In function 'void DDF_MainAddDefine(char*, char*)':
ddf/main.cc:221:40: error: no matching function for call to 'define_c::define_c(char*&, char*&)'
  defines.push_back(define_c(name, value));
                                        ^
ddf/main.cc:221:40: note: candidates are:
ddf/main.cc:198:2: note: define_c::define_c(char*)
  define_c(char *_N, char *_V) : name(_N), value(_V)
  ^
ddf/main.cc:198:2: note:   candidate expects 1 argument, 2 provided
ddf/main.cc:195:2: note: define_c::define_c()
  define_c() : name(NULL), value(NULL)
  ^
ddf/main.cc:195:2: note:   candidate expects 0 arguments, 2 provided
ddf/main.cc:185:7: note: define_c::define_c(const define_c&)
 class define_c
       ^
ddf/main.cc:185:7: note:   candidate expects 1 argument, 2 provided
Makefiles/Makefile.bsd:133: recipe for target 'obj_bsd/ddf/main.o' failed
gmake: *** [obj_bsd/ddf/main.o] Error 1

in clang 3.8.0:

20:10 ryan@iddqd:hyper3DGE$ CXX=clang gmake -f Makefiles/Makefile.bsd
mkdir -p obj_bsd/coal
mkdir -p obj_bsd/ddf
mkdir -p obj_bsd/deh_edge
mkdir -p obj_bsd/edge
mkdir -p obj_bsd/md5_conv
mkdir -p obj_bsd/md5_conv/kmq2
mkdir -p obj_bsd/epi
mkdir -p obj_bsd/glbsp
mkdir -p obj_bsd/timidity
mkdir -p obj_bsd/opllib
clang -O2 -ffast-math -fno-strict-aliasing -Wall -pipe -I. -DBSD -DUSE_OGG -I/usr/local/include -I/usr/local/include/SDL2 -I/usr/X11R6/include -D_REENTRANT -I/usr/X11R6/include -I/usr/local/include/libcpuid -o obj_bsd/ddf/main.o -c ddf/main.cc 
ddf/main.cc:198:17: error: expected ')'
        define_c(char *_N, char *_V) : name(_N), value(_V)
                       ^
/usr/include/ctype.h:47:12: note: expanded from macro '_N'
#define _N      0x04
                ^
ddf/main.cc:198:10: note: to match this '('
        define_c(char *_N, char *_V) : name(_N), value(_V)
                ^
ddf/main.cc:198:33: error: cannot initialize a member subobject of type 'char *' with an rvalue of type 'int'
        define_c(char *_N, char *_V) : name(_N), value(_V)
                                       ^    ~~
ddf/main.cc:198:49: error: use of undeclared identifier '_V'
        define_c(char *_N, char *_V) : name(_N), value(_V)
                                                       ^
ddf/main.cc:221:20: error: no matching constructor for initialization of 'define_c'
        defines.push_back(define_c(name, value));
                          ^        ~~~~~~~~~~~
ddf/main.cc:198:2: note: candidate constructor not viable: requires 1 argument, but 2 were provided
        define_c(char *_N, char *_V) : name(_N), value(_V)
        ^
ddf/main.cc:185:7: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided
class define_c
      ^
ddf/main.cc:195:2: note: candidate constructor not viable: requires 0 arguments, but 2 were provided
        define_c() : name(NULL), value(NULL)
        ^
4 errors generated.
Makefiles/Makefile.bsd:133: recipe for target 'obj_bsd/ddf/main.o' failed
gmake: *** [obj_bsd/ddf/main.o] Error 1
Corbachu commented 8 years ago

Did you ever get this worked out? If so, do you have binaries we could upload via SourceForge for OpenBSD users?

ryan-sg commented 8 years ago

I haven't figured out anything outside of the already-posted patch that I don't understand well enough to know if it is a valid fix or not... Not much point in posting openbsd binaries to sourceforge, openbsd is niche enough that anyone that does use it would either be looking for a port in the openbsd ports system, or compiling from source themselves. What might happen tho is I end up creating an openbsd port for hyper3dge that openbsd users can install with the local package tools...

usernameak commented 8 years ago

This is on Linux (not BSD):

g++ -O2 -ffast-math -fno-strict-aliasing -Wall -pipe -I. -DLINUX -DUSE_OGG -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DDEH_EDGE_PLUGIN -o obj_linux/deh_edge/patch.o -c deh_edge/patch.cc 
g++ -O2 -ffast-math -fno-strict-aliasing -Wall -pipe -I. -DLINUX -DUSE_OGG -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DDEH_EDGE_PLUGIN -o obj_linux/deh_edge/rscript.o -c deh_edge/rscript.cc 
g++ -O2 -ffast-math -fno-strict-aliasing -Wall -pipe -I. -DLINUX -DUSE_OGG -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -o obj_linux/edge/i_main.o -c src/i_main.cc 
In file included from src/i_main.cc:20:0:
src/i_sdlinc.h:27:34: fatal error: SDL_keycode.h: No such file or directory
compilation terminated.
Makefiles/Makefile.linux:275: recipe for target «obj_linux/edge/i_main.o» failed
make: *** [obj_linux/edge/i_main.o] Ошибка 1
usernameak commented 8 years ago

Fixed, but now:

mkdir -p obj_linux/coal
mkdir -p obj_linux/ddf
mkdir -p obj_linux/deh_edge
mkdir -p obj_linux/edge
mkdir -p obj_linux/md5_conv
mkdir -p obj_linux/md5_conv/kmq2
mkdir -p obj_linux/epi
mkdir -p obj_linux/glbsp
mkdir -p obj_linux/timidity
mkdir -p obj_linux/opllib
g++ -O2 -ffast-math -fno-strict-aliasing -Wall -pipe -I. -DLINUX -DUSE_OGG -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -o obj_linux/edge/i_video.o -c src/i_video.cc 
In file included from src/i_video.cc:33:0:
/usr/include/SDL/SDL_opengl.h:4869:105: error: conflicting declaration ‘typedef void (* PFNGLFRAGMENTLIGHTFVSGIXPROC)(GLenum, GLenum, const GLfloat*)’
 GLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, const GLfloat *params);
                                                                              ^
In file included from src/i_defs_gl.h:30:0,
                 from src/i_video.cc:21:
/usr/include/GL/glew.h:15759:28: note: previous declaration as ‘typedef void (* PFNGLFRAGMENTLIGHTFVSGIXPROC)(GLenum, GLenum, GLfloat*)’
 typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum 
                            ^
In file included from src/i_video.cc:33:0:
/usr/include/SDL/SDL_opengl.h:4871:103: error: conflicting declaration ‘typedef void (* PFNGLFRAGMENTLIGHTIVSGIXPROC)(GLenum, GLenum, const GLint*)’
 FNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, const GLint *params);
                                                                              ^
In file included from src/i_defs_gl.h:30:0,
                 from src/i_video.cc:21:
/usr/include/GL/glew.h:15761:28: note: previous declaration as ‘typedef void (* PFNGLFRAGMENTLIGHTIVSGIXPROC)(GLenum, GLenum, GLint*)’
 typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum 
                            ^
In file included from src/i_video.cc:33:0:
/usr/include/SDL/SDL_opengl.h:4873:96: error: conflicting declaration ‘typedef void (* PFNGLFRAGMENTLIGHTMODELFVSGIXPROC)(GLenum, const GLfloat*)’
 NTRYP PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, const GLfloat *params);
                                                                              ^
In file included from src/i_defs_gl.h:30:0,
                 from src/i_video.cc:21:
/usr/include/GL/glew.h:15755:28: note: previous declaration as ‘typedef void (* PFNGLFRAGMENTLIGHTMODELFVSGIXPROC)(GLenum, GLfloat*)’
 typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, GL
                            ^
In file included from src/i_video.cc:33:0:
/usr/include/SDL/SDL_opengl.h:4875:94: error: conflicting declaration ‘typedef void (* PFNGLFRAGMENTLIGHTMODELIVSGIXPROC)(GLenum, const GLint*)’
 IENTRYP PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, const GLint *params);
                                                                              ^
In file included from src/i_defs_gl.h:30:0,
                 from src/i_video.cc:21:
/usr/include/GL/glew.h:15757:28: note: previous declaration as ‘typedef void (* PFNGLFRAGMENTLIGHTMODELIVSGIXPROC)(GLenum, GLint*)’
 typedef void (GLAPIENTRY * PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, GL
                            ^
In file included from src/i_video.cc:33:0:
/usr/include/SDL/SDL_opengl.h:4882:104: error: conflicting declaration ‘typedef void (* PFNGLGETFRAGMENTMATERIALFVSGIXPROC)(GLenum, GLenum, GLfloat*)’
 NGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, GLfloat *params);
                                                                              ^
In file included from src/i_defs_gl.h:30:0,
                 from src/i_video.cc:21:
/usr/include/GL/glew.h:15768:28: note: previous declaration as ‘typedef void (* PFNGLGETFRAGMENTMATERIALFVSGIXPROC)(GLenum, GLenum, const GLfloat*)’
 typedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GL
                            ^
In file included from src/i_video.cc:33:0:
/usr/include/SDL/SDL_opengl.h:4883:102: error: conflicting declaration ‘typedef void (* PFNGLGETFRAGMENTMATERIALIVSGIXPROC)(GLenum, GLenum, GLint*)’
 PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, GLint *params);
                                                                              ^
In file included from src/i_defs_gl.h:30:0,
                 from src/i_video.cc:21:
/usr/include/GL/glew.h:15769:28: note: previous declaration as ‘typedef void (* PFNGLGETFRAGMENTMATERIALIVSGIXPROC)(GLenum, GLenum, const GLint*)’
 typedef void (GLAPIENTRY * PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GL
                            ^
src/i_video.cc:60:29: warning: ‘possible_modes’ defined but not used [-Wunused-variable]
 static struct { int w, h; } possible_modes[] =
                             ^
Makefiles/Makefile.linux:275: ошибка выполнения рецепта для цели «obj_linux/edge/i_video.o»
make: *** [obj_linux/edge/i_video.o] Ошибка 1
ryan-sg commented 8 years ago

hmm, kinda different issue than what I'm seeing... can you try this patch as a wild stab?

diff --git a/src/i_video.cc b/src/i_video.cc
index 79479de..c967668 100644
--- a/src/i_video.cc
+++ b/src/i_video.cc
@@ -24,7 +24,7 @@
 #include "GL/wglew.h"
 /// If you don't hardlink under Win32, replace with ---> ^___________________^
 #else
-#include <GL/glew.h>
+//#include <GL/glew.h>
 #endif

 #ifdef MACOSX

I just tried a build myself without GL/glew.h included and it still succeeded (tho succeeds without it commented for me as well)

@Corbachu has an open issue about replacing GLEW, so perhaps this is less needed since the SDL_opengl stuff is included..?

as for why it works for me without commenting out GL/glew.h, perhaps my compiler versions do something a bit different, are you using a really modern gcc by chance? newer than 4.9.3?