Page 3 of 3

Re: Linux fix patch

PostPosted: Sun Apr 02, 2017 10:34 pm
by Bart
Sergio: memcpy() issue should be fixed now. Can you try again? It was missing "#include <cstring>". Can you email me the latest working Linux Makefile?

Re: Linux fix patch

PostPosted: Mon Apr 03, 2017 7:45 pm
by sergio-br2
No, you still need to add a #include <cstring> in the Src/ROMSet.h

Also, it should be nice if you put an option to build supermodel against system lib, it's a thing I already told here I think, you'll need that if you want Supermodel on Linux repositories either way. Here the patch (with Makefile.SDL.UNIX.GCC):

Edit: actually, I started the thread with system lib in mind lol. You talked about library changes, I saw that only in tinyxml so far, and all modern linux distro have newer version.

Code: Select all
Index: trunk/Makefiles/Makefile.SDL.UNIX.GCC
===================================================================
--- trunk.orig/Makefiles/Makefile.SDL.UNIX.GCC   2017-04-05 16:04:14.801917056 -0300
+++ trunk/Makefiles/Makefile.SDL.UNIX.GCC   2017-04-05 16:04:28.558147184 -0300
@@ -70,12 +70,16 @@
 # Compiler and Linker
 ###############################################################################
 
+USE_SHARED_MINIZIP ?= 0
+USE_SHARED_GLEW ?= 0
+USE_SHARED_TINYXML ?= 0
+
 CC = gcc
 LD = gcc
 COMPILER_FLAGS = $(SDL_CFLAGS) -ISrc/ -ISrc/OSD/SDL/ -ISrc/Pkgs/ -c -Wall -O3
-CFLAGS = $(COMPILER_FLAGS)
-CPPFLAGS = $(COMPILER_FLAGS) -I$(BOOST_INCLUDEPATH) -std=c++11
-LFLAGS = -o $(OUTFILE) $(SDL_LIBFLAGS) -lGL -lGLU -lz -lm -lstdc++
+CFLAGS += $(COMPILER_FLAGS)
+CPPFLAGS += $(CXXFLAGS) $(COMPILER_FLAGS) -std=c++11
+LFLAGS += -o $(OUTFILE) $(SDL_LIBFLAGS) -lGL -lGLU -lz -lm -lstdc++
 
 #
 # Build options...
@@ -96,9 +100,9 @@
 #
 HEADERS = Src/Supermodel.h Src/Games.h Src/OSD/SDL/Types.h
 OBJ = $(OBJ_DIR)/PPCDisasm.o $(OBJ_DIR)/BlockFile.o $(OBJ_DIR)/93C46.o \
-   $(OBJ_DIR)/unzip.o $(OBJ_DIR)/ioapi.o $(OBJ_DIR)/Error.o $(OBJ_DIR)/glew.o $(OBJ_DIR)/Shader.o \
+   $(OBJ_DIR)/Error.o $(OBJ_DIR)/Shader.o \
    $(OBJ_DIR)/Real3D.o $(OBJ_DIR)/Legacy3D.o $(OBJ_DIR)/Models.o $(OBJ_DIR)/TextureRefs.o \
-   $(OBJ_DIR)/New3D.o $(OBJ_DIR)/Mat4.o $(OBJ_DIR)/Model.o $(OBJ_DIR)/PolyHeader.o $(OBJ_DIR)/Texture.o $(OBJ_DIR)/TextureSheet.o $(OBJ_DIR)/VBO.o $(OBJ_DIR)/Vec.o $(OBJ_DIR)/R3DShader.o $(OBJ_DIR)/R3DFloat.o \
+   $(OBJ_DIR)/New3D.o $(OBJ_DIR)/Mat4.o $(OBJ_DIR)/Model.o $(OBJ_DIR)/PolyHeader.o $(OBJ_DIR)/Texture.o $(OBJ_DIR)/TextureSheet.o $(OBJ_DIR)/VBO.o $(OBJ_DIR)/Vec.o $(OBJ_DIR)/R3DShader.o $(OBJ_DIR)/R3DFloat.o $(OBJ_DIR)/R3DScrollFog.o \
    $(OBJ_DIR)/Render2D.o $(OBJ_DIR)/TileGen.o \
    $(OBJ_DIR)/Model3.o $(OBJ_DIR)/ppc.o $(OBJ_DIR)/Main.o $(OBJ_DIR)/Audio.o $(OBJ_DIR)/Thread.o $(OBJ_DIR)/SoundBoard.o \
    $(OBJ_DIR)/SCSP.o $(OBJ_DIR)/SCSPDSP.o $(OBJ_DIR)/68K.o $(OBJ_DIR)/m68kcpu.o $(OBJ_DIR)/m68kopnz.o $(OBJ_DIR)/m68kopdm.o \
