pmurcutt Posted May 30, 2012 Posted May 30, 2012 Hello Delta Tau Forums, We're currently looking into using A Power PMAC system, however one of the things that we would like to achieve with it would be to deploy an existing C++ application to the device, accessing the shared/user memory. A look at the IDE & documentation suggest that it only handles C, but would compiling our project targeting the PowerPC architecture, then placing the application in the "C language/Background Programs" directory (changing the extension & modifying the pp_proj.ini file) be a feasible option? (apologies if this has been asked before but you can't search for c++/cpp)
bradp Posted May 30, 2012 Posted May 30, 2012 Our IDE only handles C. But you can use the GNU++ compiler externally and build C++ apps for the Power PMAC as much as you want. It can call the same API we use from our Capps and access shared memory and so forth. You just need to manage how your C++ code gets loaded to the PPmac and merged with an IDE project that might also get loaded.
shansen Posted June 1, 2012 Posted June 1, 2012 pmurcutt - If you're looking for a C++ capable IDE, I've had good success using Eclipse CDT for both C and C++ on the Power PMAC. You can even use the Remote Systems plugin to automatically download your executables after a build, so it's pretty seamless. YMMV.
MClement Posted June 1, 2012 Posted June 1, 2012 Can you elaborate on how you setup your Eclipse IDE to compile for PPMAC and automatically download? It would be very helpful to us. Thanks pmurcutt - If you're looking for a C++ capable IDE, I've had good success using Eclipse CDT for both C and C++ on the Power PMAC. You can even use the Remote Systems plugin to automatically download your executables after a build, so it's pretty seamless. YMMV.
shansen Posted June 1, 2012 Posted June 1, 2012 @MClement: I've just been using Eclipse CDT, in addition to the RSE plugin. Here is how my IDE is setup: 1) Windows 7 with Eclipse CDT and MinGW installed 2) My Eclipse projects are built using DT's cross-compiler (powerpc-405-linux-gnu-gcc/g++) and linked to the DT provided PPMAC libraries. NOTE: I did have to upgrade the version of 'make' (the version provided by DT isn't completely compatible with Eclipse for some reason) 3) Eclipse automatically generates the makefiles as part of the build process 4) RSE lets you create remote targets and build groups. For example, I have one build group that builds all of my projects and downloads them to the correct location on the PPMAC when finished. 5) RSE also provides pretty convenient telnet terminal(s) for debugging + starting and stopping apps 6) The Eclipse debugger CAN debug remotely, but it requires upgrading the PPMAC from Lenny to Squeeze (so you can install gdbserver on the PPMAC). I haven't taken it this far, but plan to do so in the future. If you have any specific questions, let me know. It took a little bit to get everything working, but it is almost completely seamless the way I have it set up now. As a side note, using Eclipse for PPMAC development is definitely not for everyone! For example, I cannot do motion programs or PLCs in Eclipse (I haven't tried it at least). However, Eclipse does let you create your own project structure, and the more advanced intellisense, auto-coloring, and refactoring support is great! Plus, you can build and download applications and libraries individually, which (last I checked) you cannot do with the vanilla DT IDE.
pmurcutt Posted June 13, 2012 Author Posted June 13, 2012 Thanks for all of the feedback, it's encouraging to know that there is a precedent for this approach. shansen, a quick set-up guide for eclipse would be quite convenient (if you have it?)
shansen Posted June 13, 2012 Posted June 13, 2012 pmurcutt: I have already written a quick setup guide on using Eclipse for PPMAC development, but it isn't fully completed yet. Seeing as you and several other individuals have asked me for something similar, I will try to clean it up and get it to a workable state (maybe by next week)? It depends on my workload... The main thing is getting Eclipse setup to use the cross-compiler and then linking the correct libraries. The rest is cake!
piefum Posted October 10, 2014 Posted October 10, 2014 Hi shansen and all I am starting now to build for my first standalone C application for the PMAC. It this guide still true? Do you have any new hints or should I follow straightforward these steps? Many thanks for your guide! Bests gigi @MClement: I've just been using Eclipse CDT, in addition to the RSE plugin. Here is how my IDE is setup: 1) Windows 7 with Eclipse CDT and MinGW installed 2) My Eclipse projects are built using DT's cross-compiler (powerpc-405-linux-gnu-gcc/g++) and linked to the DT provided PPMAC libraries. NOTE: I did have to upgrade the version of 'make' (the version provided by DT isn't completely compatible with Eclipse for some reason) 3) Eclipse automatically generates the makefiles as part of the build process 4) RSE lets you create remote targets and build groups. For example, I have one build group that builds all of my projects and downloads them to the correct location on the PPMAC when finished. 5) RSE also provides pretty convenient telnet terminal(s) for debugging + starting and stopping apps 6) The Eclipse debugger CAN debug remotely, but it requires upgrading the PPMAC from Lenny to Squeeze (so you can install gdbserver on the PPMAC). I haven't taken it this far, but plan to do so in the future. If you have any specific questions, let me know. It took a little bit to get everything working, but it is almost completely seamless the way I have it set up now. As a side note, using Eclipse for PPMAC development is definitely not for everyone! For example, I cannot do motion programs or PLCs in Eclipse (I haven't tried it at least). However, Eclipse does let you create your own project structure, and the more advanced intellisense, auto-coloring, and refactoring support is great! Plus, you can build and download applications and libraries individually, which (last I checked) you cannot do with the vanilla DT IDE.
shansen Posted October 10, 2014 Posted October 10, 2014 piefum: If you only need C applications, I would recommend Delta Tau's IDE. It is already set up with this capability, and it is much easier to use. That being said, my company has been using Eclipse instead of Delta Tau's IDE for several years now. Like anything, there are benefits and drawbacks to either method. Using Eclipse is not "easy" or "out-of-the-box" like Delta Tau's IDE. But, it does give us much more flexibility for organizing our projects, and allows us to compile any C or C++ code that can run on the Power PMAC.
piefum Posted October 10, 2014 Posted October 10, 2014 Hi shansen thanks for the insight. I asked this because I need to use special libraries (zeromq.org) that seems to not work inside the Deltatau IDE. I would prefer using the deltatau IDE, but I have some compatibility issues that I cannot (yet) sort out. Thanks a lot gigi piefum: If you only need C applications, I would recommend Delta Tau's IDE. It is already set up with this capability, and it is much easier to use. That being said, my company has been using Eclipse instead of Delta Tau's IDE for several years now. Like anything, there are benefits and drawbacks to either method. Using Eclipse is not "easy" or "out-of-the-box" like Delta Tau's IDE. But, it does give us much more flexibility for organizing our projects, and allows us to compile any C or C++ code that can run on the Power PMAC.
shansen Posted October 10, 2014 Posted October 10, 2014 Why doesn't zeromq work with the IDE? What errors are you getting? I think you should be able to get this to work, but it may require manually editing the Makefile and adding a line to link your Capp against the compiled zeromq library. Another option is copying your Capp code to the Power PMAC and compiling it locally.
piefum Posted October 13, 2014 Posted October 13, 2014 Why doesn't zeromq work with the IDE? What errors are you getting? I think you should be able to get this to work, but it may require manually editing the Makefile and adding a line to link your Capp against the compiled zeromq library. Another option is copying your Capp code to the Power PMAC and compiling it locally. I get 2 strange behaviors that I cannot understand. First of all, I installed the libraries, everything seems ok, I can see that the libzmq.a, .so, etc in /usr/local/lib and the .h in /usr/local/include When I load the zmq.h and zmq_utils.h in the IDE and include them in the main .c without using any function of the lib, the compilation is ok (see main.png). However, if I open the zmq.h file, the editor keeps telling me that there are a lot of syntax error (see syntaxerror.png), even if the file should be ansi C compliant. Then, if I try to use any of the functions inside the zmq.h, I get stopped by the syntax error in the zmq.h (compilation.png). So, basically, I really don't understand what is happening on the system. Could it be a compiler issue? Do you think I can get better results if I compile directly the file on the PMAC bypassing the IDE? thanks gigi
piefum Posted October 13, 2014 Posted October 13, 2014 Why doesn't zeromq work with the IDE? What errors are you getting? I think you should be able to get this to work, but it may require manually editing the Makefile and adding a line to link your Capp against the compiled zeromq library. Another option is copying your Capp code to the Power PMAC and compiling it locally. I get 2 strange behaviors that I cannot understand. First of all, I installed the libraries, everything seems ok, I can see that the libzmq.a, .so, etc in /usr/local/lib and the .h in /usr/local/include When I load the zmq.h and zmq_utils.h in the IDE and include them in the main .c without using any function of the lib, the compilation is ok (see main.png). However, if I open the zmq.h file, the editor keeps telling me that there are a lot of syntax error (see syntaxerror.png), even if the file should be ansi C compliant. Then, if I try to use any of the functions inside the zmq.h, I get stopped by the syntax error in the zmq.h (compilation.png). So, basically, I really don't understand what is happening on the system. Could it be a compiler issue? Do you think I can get better results if I compile directly the file on the PMAC bypassing the IDE? thanks gigi
shansen Posted October 13, 2014 Posted October 13, 2014 piefum: It looks like the errors are purely aesthetic, and have nothing to do with the compilation (e.g. the compile is succeeding). I think this is because the Delta Tau IDE is using a custom C language parser and it isn't great at recognizing and mapping all of the referenced include files. However, if the application compiles, then that means everything is working properly. Have you tried to download and run the application after compiling?
shansen Posted October 13, 2014 Posted October 13, 2014 piefum: It looks like the errors are purely aesthetic, and have nothing to do with the compilation (e.g. the compile is succeeding). I think this is because the Delta Tau IDE is using a custom C language parser and it isn't great at recognizing and mapping all of the referenced include files. However, if the application compiles, then that means everything is working properly. Have you tried to download and run the application after compiling?
dro Posted October 13, 2014 Posted October 13, 2014 IDE generates two sets of errors. For each language such as C we have a language service that tries to find syntax errors before they are compiled and they are always shown on the Errors List tab. Sometimes this service shows syntax errors which are not really errors, so do not rely on the errors tab for the validity of your code. It is meant to be a helper but has some issues that needs to be fixed. The correct reflection of the validity of your code happens during the compile time and it's results are displayed in the output window. piefum: It looks like the errors are purely aesthetic, and have nothing to do with the compilation (e.g. the compile is succeeding). I think this is because the Delta Tau IDE is using a custom C language parser and it isn't great at recognizing and mapping all of the referenced include files. However, if the application compiles, then that means everything is working properly. Have you tried to download and run the application after compiling?
dro Posted October 13, 2014 Posted October 13, 2014 IDE generates two sets of errors. For each language such as C we have a language service that tries to find syntax errors before they are compiled and they are always shown on the Errors List tab. Sometimes this service shows syntax errors which are not really errors, so do not rely on the errors tab for the validity of your code. It is meant to be a helper but has some issues that needs to be fixed. The correct reflection of the validity of your code happens during the compile time and it's results are displayed in the output window. piefum: It looks like the errors are purely aesthetic, and have nothing to do with the compilation (e.g. the compile is succeeding). I think this is because the Delta Tau IDE is using a custom C language parser and it isn't great at recognizing and mapping all of the referenced include files. However, if the application compiles, then that means everything is working properly. Have you tried to download and run the application after compiling?
piefum Posted October 14, 2014 Posted October 14, 2014 It looks like the errors are purely aesthetic, and have nothing to do with the compilation (e.g. the compile is succeeding). I think this is because the Delta Tau IDE is using a custom C language parser and it isn't great at recognizing and mapping all of the referenced include files. However, if the application compiles, then that means everything is working properly. Have you tried to download and run the application after compiling? ok, I understood that, in fact 2nd and 3rd figures show that the compilation is done. Unfortunately, the 1st figure shows the error on the first (only) call zmq_ctx_new(); to the library.
piefum Posted October 14, 2014 Posted October 14, 2014 It looks like the errors are purely aesthetic, and have nothing to do with the compilation (e.g. the compile is succeeding). I think this is because the Delta Tau IDE is using a custom C language parser and it isn't great at recognizing and mapping all of the referenced include files. However, if the application compiles, then that means everything is working properly. Have you tried to download and run the application after compiling? ok, I understood that, in fact 2nd and 3rd figures show that the compilation is done. Unfortunately, the 1st figure shows the error on the first (only) call zmq_ctx_new(); to the library.
shansen Posted October 14, 2014 Posted October 14, 2014 piefum: Those errors are from the parser, and don't have anything to do with compiling. If the project compiles successfully, then everything is OK even if it is showing errors.
shansen Posted October 14, 2014 Posted October 14, 2014 piefum: Those errors are from the parser, and don't have anything to do with compiling. If the project compiles successfully, then everything is OK even if it is showing errors.
piefum Posted October 20, 2014 Posted October 20, 2014 piefum: Those errors are from the parser, and don't have anything to do with compiling. If the project compiles successfully, then everything is OK even if it is showing errors. Hi thanks for the clarification of the parser errors. Unfortunately, the code does not compile: [...]\GLT2.ppproj(168,5): Error : capp1.o: In function `main': [...]\C Language\Background Programs\capp1capp1.c(64,0): Error : undefined reference to `zmq_ctx_new' [...]\GLT2.ppproj(168,5): Error : collect2: ld returned 1 exit status Build Process For capp1.out has ended. Done building project "GLT2.ppproj" -- FAILED. I think the compiler can not locate the ZMQ libraries, even if they are installed in /usr/local/lib . Do I have to specify some particular options to the GCC? (in this thread: http://forums.deltatau.com/showthread.php?tid=1705 I explained how I installed the ZMQ libraries on the Power PMAC and how I'd like to use them). EDIT: I found out how to compile with the ZMQ libraries. I downloaded the .c file on the PowerPMAC, connected in SSH and compiled with GCC. I had to use the options -L/usr/local/lib -lzmq to tell the compiler to use the specific libZMQ (it works even without the -L/usr/local/lib): gcc capp1.c -L/usr/local/lib -lzmq A major drawback of this approach is that the compiler can not find the gplib.h library; so for the moment I commented the gplib.h instructions InitLibrary() and CloseLibrary(). If I leave included the gplib.h, gcc replies this: capp1.c:1:56: error: gplib.h: No such file or directory Should I include the gplib.h with an explicit link? Where it is located? I tried to include any of the following: /opt/ppmac/libppmac/gplib.h /opt/www/ppmac/libppmac/gplib.h /var/ftp/ppmaclibs/libppmac/gplib.h /var/ftp/www/ppmac/libppmac/gplib.h but it does not compile. I also tried to use these compiler option in the IDE, by setting the proper option in the "C App Property", without success. If I use the option -L/usr/local/lib -lzmq in the "Compile Option", I got the error [...]GLT2.ppproj(171,5): Error : powerpc-405-linux-gnu-g++: -lzmq: linker input file unused because linking not done [...]GLT2.ppproj(171,5): Error : powerpc-405-linux-gnu-gcc: -lzmq: linker input file unused because linking not done [...]GLT2.ppproj(171,5): Error : capp1.o: In function `main': [...]capp1capp1.c(64,0): Error : undefined reference to `zmq_ctx_new' [...]GLT2.ppproj(171,5): Error : collect2: ld returned 1 exit status If I use the -L/usr/local/lib -lzmq in the Linker Option, I got this error message: [...]GLT2.ppproj(171,5): Error : /usr/local/bin/../lib/gcc/powerpc-405-linux-gnu/4.2.2/../../../../powerpc-405-linux-gnu/bin/ld: cannot find -lzmq [...]GLT2.ppproj(171,5): Error : collect2: ld returned 1 exit status Build Process For capp1.out has ended. Any idea on how should I proceed? thanks gigi
piefum Posted October 20, 2014 Posted October 20, 2014 piefum: Those errors are from the parser, and don't have anything to do with compiling. If the project compiles successfully, then everything is OK even if it is showing errors. Hi thanks for the clarification of the parser errors. Unfortunately, the code does not compile: [...]\GLT2.ppproj(168,5): Error : capp1.o: In function `main': [...]\C Language\Background Programs\capp1capp1.c(64,0): Error : undefined reference to `zmq_ctx_new' [...]\GLT2.ppproj(168,5): Error : collect2: ld returned 1 exit status Build Process For capp1.out has ended. Done building project "GLT2.ppproj" -- FAILED. I think the compiler can not locate the ZMQ libraries, even if they are installed in /usr/local/lib . Do I have to specify some particular options to the GCC? (in this thread: http://forums.deltatau.com/showthread.php?tid=1705 I explained how I installed the ZMQ libraries on the Power PMAC and how I'd like to use them). EDIT: I found out how to compile with the ZMQ libraries. I downloaded the .c file on the PowerPMAC, connected in SSH and compiled with GCC. I had to use the options -L/usr/local/lib -lzmq to tell the compiler to use the specific libZMQ (it works even without the -L/usr/local/lib): gcc capp1.c -L/usr/local/lib -lzmq A major drawback of this approach is that the compiler can not find the gplib.h library; so for the moment I commented the gplib.h instructions InitLibrary() and CloseLibrary(). If I leave included the gplib.h, gcc replies this: capp1.c:1:56: error: gplib.h: No such file or directory Should I include the gplib.h with an explicit link? Where it is located? I tried to include any of the following: /opt/ppmac/libppmac/gplib.h /opt/www/ppmac/libppmac/gplib.h /var/ftp/ppmaclibs/libppmac/gplib.h /var/ftp/www/ppmac/libppmac/gplib.h but it does not compile. I also tried to use these compiler option in the IDE, by setting the proper option in the "C App Property", without success. If I use the option -L/usr/local/lib -lzmq in the "Compile Option", I got the error [...]GLT2.ppproj(171,5): Error : powerpc-405-linux-gnu-g++: -lzmq: linker input file unused because linking not done [...]GLT2.ppproj(171,5): Error : powerpc-405-linux-gnu-gcc: -lzmq: linker input file unused because linking not done [...]GLT2.ppproj(171,5): Error : capp1.o: In function `main': [...]capp1capp1.c(64,0): Error : undefined reference to `zmq_ctx_new' [...]GLT2.ppproj(171,5): Error : collect2: ld returned 1 exit status If I use the -L/usr/local/lib -lzmq in the Linker Option, I got this error message: [...]GLT2.ppproj(171,5): Error : /usr/local/bin/../lib/gcc/powerpc-405-linux-gnu/4.2.2/../../../../powerpc-405-linux-gnu/bin/ld: cannot find -lzmq [...]GLT2.ppproj(171,5): Error : collect2: ld returned 1 exit status Build Process For capp1.out has ended. Any idea on how should I proceed? thanks gigi
shansen Posted October 20, 2014 Posted October 20, 2014 piefum: The reason gcc can't find gplib.h is you haven't specified the header file location. To do this, use the "I" flag (e.g. "-I /opt/ppmac/libppmac -I/opt/ppmac/rtpmac"). Also, you will need to include the Delta Tau libraries and Xenomai libraries that they link against ("-lrt -lpthread -lpthread_rt -lppmac"). However, if you prefer to compile under Windows you will need to edit your Capp's makefile to include the "-L/ -lzmq". This means you will need to copy the compiled binary (libzmq) and zmq header files from the Power PMAC to your PC. On Windows, you can find the Cygwin bash shell that is installed with Delta Tau's IDE at: C:\\Delta Tau Data Systems Inc\2.0\Power PMAC Suite\powerpc-460-linux-gnu\bin\bash.exe If my memory serves me correctly, Delta Tau has mapped the /opt directory to: C:\\Delta Tau Data Systems Inc\2.0\Power PMAC Suite\powerpc-460-linux-gnu I may be wrong on that, I haven't used the IDE in a while. Assuming I am correct, you could then copy the compiled zmq library binary file and the header files to: C:\\Delta Tau Data Systems Inc\2.0\Power PMAC Suite\powerpc-460-linux-gnu\usr\local\zmq Then, edit the Capp makefile to include "-L/opt/usr/local/zmq -lzmq". Now, use the bash shell to navigate to your Capp's directory (where the makefile is) and compile it by issuing "make".
shansen Posted October 20, 2014 Posted October 20, 2014 piefum: The reason gcc can't find gplib.h is you haven't specified the header file location. To do this, use the "I" flag (e.g. "-I /opt/ppmac/libppmac -I/opt/ppmac/rtpmac"). Also, you will need to include the Delta Tau libraries and Xenomai libraries that they link against ("-lrt -lpthread -lpthread_rt -lppmac"). However, if you prefer to compile under Windows you will need to edit your Capp's makefile to include the "-L/ -lzmq". This means you will need to copy the compiled binary (libzmq) and zmq header files from the Power PMAC to your PC. On Windows, you can find the Cygwin bash shell that is installed with Delta Tau's IDE at: C:\\Delta Tau Data Systems Inc\2.0\Power PMAC Suite\powerpc-460-linux-gnu\bin\bash.exe If my memory serves me correctly, Delta Tau has mapped the /opt directory to: C:\\Delta Tau Data Systems Inc\2.0\Power PMAC Suite\powerpc-460-linux-gnu I may be wrong on that, I haven't used the IDE in a while. Assuming I am correct, you could then copy the compiled zmq library binary file and the header files to: C:\\Delta Tau Data Systems Inc\2.0\Power PMAC Suite\powerpc-460-linux-gnu\usr\local\zmq Then, edit the Capp makefile to include "-L/opt/usr/local/zmq -lzmq". Now, use the bash shell to navigate to your Capp's directory (where the makefile is) and compile it by issuing "make".
Recommended Posts