Page 1 of 2

Supermodel failing to build

PostPosted: Sun Dec 27, 2020 8:51 am
by Shoegazer
Compiling fails with this message related to SDL_net.

OS: Linux Mint 20 / kernel 5.8
Compiler: gcc 10.2.0
Bad build: r389
Last good build: r384

Re: Supermodel failing to build

PostPosted: Sun Dec 27, 2020 10:19 am
by Ian
Says you are missing sdl_net

Re: Supermodel failing to build

PostPosted: Sun Dec 27, 2020 10:55 am
by Shoegazer
Yes, though sdl-net is not available in the Mint (Ubuntu) repo. The only one there is libsdl-net1.2-dev which is for sdl 1.2 rather than sdl 2.0, so even after installing it, the build fails for these systems,

Re: Supermodel failing to build

PostPosted: Mon Dec 28, 2020 7:51 am
by TheOldDragon
Shoegazer wrote:Yes, though sdl-net is not available in the Mint (Ubuntu) repo. The only one there is libsdl-net1.2-dev which is for sdl 1.2 rather than sdl 2.0, so even after installing it, the build fails for these systems,

I had no problems installing "libsdl2-net-dev" for months on various [plain] Ubuntu systems... and I believe it's still there/supported.
See: https://packages.ubuntu.com/groovy/libsdl2-net-dev

I don't have a system without it already installed, but this is what I get when trying to install on Ubuntu 20.10 [5.10.2 kernel], so it looks like the package is still there. Perhaps just check your spelling?:

Code: Select all
$ sudo apt install libsdl2-net-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libsdl2-net-dev is already the newest version (2.0.1+dfsg1-4).
0 upgraded, 0 newly installed, 0 to remove.

Re: Supermodel failing to build

PostPosted: Mon Dec 28, 2020 10:58 am
by Shoegazer
Ah yes thanks, for some reason "libsdl2-net-dev" didn't show up when I looked the first time. However, that's already installed on this system too:
Code: Select all
$ apt install libsdl2-net-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libsdl2-net-dev is already the newest version (2.0.1+dfsg1-4).

And indeed I have:
Code: Select all
$ ls -la /usr/include/SDL2/SDL_net.h
-rw-r--r-- 1 root root 17488 Oct 19  2018 /usr/include/SDL2/SDL_net.h

So it seems the supermodel code is looking for the library in the wrong place? Not sure how, when line 44 of Src/OSD/SDL/SDLIncludes.h, as indicated by the above error, is simply:
Code: Select all
#include SDL_net.h

Re: Supermodel failing to build

PostPosted: Tue Dec 29, 2020 8:29 am
by TheOldDragon
I checked my system, and that's the only place I have SDL_net.h installed... [/usr/include/SDL2/]

I just downloaded r840 directly from sourceforge.net [as a zip archive] and built from scratch on Ubuntu 20.10.. no issues here...

Do you have the correct makefile sym-linked? i.e.
Code: Select all
$ ln -s ./Makefiles/Makefile.UNIX ./Makefile


I just have to do that, and then a
Code: Select all
make -j12 NET_BOARD=1

and everything complies with no issues...
[I also did an "svn up" on a r834 pull to update it to r840, and that compiles fine too]

Maybe use apt to purge libsdl2-net-dev and then re-install?..

Re: Supermodel failing to build

PostPosted: Tue Dec 29, 2020 11:41 am
by Shoegazer
First, thanks for your help with this TheOldDragon.

I do have the correct UNIX makefile sym-linked. I also tried purging and reinstalling libsdl2-net-dev, but the resulting SDL_net.h was the same from the ls output, and predictably the build still failed.

However, as a test I changed line 44 in Src/OSD/SDL/SDLIncludes.h as follows:

Code: Select all
From: #include <SDL_net.h>
To: #include </usr/include/SDL2/SDL_net.h>


Supermodel builds successfully with this change. This raises the question of why the system suddenly can't see this header file. How does the build process find the correct file when the original line 44 just includes <SDL_net.h> without an absolute path, does it rely on something in the path environment variable that's no longer there? I assume anyone with an updated Linux Mint will run into this issue eventually.

Also note: I tried building from r834 which had previously compiled, but now it doesn't, so this must be related to some change on this system rather than supermodel itself. I had not changed the system at all, so I assume something done by the Linux Mint update process caused this.

Re: Supermodel failing to build

PostPosted: Tue Dec 29, 2020 12:24 pm
by Bart
Would it work if you just had:

Code: Select all
#include <SDL2/SDL_net.h>


?

Also, what is the output of these two commands:

Code: Select all
sdl2-config --cflags
sdl2-config --libs


?

The UNIX Makefile uses sdl2-config to locate SDL2.

Re: Supermodel failing to build

PostPosted: Tue Dec 29, 2020 1:07 pm
by Shoegazer
Thanks, Bart. Actually yes, #include <SDL2/SDL_net.h> worked. Can/should that change be made to supermodel's code?

Outputs:

Code: Select all
$ sdl2-config --cflags
-I/usr/local/include/SDL2 -D_REENTRANT

$ sdl2-config --libs
-L/usr/local/lib -Wl,-rpath,/usr/local/lib -Wl,--enable-new-dtags -lSDL2

Interesting. Why all of a sudden /usr/local/include rather than /usr/include? This must have changed recently because again, supermodel compiled successfully without any changes with r834 earlier this month.

Re: Supermodel failing to build

PostPosted: Thu Dec 31, 2020 1:09 pm
by Bart
Shoegazer wrote:Thanks, Bart. Actually yes, #include <SDL2/SDL_net.h> worked. Can/should that change be made to supermodel's code?

Outputs:

Code: Select all
$ sdl2-config --cflags
-I/usr/local/include/SDL2 -D_REENTRANT

$ sdl2-config --libs
-L/usr/local/lib -Wl,-rpath,/usr/local/lib -Wl,--enable-new-dtags -lSDL2

Interesting. Why all of a sudden /usr/local/include rather than /usr/include? This must have changed recently because again, supermodel compiled successfully without any changes with r834 earlier this month.


Wait a minute -- sdl2-config is pointing to /usr/local/include, which seems right, whereas you had it in /usr/include, which does not seem correct. What's going on? Did you change something or manually install SDL2? My guess is that you unintentionally b0rked your SDL2 installation. Could it also be that you have multiple SDL2 installations around, with the wrong sdl2-config being picked up when you run that command?