@@ -112,7 +116,11 @@
    $(OBJ_DIR)/amp_util.o \
    $(OBJ_DIR)/Crypto.o \
    $(OBJ_DIR)/Logger.o \
-   $(OBJ_DIR)/Format.o
+   $(OBJ_DIR)/Format.o \
+   $(OBJ_DIR)/NewConfig.o \
+   $(OBJ_DIR)/ByteSwap.o \
+   $(OBJ_DIR)/ConfigBuilders.o \
+   $(OBJ_DIR)/GameLoader.o
 
 # If built-in debugger enabled, include all debugging classes
 ifeq ($(strip $(ENABLE_DEBUGGER)),yes)
@@ -122,6 +130,27 @@
       $(OBJ_DIR)/PPCDebug.o $(OBJ_DIR)/68KDebug.o $(OBJ_DIR)/Musashi68KDebug.o $(OBJ_DIR)/Z80Debug.o      
 endif
 
+ifeq ($(USE_SHARED_GLEW), 1)
+   LFLAGS += -lGLEW
+   COMPILER_FLAGS += -DSHARED_GLEW
+else
+   OBJ += $(OBJ_DIR)/glew.o
+endif
+
+ifeq ($(USE_SHARED_MINIZIP), 1)
+   LFLAGS += -lminizip
+   COMPILER_FLAGS += -DSHARED_MINIZIP
+else
+   OBJ += $(OBJ_DIR)/unzip.o $(OBJ_DIR)/ioapi.o
+endif
+
+ifeq ($(USE_SHARED_TINYXML), 1)
+   LFLAGS += -ltinyxml2
+   COMPILER_FLAGS += -DSHARED_TINYXML
+else
+   OBJ += $(OBJ_DIR)/tinyxml2.o
+endif
+
 #
 # Targets
 #
@@ -219,6 +248,9 @@
 
 $(OBJ_DIR)/%.o:   Src/Pkgs/%.c
    $(CC) $< $(CFLAGS) -o $(OBJ_DIR)/$(*F).o
+
+$(OBJ_DIR)/%.o:   Src/Pkgs/%.cpp
+   $(CXX) $< $(CPPFLAGS) -o $(OBJ_DIR)/$(*F).o
    
 $(OBJ_DIR)/%.o:   Src/Util/%.cpp Src/Util/%.h
    $(CXX) $< $(CPPFLAGS) -o $(OBJ_DIR)/$(*F).o
Index: trunk/Src/Graphics/Legacy3D/Legacy3D.h
===================================================================
--- trunk.orig/Src/Graphics/Legacy3D/Legacy3D.h   2017-04-05 16:04:14.801917056 -0300
+++ trunk/Src/Graphics/Legacy3D/Legacy3D.h   2017-04-05 16:04:14.793916921 -0300
@@ -30,7 +30,11 @@
 #define INCLUDED_LEGACY3D_H
 
 #include "Graphics/IRender3D.h"
+#ifdef SHARED_GLEW
+#include <GL/glew.h>
+#else
 #include "Pkgs/glew.h"
