Newbie help

Discussion around programming R'n'D, its source code and its tools.

Moderators: Zomis, Flumminator

Post Reply
NLS
Posts: 9
Joined: Thu Apr 14, 2016 1:13 pm

Newbie help

Post by NLS » Thu Apr 14, 2016 1:23 pm

Since I cannot find a fresh build, I am trying to compile it myself on Windows, but I have been too long away from development so I am still trying to find my way around.

I have a mingw64 (msys64) environment.
I *believe* I have sdl2 already installed, but "build run" produces this:

Code: Select all

make[1]: Entering directory 'D:/Development/Code/rocksndiamonds/src'
The system cannot find the path specified.
The system cannot find the path specified.
makefile:68: *** SDL/SDL2 library not found.  Stop.
make[1]: Leaving directory 'D:/Development/Code/rocksndiamonds/src'
makefile:65: recipe for target 'all' failed
make: *** [all] Error 2
...could someone guide me through this?

User avatar
Holger
Site Admin
Posts: 3225
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: Newbie help

Post by Holger » Thu Apr 14, 2016 7:27 pm

Hello NLS, welcome to the (programming) forum! :-)

The reason for the error message is that the Makefile (file "src/Makefile") cannot find one of the commands "sdl2-config" (which is checked first) or "sdl-config".

If you start compilation from a shell (it looks like this), please try if you can manually execute this program (which is used to output the system specific paths to include files and libraries, which may vary from installation to installation). For example, can you execute "sdl2-config --version"? Apparently this does not work, so the Makefile is unable to find out where the headers and other stuff needed for compiling against SDL2 (or SDL) can be found.

So please have a look if SDL/SDL2 is correctly installed, or if these configuration scripts do exist at all for Windows.

NLS
Posts: 9
Joined: Thu Apr 14, 2016 1:13 pm

Re: Newbie help

Post by NLS » Thu Apr 14, 2016 7:40 pm

I am not on that computer right now (I'll get back to you tomorrow), but I can tell you that those commands do NOT work (are they actual executables? I'll try to find them in the system).
So you would say that SDL2 is not installed. Well it is, because when I use "pacman" to install SDL2 packages, it tells me they are in and if I want to re-install them (which I have done too).
Weird...

I'll check it out tomorrow and give more details if I can.
Thanks.

User avatar
Holger
Site Admin
Posts: 3225
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: Newbie help

Post by Holger » Thu Apr 14, 2016 8:50 pm

I can tell you that those commands do NOT work (are they actual executables? I'll try to find them in the system).
On Linux, they are Bash shell scripts installed under "/usr/local/bin" (if compiled and installed from source with default settings).
So you would say that SDL2 is not installed. Well it is, because when I use "pacman" to install SDL2 packages, it tells me they are in and if I want to re-install them (which I have done too).
Well, I don't say that SDL2 is not installed. But now that I think a bit more about it, it may be possible that you have only installed the run-time SDL2 packages, but not the development packages. Check if you can find SDL2 packages with the same name as those that you have already installed, but with an additional trailing "-dev". These would then be the development packages, containing not only the configuration scripts, but also the include files and development libraries (which are also not contained in the run-time library packages).

Update: I just had a look into the Windows SDL2 development packages, and indeed they contain the config scripts at the following location in the package archive: "SDL2-2.0.3/x86_64-w64-mingw32/bin/sdl2-config". Maybe this helps checking if you have everything installed to be ready to compile SDL2 applications.

NLS
Posts: 9
Joined: Thu Apr 14, 2016 1:13 pm

Re: Newbie help

Post by NLS » Thu Apr 14, 2016 9:13 pm

Thanks, will get back to you tomorrow that I'll check.

Maybe you can help with my other post here in the meantime? :)
viewtopic.php?f=3&t=2207

filbo
Posts: 358
Joined: Fri Jun 20, 2014 10:06 am

Re: Newbie help

Post by filbo » Thu Apr 14, 2016 10:09 pm

Ubuntu has separate packages libsdl2 (which lets you install and run programs that use SDL2), and libsdl2-dev (needed to build such packages from source). I don't know what mingw packaging is like, but this sort of runtime-vs-dev package split is fairly common.

User avatar
Holger
Site Admin
Posts: 3225
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: Newbie help

Post by Holger » Fri Apr 15, 2016 12:32 am

Maybe you can help with my other post here in the meantime? :)
Done! :-)

NLS
Posts: 9
Joined: Thu Apr 14, 2016 1:13 pm

Re: Newbie help

Post by NLS » Fri Apr 15, 2016 7:00 am

OK, searching in the tree that my dev environment has, I found these...
sdl2-config.JPG
sdl2-config.JPG (61.14 KiB) Viewed 6820 times
rocksndiamonds folder is in D:\Development\msys64\src

I guess I should somehow call sdl2-config with full path OR add it to system path...
We'll see.

My dev environment is a mess as I had many years out of development and now I am getting back to C++ (and/or Java) for the heck of it, have VS2k15 (IDE is fine but then I am lost), I have Eclipse, msys64, cygwin64 - all probably messing with each other. :( Need to clean things up.

Bonus question: RnD can be compiled x64 too?

EDIT: Definitely a path issue. There are some pre-made bat files that set things up, the one I used to call (comes from... MAME build tools - I told you things are messed up) didn't set the path properly to "see" sdl2-config.
Unfortunately the batch files that do (and pass the SDL2 check) make other errors:

Code: Select all

$ make all
make[1]: Entering directory '/src/rocksndiamonds/src'
make[2]: Entering directory '/src/rocksndiamonds/src/libgame'
gcc  -DDEBUG -g -Wall                    -DTARGET_SDL2 -I/mingw64/include/SDL2 -Dmain=SDL_main       -c system.c
In file included from D:/Development/msys64/mingw64/x86_64-w64-mingw32/include/wtypes.h:8:0,
                 from D:/Development/msys64/mingw64/x86_64-w64-mingw32/include/winscard.h:10,
                 from D:/Development/msys64/mingw64/x86_64-w64-mingw32/include/windows.h:97,
                 from D:/Development/msys64/mingw64/x86_64-w64-mingw32/include/rpc.h:16,
                 from D:/Development/msys64/mingw64/x86_64-w64-mingw32/include/wtypesbase.h:7,
                 from D:/Development/msys64/mingw64/x86_64-w64-mingw32/include/shlobj.h:9,
                 from windows.h:15,
                 from system.h:22,
                 from system.c:17:
D:/Development/msys64/mingw64/x86_64-w64-mingw32/include/rpcndr.h:65:25: error: conflicting types for 'boolean'
   typedef unsigned char boolean;
                         ^
In file included from system.h:16:0,
                 from system.c:17:
types.h:21:13: note: previous declaration of 'boolean' was here
 typedef int boolean;
             ^
In file included from system.h:27:0,
                 from system.c:17:
sdl.h:18:21: fatal error: SDL_net.h: No such file or directory
compilation terminated.
Makefile:58: recipe for target 'system.o' failed
make[2]: *** [system.o] Error 1
make[2]: Leaving directory '/src/rocksndiamonds/src/libgame'
Makefile:223: recipe for target 'libgame_dir' failed
make[1]: *** [libgame_dir] Error 2
make[1]: Leaving directory '/src/rocksndiamonds/src'
Makefile:65: recipe for target 'all' failed
make: *** [all] Error 2

User avatar
Holger
Site Admin
Posts: 3225
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: Newbie help

Post by Holger » Sat Apr 16, 2016 8:22 am

Bonus question: RnD can be compiled x64 too?
Yes, R'n'D should work just fine when compiled for 64 bit systems.

I'm just using the 32 bit version for the Windows build for compatibility with existing 32 bit Windows systems (as it works with both 32 and 64 bit Windows systems).
Unfortunately the batch files that do (and pass the SDL2 check) make other errors:
...
conflicting types for 'boolean'
Apparently the Windows platform is not correctly detected. You could try to uncomment the line "typedef int boolean" from file "src/libgame/types.h", but you will then probably run into other errors.

The reason why your Windows platform is not correctly detected is probably this piece of code in "src/libgame/platform.h":

Code: Select all

#if defined(WIN32) || defined(_WIN32)
#define PLATFORM_WIN32
#define PLATFORM_STRING "Windows"
#else
#define PLATFORM_UNIX
#define PLATFORM_STRING "Unix"
#endif
As you are using a 64 bit system, this apparently fails because only preprocessor symbols/defines/macros for 32 bit systems are checked. This should be fixed.

Could you please try the following command in your Cygwin shell?:

Code: Select all

$ touch foo.h; /path/to/cpp -dM foo.h | grep -i win
Please replace the "/path/to/cpp" with the actual path to "cpp" (the C preprocessor binary) on your system. You should probably be able to find it with "which cpp" (and could then simply use "cpp" instead of "/path/to/cpp").

This should give a list of all preprocessor definitions which include the string "win"; for example, on my cross-compiler setup, I get the following output:

Code: Select all

#define __WINNT 1
#define __WINNT__ 1
#define __WIN32__ 1
#define _WIN32 1
#define WIN32 1
#define __WINT_TYPE__ short unsigned int
#define __WIN32 1
#define WINNT 1
So maybe I only have to add "WIN64" and/or "_WIN64" to that line in "src/libgame/platform.h". You could also try just that and see if it helps!

(The name of the following R'n'D internal preprocessor definition of "PLATFORM_WIN32" could be left unchanged and should not hurt, although I should probably change this to "PLATFORM_WINDOWS" all over the R'n'D code maybe.)

Please let me know it this fixes the problem, and I will change it in my code base, too.

User avatar
Holger
Site Admin
Posts: 3225
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: Newbie help

Post by Holger » Sat Apr 16, 2016 8:28 am

Just found out that apparently "_WIN32" should be defined for both 32 bit and 64 bit systems, while "_WIN64" should only be defined for 64 bit systems. So theoretically the current R'n'D Windows platform detection should also work on 64 bit Windows.

So I'm curious about your own observations...

User avatar
Holger
Site Admin
Posts: 3225
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: Newbie help

Post by Holger » Sat Apr 16, 2016 8:31 am

Last thing: Try the following patch to "src/libgame/types.h":

Code: Select all

--- a/src/libgame/types.h
+++ b/src/libgame/types.h
@@ -18,9 +18,9 @@
 #include <string.h>
 #include <sys/types.h>
 
-typedef int boolean;
 
 #if !defined(PLATFORM_WIN32)
+typedef int boolean;
 typedef unsigned char byte;
 #endif
That should fix it.

NLS
Posts: 9
Joined: Thu Apr 14, 2016 1:13 pm

Re: Newbie help

Post by NLS » Sat Apr 16, 2016 11:27 am

Will check on Monday. Thanks.

NLS
Posts: 9
Joined: Thu Apr 14, 2016 1:13 pm

Re: Newbie help

Post by NLS » Tue May 03, 2016 5:05 pm

Hi Holger, sorry very busy days (and a #2 son that is now 2 months old). I will check what you are saying in the next few days hopefully.

But I am glad that my "push" for you to release a new compiled version, has also awaken many friends of the project (and hopefully "push" you back to full active :D)...

Post Reply