Open Surge Forum

A fun 2D retro platformer inspired by Sonic games and a game creation system

You are not logged in.

Announcement

Our community has moved to Discord! https://discord.gg/w8JqM7m

#1 2018-10-09 20:41:25

MirceaKitsune
Member
From: Romania, Bucharest
Registered: 2015-08-03
Posts: 25

GIT: Cannot point OpenSurge to Surgescript sources

Hey there! Been a while. I figured I'd try compiling the latest version of the project again, happy that it's not dead despite hearing no recent progress. I cloned the latest version from Github, but there are some major issues with at least compiling on Linux. The repos I use are:

https://github.com/alemart/opensurge
https://github.com/alemart/surgescript

Essentially there doesn't seem to be any working way to tell OpenSurge where Surgescript is located. I already cloned both repos and successfully compiled libsurgescript, which I then pointed to in the LSURGESCRIPT cmake parameter. No matter what I set anything to, it quickly fails with the following error:

[  1%] Building C object CMakeFiles/opensurge.dir/src/core/engine.c.o
In file included from /home/mircea/Games/OpenSurge/OpenSurge_GIT/src/core/engine.c:54:
/home/mircea/Games/OpenSurge/OpenSurge_GIT/src/core/../scripting/scripting.h:24:10: fatal error: surgescript.h: No such file or directory
 #include <surgescript.h>
          ^~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/opensurge.dir/build.make:102: CMakeFiles/opensurge.dir/src/core/engine.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/opensurge.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

I tried to symlink the surgescript src directory across the OpenSurge src directory, hoping it would detect one of the paths... nothing though. I don't wish to use "make install" as I prefer to keep everything portable, so I'm looking to make the OpenSurge cmake file see the Surgescript source directory from where it's located on my drive. How do I solve this please?

Offline

#2 2018-10-09 21:33:09

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,279
Website

Re: GIT: Cannot point OpenSurge to Surgescript sources

Hello,

Running make install for surgescript would be indeed the solution. Since you need portability, you can set the DCMAKE_INSTALL_PREFIX=/path/to/install variable when calling cmake, as described in https://github.com/alemart/surgescript . Then, make install normally.

After installing surgescript on your custom path, you'll need to compile opensurge. Tell CMake about the new include folder, and also where it can find libsurgescript.a. I haven't tried it myself, but you can try messing with CMake variables CFLAGS, CMAKE_LIBRARY_PATH, CMAKE_INCLUDE_PATH. See if this helps.

MirceaKitsune wrote:

Essentially there doesn't seem to be any working way to tell OpenSurge where Surgescript is located.

We can include a variable like SURGESCRIPT_PATH, but see if the above works for you for the time being.

Offline

#3 2018-10-09 22:45:43

MirceaKitsune
Member
From: Romania, Bucharest
Registered: 2015-08-03
Posts: 25

Re: GIT: Cannot point OpenSurge to Surgescript sources

Alexandre wrote:

Hello,

Running make install for surgescript would be indeed the solution. Since you need portability, you can set the DCMAKE_INSTALL_PREFIX=/path/to/install variable when calling cmake, as described in https://github.com/alemart/surgescript . Then, make install normally.

After installing surgescript on your custom path, you'll need to compile opensurge. Tell CMake about the new include folder, and also where it can find libsurgescript.a. I haven't tried it myself, but you can try messing with CMake variables CFLAGS, CMAKE_LIBRARY_PATH, CMAKE_INCLUDE_PATH. See if this helps.

MirceaKitsune wrote:

Essentially there doesn't seem to be any working way to tell OpenSurge where Surgescript is located.

We can include a variable like SURGESCRIPT_PATH, but see if the above works for you for the time being.

I tried messing around with the variables described, but nothing seems to make the error go away. I could 'make install' surgescript to a custom directory, but opensurge doesn't seem to want to see it no matter how I run cmake / make. If it's not a problem, I would indeed go with having a SURGESCRIPT_PATH parameter to make this less of an issue to set up.

Offline

#4 2018-10-09 23:38:20

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,279
Website

Re: GIT: Cannot point OpenSurge to Surgescript sources

Before we tackle this, let's check the other dependencies. Have you installed the other libraries (alfont, etc) locally or have you picked a system-wide install for them? If locally, have you solved the include path for <alfont.h>?

If you're installing all libs locally, it might help to mess with CMAKE_FIND_ROOT_PATH, as described in the cross-compiling section of the wiki: http://opensnc.sourceforge.net/wiki/ind … Open_Surge

Also, before you mess with any variables, please make sure to clean your build (rm -rf build/)

Please let us know about the results you get.

Offline

#5 2018-10-09 23:58:56

MirceaKitsune
Member
From: Romania, Bucharest
Registered: 2015-08-03
Posts: 25

Re: GIT: Cannot point OpenSurge to Surgescript sources

Alexandre wrote:

Before we tackle this, let's check the other dependencies. Have you installed the other libraries (alfont, etc) locally or have you picked a system-wide install for them? If locally, have you solved the include path for <alfont.h>?

If you're installing all libs locally, it might help to mess with CMAKE_FIND_ROOT_PATH, as described in the cross-compiling section of the wiki: http://opensnc.sourceforge.net/wiki/ind … Open_Surge

Also, before you mess with any variables, please make sure to clean your build (rm -rf build/)

Please let us know about the results you get.

cmake seems to find all other libraries just fine. surgescript is the only exception as my distribution (openSUSE Tumbleweed x64) doesn't provide it as a system package in any of the repositories (it does however provide the latest OpenSurge release but that's older than Git master). I had to introduce its path manually but from what I understand pointing to the generated libsurgescript.a file should work... I didn't yet test that part as the build process fails before it gets anywhere close to the linking process.

9etjQ3e.png

Offline

#6 2018-10-10 01:02:16

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,279
Website

Re: GIT: Cannot point OpenSurge to Surgescript sources

Okay, so I suggest you activate the advanced mode of the CMake GUI and set variable CMAKE_C_FLAGS to

-I/home/mircea/Games/OpenSurge/Deps/surgescript_GIT/src/

or to -I<path-to-folder-containing-surgescript.h-file> (where you have installed surgescript)

and start the build process all over again.

Offline

#7 2018-10-10 12:23:32

MirceaKitsune
Member
From: Romania, Bucharest
Registered: 2015-08-03
Posts: 25

Re: GIT: Cannot point OpenSurge to Surgescript sources

Alexandre wrote:

Okay, so I suggest you activate the advanced mode of the CMake GUI and set variable CMAKE_C_FLAGS to

-I/home/mircea/Games/OpenSurge/Deps/surgescript_GIT/src/

or to -I<path-to-folder-containing-surgescript.h-file> (where you have installed surgescript)

and start the build process all over again.

Oh my... that actually did it. Thank you, it works this way so I guess I'll stick with that option smile

Only one more compile error now, also due to surgescript. It's at 100% (linking phase): Apparently it doesn't like my libsurgescript.a library. Is there a special parameter when compiling Surgescript to make it generate a dynamic .so instead?

[100%] Linking C executable ../opensurge
/usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: cannot find -lsurgescript
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/opensurge.dir/build.make:1693: ../opensurge] Error 1
make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/opensurge.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

Offline

#8 2018-10-10 15:49:38

Alexandre
Administrator
From: Brazil
Registered: 2009-01-27
Posts: 3,279
Website

Re: GIT: Cannot point OpenSurge to Surgescript sources

MirceaKitsune wrote:

Only one more compile error now, also due to surgescript. It's at 100% (linking phase): Apparently it doesn't like my libsurgescript.a library. Is there a special parameter when compiling Surgescript to make it generate a dynamic .so instead?

A similar approach should work. Set CMAKE_EXE_LINKER_FLAGS to

-L/path/to/folder/containing/libsurgescript.a/file (where you installed the library)

Please share your results with us smile

Offline

#9 2018-10-10 17:21:49

svgmovement
Member
Registered: 2011-11-24
Posts: 209

Re: GIT: Cannot point OpenSurge to Surgescript sources

On this note, I would suggest the following changes to CMake:

  • Instead of linking with surgescript, link with "${LSURGESCRIPT}", like this:

TARGET_LINK_LIBRARIES(${GAME_UNIXNAME} ${AUDIO_LIBS} ${LSURGESCRIPT} jpgalleg loadpng alfont alleg png z)
  • Use a FIND_PATH command to detect the include path for surgescript.

FIND_PATH(SURGESCRIPT_INCLUDE NAMES "surgescript.h")

Although these commands likely won't find an uninstalled surgescript automatically, the commands should produce cache variables that can be edited from the CMake GUI. However, I am not able to test those CMake commands at the moment.


-- svgmovement

Offline

#10 2018-10-10 18:14:10

MirceaKitsune
Member
From: Romania, Bucharest
Registered: 2015-08-03
Posts: 25

Re: GIT: Cannot point OpenSurge to Surgescript sources

Alexandre wrote:
MirceaKitsune wrote:

Only one more compile error now, also due to surgescript. It's at 100% (linking phase): Apparently it doesn't like my libsurgescript.a library. Is there a special parameter when compiling Surgescript to make it generate a dynamic .so instead?

A similar approach should work. Set CMAKE_EXE_LINKER_FLAGS to

-L/path/to/folder/containing/libsurgescript.a/file (where you installed the library)

Please share your results with us smile

That solved it, now it's successfully compiled. Thanks! For anyone else who runs into this issue in the future, here's how you must call cmake, assuming you've compiled surgescript with a simple 'make' (no install) which generated libsurgescript.a in its local directory:

cmake -DCMAKE_C_FLAGS=-I/path_to_surgescript/src -DCMAKE_EXE_LINKER_FLAGS=-L/path_to_surgescript -DLSURGESCRIPT=/path_to_surgescript/libsurgescript.a path_to_opensurge

Offline

Board footer

Powered by FluxBB  hosted by tuxfamily.org