+#endif
 #include "Util/NewConfig.h"
 
 namespace Legacy3D {
Index: trunk/Src/Graphics/New3D/New3D.h
===================================================================
--- trunk.orig/Src/Graphics/New3D/New3D.h   2017-04-05 16:04:14.801917056 -0300
+++ trunk/Src/Graphics/New3D/New3D.h   2017-04-05 16:04:14.793916921 -0300
@@ -28,7 +28,11 @@
 #ifndef INCLUDED_NEW3D_H
 #define INCLUDED_NEW3D_H
 
+#ifdef SHARED_GLEW
+#include <GL/glew.h>
+#else
 #include "Pkgs/glew.h"
+#endif
 #include "Types.h"
 #include "TextureSheet.h"
 #include "Graphics/IRender3D.h"
Index: trunk/Src/Graphics/New3D/R3DShader.h
===================================================================
--- trunk.orig/Src/Graphics/New3D/R3DShader.h   2017-04-05 16:04:14.801917056 -0300
+++ trunk/Src/Graphics/New3D/R3DShader.h   2017-04-05 16:04:14.797916988 -0300
@@ -1,7 +1,11 @@
 #ifndef _R3DSHADER_H_
 #define _R3DSHADER_H_
 
+#ifdef SHARED_GLEW
+#include <GL/glew.h>
+#else
 #include "Pkgs/glew.h"
+#endif
 #include "Model.h"
 
 namespace New3D {
Index: trunk/Src/Graphics/New3D/Texture.h
===================================================================
--- trunk.orig/Src/Graphics/New3D/Texture.h   2017-04-05 16:04:14.801917056 -0300
+++ trunk/Src/Graphics/New3D/Texture.h   2017-04-05 16:04:14.797916988 -0300
@@ -2,7 +2,11 @@
 #define _TEXTURE_H_
 
 #include "Types.h"
+#ifdef SHARED_GLEW
+#include <GL/glew.h>   //arg
+#else
 #include "Pkgs/glew.h"   //arg
+#endif
 
 namespace New3D {
   
Index: trunk/Src/Graphics/New3D/VBO.h
===================================================================
--- trunk.orig/Src/Graphics/New3D/VBO.h   2017-04-05 16:04:14.801917056 -0300
+++ trunk/Src/Graphics/New3D/VBO.h   2017-04-05 16:04:14.797916988 -0300
@@ -1,7 +1,11 @@
 #ifndef _VBO_H_
 #define _VBO_H_
 
+#ifdef SHARED_GLEW
+#include <GL/glew.h>
+#else
 #include "Pkgs/glew.h"
+#endif
 
 namespace New3D {
 
Index: trunk/Src/Graphics/Render2D.cpp
===================================================================
--- trunk.orig/Src/Graphics/Render2D.cpp   2017-04-05 16:04:14.801917056 -0300
+++ trunk/Src/Graphics/Render2D.cpp   2017-04-05 16:04:14.797916988 -0300
@@ -275,7 +275,11 @@
  */
 
 #include <cstring>
+#ifdef SHARED_GLEW
+#include <GL/glew.h>
+#else
 #include "Pkgs/glew.h"
+#endif
 #include "Supermodel.h"
 #include "Graphics/Shaders2D.h" // fragment and vertex shaders
 
Index: trunk/Src/Graphics/Render2D.h
===================================================================
--- trunk.orig/Src/Graphics/Render2D.h   2017-04-05 16:04:14.801917056 -0300
+++ trunk/Src/Graphics/Render2D.h   2017-04-05 16:04:14.797916988 -0300
@@ -28,7 +28,11 @@
 #ifndef INCLUDED_RENDER2D_H
 #define INCLUDED_RENDER2D_H
 
+#ifdef SHARED_GLEW
+#include <GL/glew.h>
+#else
 #include "Pkgs/glew.h"
+#endif
 
 
 /*
Index: trunk/Src/Graphics/Shader.cpp
===================================================================
--- trunk.orig/Src/Graphics/Shader.cpp   2017-04-05 16:04:14.801917056 -0300
+++ trunk/Src/Graphics/Shader.cpp   2017-04-05 16:04:14.797916988 -0300
@@ -44,7 +44,11 @@
 
 #include <new>
 #include <cstdio>
+#ifdef SHARED_GLEW
+#include <GL/glew.h>
+#else
 #include "Pkgs/glew.h"
+#endif
 #include "Supermodel.h"
 
 
Index: trunk/Src/Graphics/Shader.h
===================================================================
--- trunk.orig/Src/Graphics/Shader.h   2017-04-05 16:04:14.801917056 -0300
+++ trunk/Src/Graphics/Shader.h   2017-04-05 16:04:14.797916988 -0300
@@ -28,7 +28,11 @@
 #ifndef INCLUDED_SHADER_H
 #define INCLUDED_SHADER_H
 
+#ifdef SHARED_GLEW
+#include <GL/glew.h>
+#else
 #include "Pkgs/glew.h"
+#endif
 #include <string>
 
 /*
Index: trunk/Src/OSD/SDL/Main.cpp
===================================================================
--- trunk.orig/Src/OSD/SDL/Main.cpp   2017-04-05 16:04:14.801917056 -0300
+++ trunk/Src/OSD/SDL/Main.cpp   2017-04-05 16:04:14.797916988 -0300
@@ -57,7 +57,11 @@
 #include <memory>
 #include <vector>
 #include <algorithm>
+#ifdef SHARED_GLEW
+#include <GL/glew.h>
+#else
 #include "Pkgs/glew.h"
+#endif
 #ifdef SUPERMODEL_OSX
 #include <SDL/SDL.h>
 #else
Index: trunk/Src/Util/ConfigBuilders.cpp
===================================================================
--- trunk.orig/Src/Util/ConfigBuilders.cpp   2017-04-05 16:04:14.801917056 -0300
+++ trunk/Src/Util/ConfigBuilders.cpp   2017-04-05 16:04:14.797916988 -0300
@@ -1,6 +1,10 @@
 #include "Util/NewConfig.h"
 #include "OSD/Logger.h"
+#ifdef SHARED_TINYXML
+#include <tinyxml2.h>
+#else
 #include "Pkgs/tinyxml2.h"
+#endif
 #include <algorithm>
 #include <fstream>
 #include <queue>
Index: trunk/Src/GameLoader.h
===================================================================
--- trunk.orig/Src/GameLoader.h   2017-04-05 16:04:14.801917056 -0300
+++ trunk/Src/GameLoader.h   2017-04-05 16:04:14.797916988 -0300
@@ -2,7 +2,11 @@
 #define INCLUDED_GAMELOADER_H
 
 #include "Util/NewConfig.h"
+#ifdef SHARED_MINIZIP
+#include <minizip/unzip.h>
+#else
 #include "Pkgs/unzip.h"
+#endif
 #include "Game.h"
 #include "ROMSet.h"
 #include <map>



It'll build against Src/Pkgs/ by default, to build against shared libs:

Code: Select all
make -f Makefiles/Makefile.SDL.UNIX.GCC USE_SHARED_GLEW=1 USE_SHARED_MINIZIP=1 USE_SHARED_TINYXML=1

Re: Linux fix patch

PostPosted: Tue Apr 04, 2017 9:17 am
by Bart
I'm not sure that building against system libraries is a good idea. For things like zlib and glew, it's probably fine, but in general, builds should be associated with a particular library version whenever possible, IMHO. This ensures that builds are more consistent and that we don't have to worry about dependencies breaking. I can add this option if you really think it's useful, though.

I prefer Supermodel *not* be included in any Linux packages. Given my limited time, it's too much effort to support (I was getting emails from package maintainers complaining that Supermodel doesn't use the user's home directory correctly for config files, etc., etc., and the package maintainers themselves were getting complaints from users -- it was a mess).

Re: Linux fix patch

PostPosted: Wed Apr 05, 2017 10:37 am
by sergio-br2
Could you at least fix the Makefile for linux? Here, a minimum patch to fix the LINUX build it:

Code: Select all
Index: trunk/Makefiles/Makefile.SDL.UNIX.GCC
===================================================================
--- trunk.orig/Makefiles/Makefile.SDL.UNIX.GCC   2017-04-13 19:06:22.627644768 -0300
+++ trunk/Makefiles/Makefile.SDL.UNIX.GCC   2017-04-13 19:09:15.374281459 -0300
@@ -73,9 +73,9 @@
 CC = gcc
 LD = gcc
 COMPILER_FLAGS = $(SDL_CFLAGS) -ISrc/ -ISrc/OSD/SDL/ -ISrc/Pkgs/ -c -Wall -O3
-CFLAGS = $(COMPILER_FLAGS)
-CPPFLAGS = $(COMPILER_FLAGS) -I$(BOOST_INCLUDEPATH) -std=c++11
-LFLAGS = -o $(OUTFILE) $(SDL_LIBFLAGS) -lGL -lGLU -lz -lm -lstdc++
+CFLAGS += $(COMPILER_FLAGS)
+CPPFLAGS += $(CXXFLAGS) $(COMPILER_FLAGS) -std=c++11
+LFLAGS += -o $(OUTFILE) $(SDL_LIBFLAGS) -lGL -lGLU -lz -lm -lstdc++
 
 #
 # Build options...
@@ -94,11 +94,11 @@
 #
 # Objects and Dependencies
 #
-HEADERS = Src/Supermodel.h Src/Games.h Src/OSD/SDL/Types.h
+HEADERS = Src/Supermodel.h Src/OSD/SDL/Types.h
 OBJ = $(OBJ_DIR)/PPCDisasm.o $(OBJ_DIR)/BlockFile.o $(OBJ_DIR)/93C46.o \
    $(OBJ_DIR)/unzip.o $(OBJ_DIR)/ioapi.o $(OBJ_DIR)/Error.o $(OBJ_DIR)/glew.o $(OBJ_DIR)/Shader.o \
    $(OBJ_DIR)/Real3D.o $(OBJ_DIR)/Legacy3D.o $(OBJ_DIR)/Models.o $(OBJ_DIR)/TextureRefs.o \
-   $(OBJ_DIR)/New3D.o $(OBJ_DIR)/Mat4.o $(OBJ_DIR)/Model.o $(OBJ_DIR)/PolyHeader.o $(OBJ_DIR)/Texture.o $(OBJ_DIR)/TextureSheet.o $(OBJ_DIR)/VBO.o $(OBJ_DIR)/Vec.o $(OBJ_DIR)/R3DShader.o $(OBJ_DIR)/R3DFloat.o \
+   $(OBJ_DIR)/New3D.o $(OBJ_DIR)/Mat4.o $(OBJ_DIR)/Model.o $(OBJ_DIR)/PolyHeader.o $(OBJ_DIR)/Texture.o $(OBJ_DIR)/TextureSheet.o $(OBJ_DIR)/VBO.o $(OBJ_DIR)/Vec.o $(OBJ_DIR)/R3DShader.o $(OBJ_DIR)/R3DFloat.o $(OBJ_DIR)/R3DScrollFog.o \
    $(OBJ_DIR)/Render2D.o $(OBJ_DIR)/TileGen.o \
    $(OBJ_DIR)/Model3.o $(OBJ_DIR)/ppc.o $(OBJ_DIR)/Main.o $(OBJ_DIR)/Audio.o $(OBJ_DIR)/Thread.o $(OBJ_DIR)/SoundBoard.o \
    $(OBJ_DIR)/SCSP.o $(OBJ_DIR)/SCSPDSP.o $(OBJ_DIR)/68K.o $(OBJ_DIR)/m68kcpu.o $(OBJ_DIR)/m68kopnz.o $(OBJ_DIR)/m68kopdm.o \
@@ -112,7 +112,13 @@
    $(OBJ_DIR)/amp_util.o \
    $(OBJ_DIR)/Crypto.o \
    $(OBJ_DIR)/Logger.o \
-   $(OBJ_DIR)/Format.o
+   $(OBJ_DIR)/Format.o \
+   $(OBJ_DIR)/NewConfig.o \
+   $(OBJ_DIR)/ByteSwap.o \
+   $(OBJ_DIR)/ConfigBuilders.o \
+   $(OBJ_DIR)/GameLoader.o \
+   $(OBJ_DIR)/tinyxml2.o \
+   $(OBJ_DIR)/ROMSet.o
 
 # If built-in debugger enabled, include all debugging classes
 ifeq ($(strip $(ENABLE_DEBUGGER)),yes)
@@ -219,7 +225,10 @@
 
 $(OBJ_DIR)/%.o:   Src/Pkgs/%.c
    $(CC) $< $(CFLAGS) -o $(OBJ_DIR)/$(*F).o
-   
+
+$(OBJ_DIR)/%.o:   Src/Pkgs/%.cpp
+   $(CXX) $< $(CPPFLAGS) -o $(OBJ_DIR)/$(*F).o
+
 $(OBJ_DIR)/%.o:   Src/Util/%.cpp Src/Util/%.h
    $(CXX) $< $(CPPFLAGS) -o $(OBJ_DIR)/$(*F).o
 



Src/Graphics/New3D/Model.h needs to be patch as well, because Types.h

Edit: There's a Src/Games.h in the Makefile, should be cleaned as well

Edit 2: Patch updated

Re: Linux fix patch

PostPosted: Wed Apr 05, 2017 11:12 am
by Ian
what if you just remove types.h completely?

Re: Linux fix patch

PostPosted: Wed Apr 05, 2017 11:58 am
by sergio-br2
Ian wrote:what if you just remove types.h completely?


Seems you can safely remove #include "Types.h" from Src/Graphics/New3D/Model.h, at least on Linux.

Re: Linux fix patch

PostPosted: Thu Apr 13, 2017 2:41 pm
by sergio-br2
A lot of undefined references now: https://launchpadlibrarian.net/31548041 ... ING.txt.gz

It's missing $(OBJ_DIR)/ROMSet.o

Btw, could you at least apply this patch? Linux Makefile is broken since a long time ago... viewtopic.php?f=5&t=1156&start=20#p12110

Re: Linux fix patch

PostPosted: Fri Apr 14, 2017 10:08 am
by Bart
You have to include ROMSet.cpp in the build now.

EDIT: just saw your email and have committed your fixed Makefile. Thanks!

Re: Linux fix patch

PostPosted: Sun May 14, 2017 8:23 pm
by sergio-br2
For some reason the importing from svn to bazaar in launchpad started failing since 2017-05-10

https://code.launchpad.net/~random-stuf ... odel-trunk

There will be no updates in the PPA packaging

Are there any git mirror? Launchpad plays nicely with git

Re: Linux fix patch

PostPosted: Sun May 14, 2017 10:43 pm
by Bart
Not yet but I plan to move the entire project to git soon.