Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Papyrus for Real Time » Problem finishing the PingPong tutorial(Compilation errors in generated code.)
Problem finishing the PingPong tutorial [message #1773520] Thu, 28 September 2017 19:02 Go to next message
Michalis Famelis is currently offline Michalis FamelisFriend
Messages: 4
Registered: September 2017
Junior Member
Hello,

I'm new to Papyrus-RT and I've been trying to follow the PingPong tutorial on the wiki:
https://wiki.eclipse.org/Papyrus-RT/User/User_Guide/Getting_Started
I'm having trouble compiling the generated code at the last step and I want to see if that's my fault (e.g. setting up my environment) or there's something in the tutorial that needs to be updated.

I'm using the RCP version. My compilation environment is Windows/Cygwin. I've installed all prerequisites according to this page:
https://wiki.eclipse.org/Papyrus-RT/User_Guide/Cygwin_Setup
I've made sure to use cygwin's cmake, and I don't have MinGW. I'm using cygwin's g++ (GCC) 6.4.0.

At the last step of the tutorial, I used these directions to compile the generated code:
https://wiki.eclipse.org/Papyrus-RT/User_Guide/Compiling_and_running_Papyrus_for_Real_Time_applications#Building_your_applications_on_Windows_with_Cygwin

Then I get the following errors:

/home/user/workspace/papyrusrt/PingPong_CDTProject/src/Pinger.cc: In function 'void instantiate_Pinger(const UMLRTRtsInterface*, UMLRTSlot*, const UMLRTCommsPort**)':
/home/user/workspace/papyrusrt/PingPong_CDTProject/src/Pinger.cc:87:88: error: invalid new-expression of abstract class type 'Capsule_Pinger'
     slot->capsule = new Capsule_Pinger(&Pinger, slot, borderPorts, internalPorts, false);
                                                                                        ^
In file included from /home/user/workspace/papyrusrt/PingPong_CDTProject/src/Pinger.cc:2:0:
/home/user/workspace/papyrusrt/PingPong_CDTProject/src/Pinger.hh:12:7: note:   because the following virtual functions are pure within 'Capsule_Pinger':
 class Capsule_Pinger : public UMLRTCapsule
       ^~~~~~~~~~~~~~
In file included from /home/user/workspace/papyrusrt/PingPong_CDTProject/src/Pinger.hh:6:0,
                 from /home/user/workspace/papyrusrt/PingPong_CDTProject/src/Pinger.cc:2:
/cygdrive/c/Users/user/Downloads/org.eclipse.papyrusrt.rcp.product-win32.win32.x86_64/Papyrus-RT/plugins/org.eclipse.papyrusrt.rts_1.0.0.201707181457/umlrts/include/umlrtcapsule.hh:39:18: note:      virtual void UMLRTCapsule::initialize(const UMLRTMessage&)
     virtual void initialize ( const UMLRTMessage & msg ) = 0;
                  ^~~~~~~~~~
/cygdrive/c/Users/user/Downloads/org.eclipse.papyrusrt.rcp.product-win32.win32.x86_64/Papyrus-RT/plugins/org.eclipse.papyrusrt.rts_1.0.0.201707181457/umlrts/include/umlrtcapsule.hh:40:18: note:      virtual void UMLRTCapsule::inject(const UMLRTMessage&)
     virtual void inject ( const UMLRTMessage & msg ) = 0;
                  ^~~~~~
make[2]: *** [CMakeFiles/TopMain.dir/build.make:111: CMakeFiles/TopMain.dir/Pinger.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:105: CMakeFiles/TopMain.dir/all] Error 2
make: *** [Makefile:84: all] Error 2



Am I doing something wrong or should the tutorial be updated?
Re: Problem finishing the PingPong tutorial [message #1773559 is a reply to message #1773520] Fri, 29 September 2017 11:09 Go to previous messageGo to next message
Peter Cigehn is currently offline Peter CigehnFriend
Messages: 49
Registered: September 2014
Member
It would make it a bit easier to conclude what the problem could be if you attach both the model that you have created following the tutorial, and the generated code from it, e.g. by zipping together both the project with the model and the generated CDT project.

The compilation error itself does not really make sense, since the code-generator should have generated code for those two pure virtual functions that it complains about.

/Peter Cigéhn
Re: Problem finishing the PingPong tutorial [message #1773570 is a reply to message #1773520] Fri, 29 September 2017 14:46 Go to previous messageGo to next message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 438
Registered: March 2011
Senior Member
I just installed everything from scratch in a VM and was able to run the tutorial without problems.

First, to rule things out, did you setup the UMLRTS_ROOT environment variable as described in https://wiki.eclipse.org/Papyrus-RT/User_Guide/Compiling_and_running_Papyrus_for_Real_Time_applications? If so, open the Cygwin terminal and type "echo $UMLRTS_ROOT", and check that it is exactly the one expected. There is a tricky thing in setting this up: If you used Windows-style paths with backslashes and space characters, you will need to escape those. I've added a note titled "Windows paths" to the wiki page above with an example. If the backslashes (and spaces) are not escaped, the path will be incorrect, and the compiler won't be able to find and link the RTS when building.

If you did set UMLRTS_ROOT up correctly attach your model and I'll check to see if it is a model issue.
Re: Problem finishing the PingPong tutorial [message #1773579 is a reply to message #1773520] Fri, 29 September 2017 16:15 Go to previous messageGo to next message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 438
Registered: March 2011
Senior Member
(Michalis sent me the model via e-mail, so I'm attaching it here for anyone else to see)

I checked the model and it seems like the model is correct. I am able to generate code and compile it. However, looking at your generated code, I see that it does fail to compile. It seems like the generator failed to generate code for the capsules' state machines, and this causes the errors you see.

Can you remember the steps that you followed to generate code? Did you right-click on the "Top" capsule and selected "Generate with this capsule as top" or did you select the root element and selected "(Re)Generate all"? Is it possible that you selected "Set as default top capsule" another capsule like Pinger"? Is it possible that you generated code before adding the state machines? (this actually should work too, but I'm trying to rule out possibilities).

Anyway, it looks like you may have stumble into some unknown generation bug. See if you can reproduce it. Delete the generated CDT project and try generating again.
  • Attachment: papyrusrt.zip
    (Size: 19.75KB, Downloaded 137 times)
Re: Problem finishing the PingPong tutorial [message #1773584 is a reply to message #1773570] Fri, 29 September 2017 17:05 Go to previous messageGo to next message
Michalis Famelis is currently offline Michalis FamelisFriend
Messages: 4
Registered: September 2017
Junior Member
I had actually not set up UMLRTS_ROOT. Reading the contents of the page you sent me I'd mistakenly thought I could jump straight to https://wiki.eclipse.org/Papyrus-RT/User_Guide/Compiling_and_running_Papyrus_for_Real_Time_applications#Building_your_applications_on_Windows_with_Cygwin

So, now I've correctly set up UMLRTS_ROOT. And here is g++:

$ g++ --version
g++ (GCC) 6.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

BUT

The problem still persists. I think that before I short-circuited the UMLRTS_ROOT problem with this hack: https://wiki.eclipse.org/index.php?title=Papyrus-RT%2FUser_Guide%2FCompiling_and_running_Papyrus_for_Real_Time_applications&type=revision&diff=419649&oldid=418551

So, I still have the same problem. Looking at the compiler messages, it just seems that the code generator generates the Pinger as abstract, even though it's not declared as such (see the attached model):

Pinger.cc:87:90: error: invalid new-expression of abstract class type 'Capsule_Pinger'


slot->capsule = new Capsule_Pinger( &Pinger, slot, borderPorts, internalPorts, false );

Pinger.hh:12:7: note: because the following virtual functions are pure within 'Capsule_Pinger':
class Capsule_Pinger : public UMLRTCapsule

umlrtcapsule.hh:39:18: note: virtual void UMLRTCapsule::initialize(const UMLRTMessage&)


virtual void initialize ( const UMLRTMessage & msg ) = 0;
^~~~~~~~~~
umlrtcapsule.hh:40:18: note: virtual void UMLRTCapsule::inject(const UMLRTMessage&)
virtual void inject ( const UMLRTMessage & msg ) = 0;

I'm attaching you the model and generated code, just in case I've done something wrong while following the tutorial.
  • Attachment: papyrusrt.zip
    (Size: 19.75KB, Downloaded 162 times)
Re: Problem finishing the PingPong tutorial [message #1773586 is a reply to message #1773584] Fri, 29 September 2017 17:48 Go to previous messageGo to next message
Michalis Famelis is currently offline Michalis FamelisFriend
Messages: 4
Registered: September 2017
Junior Member
Ernesto, I just deleted the generated code project.
I then right clicked on the capsule Top and selected "Generate with this capsule as top".
This must have regenerated the whole thing from scratch.
Then switched to cygwin, went into the generated project, created a folder "build".
Then inside build I ran: cmake ../src
Then still from inside build, I ran: make
And I'm getting the same error.

[Updated on: Fri, 29 September 2017 17:49]

Report message to a moderator

Re: Problem finishing the PingPong tutorial [message #1773588 is a reply to message #1773586] Fri, 29 September 2017 18:12 Go to previous messageGo to next message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 438
Registered: March 2011
Senior Member
Hmm... strange.

A couple of things:

1) can you type in the Cygwin terminal

echo $UMLRTS_ROOT

and report it here?

2) can you try regenerating by deleting the CDT project, and then right-click on the root model element (PingPong) and then selecting "(Re)Generate all code" and see if it gives you the same error?

3) what version of Java do you have?

4) can you go to Help->About Papyrus-RT->Installation Details, unfold Papyrus for Real-Time and expand the Version column to ensure that we see the full version numbers and post it here? Also post the contents of the Configuration tab.

[Updated on: Fri, 29 September 2017 18:24]

Report message to a moderator

Re: Problem finishing the PingPong tutorial [message #1773606 is a reply to message #1773588] Sat, 30 September 2017 02:11 Go to previous messageGo to next message
Michalis Famelis is currently offline Michalis FamelisFriend
Messages: 4
Registered: September 2017
Junior Member
I'll have to check Monday with the work computer.

Meanwhile, at home, I just redid the tutorial and everything compiles perfectly :)

The one difference is that at home I got Papyrus-RT using the Papyrus-RT Installer whereas at the work computer I used the RCP.
Re: Problem finishing the PingPong tutorial [message #1773659 is a reply to message #1773606] Mon, 02 October 2017 14:00 Go to previous message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 438
Registered: March 2011
Senior Member
No problem. In addition to my questions from message 1773588, can you tell me which extraction utility did you use to unzip the RCP? (The standard one included in Windows doesn't always work as expected).
Previous Topic:Creating internal transition in UML-RT?
Next Topic:code generation time
Goto Forum:
  


Current Time: Sun Dec 22 05:48:23 GMT 2024

Powered by FUDForum. Page generated in 0.03642 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top