Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error building Snake example #11

Open
Stiivi opened this issue Dec 6, 2020 · 3 comments
Open

Error building Snake example #11

Stiivi opened this issue Dec 6, 2020 · 3 comments

Comments

@Stiivi
Copy link

Stiivi commented Dec 6, 2020

When running make in the Snake example the following build error occurs:

[...]Terminal.cpp:38:10: fatal error: 'vmobjects/VMObject.h' file not
      found
#include <vmobjects/VMObject.h>
         ^~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [Terminal.csp] Error 1

When I change the ROOT_DIR in the Makefile to point into the correct src path:

ROOT_DIR    ?= $(PWD)/../../..  

I am getting:

g++ -Wno-endif-labels -O2  -I/Users/stefan/Developer/Sources/SOMpp/core-lib/Examples/Snake/../../../src -enable-auto-import -L/Use
rs/stefan/Developer/Sources/SOMpp/core-lib/Examples/Snake/../../.. -shared -g \
                /Users/stefan/Developer/Sources/SOMpp/core-lib/Examples/Snake/Terminal.cpp -o Terminal.csp 
In file included from /Users/stefan/Developer/Sources/SOMpp/core-lib/Examples/Snake/Terminal.cpp:38:
In file included from /Users/stefan/Developer/Sources/SOMpp/core-lib/Examples/Snake/../../../src/vmobjects/VMObject.h:33:
/Users/stefan/Developer/Sources/SOMpp/core-lib/Examples/Snake/../../../src/vmobjects/AbstractObject.h:78:41: error: unknown type
      name 'HEAP_CLS'
    void* operator new(size_t numBytes, HEAP_CLS* heap,
                                        ^
/Users/stefan/Developer/Sources/SOMpp/core-lib/Examples/Snake/../../../src/vmobjects/AbstractObject.h:79:47: error: unexpected end
      of default argument expression
            unsigned long additionalBytes = 0 ALLOC_OUTSIDE_NURSERY_DECL) {
                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /Users/stefan/Developer/Sources/SOMpp/core-lib/Examples/Snake/Terminal.cpp:38:
/Users/stefan/Developer/Sources/SOMpp/core-lib/Examples/Snake/../../../src/vmobjects/VMObject.h:96:41: error: unknown type name
      'HEAP_CLS'
    void* operator new(size_t numBytes, HEAP_CLS* heap, unsigned long additionalBytes = 0 ALLOC_OUTSIDE_NURSERY_DECL) {
                                        ^
/Users/stefan/Developer/Sources/SOMpp/core-lib/Examples/Snake/../../../src/vmobjects/VMObject.h:96:91: error: unexpected end of
      default argument expression
    void* operator new(size_t numBytes, HEAP_CLS* heap, unsigned long additionalBytes = 0 ALLOC_OUTSIDE_NURSERY_DECL) {
                                                                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
[... more errors ...]

fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [Terminal.csp] Error 1

What might be wrong?

@smarr
Copy link
Member

smarr commented Dec 6, 2020

I fear, that Snake extension hasn't received any love, likely since 2012.
So, the build system isn't matching anymore what SOM++ does at the moment.
Especially the switch to CMake has likely consequences.

The ROOT_DIR is probably a good start.
But there might be the assumption that it is called from another Makefile, the one for SOM++.

And there might also be further linking issues down the road: https://github.com/SOM-st/SOM/blob/5eac3287df98d54a72e4f04e0f8b5f53077da9a2/Examples/Snake/Makefile#L32

The concrete errors you see are very likely a consequence of some configuration not being set as expected.
The SOM++ build system configures for instance the type of GC and other details, which here isn't really incorporated.

I doubt I'll find the time to look into this in more detail today.
But I can probably give more pointers if you feel like taking a stab at it.

@Stiivi
Copy link
Author

Stiivi commented Dec 6, 2020

If that is the case, that it needs more time to fix it, I don't necessarily need to run the Snake example. I am just looking at any example that shows how SOMpp can be used as a library or as a module.

@smarr
Copy link
Member

smarr commented Dec 6, 2020

Hm, the Snake example is more of an example to demonstrate how the SOM++ interpreter can be extended with "primitives".

The Terminal.som file uses for instance getChar = primitive to read user input. (It's a small game for the terminal)
https://github.com/SOM-st/SOM/blob/5eac3287df98d54a72e4f04e0f8b5f53077da9a2/Examples/Snake/Terminal.som#L54

I haven't tried using SOM++ as library embedded into another application before.
While it is a reasonably small interpreter, no efforts have been made so far, to make embedding particularly easy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants