Author Topic: Eclipse Makefile/Project  (Read 31346 times)

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
Eclipse Makefile/Project
« on: 2009 December 10 20:26:02 »
Hi guys

I need a hand here ;) I can't get Eclipse to work... it doesn't recognize the makefile file as a project, but just a plain text one. Also, it has disabled the open project option... What is wrong? I downloaded and installed the CDT version. Have Eclipse Europa in one computer, and Ganimedes on another (first, 32bits, second, 64bits), both with the same behavior. Installation through apt or synaptic yields a version that is intended for java only... and did not find a way to install the C++ capabilities but this manual installation of CDT.


BTW, my new 32bits windows platform is working flawless. I got a linking problem with the 64bits one, but I think that I'll solve it tomorrow.


Thanks for your help!



PS: That's why I always worked with Emacs... <vbg>
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: Eclipse Makefile/Project
« Reply #1 on: 2009 December 16 03:20:45 »
Hi Carlos

Again, my apologies for being so slow in answering your questions.

I use Fedora Eclipse, which comes with everything necessary out-of-the-box and works flawlessly. Just install Fedora 12 on your box and don't forget to include all development tools and packages in your installation. Sorry, I have no experience with Eclipse installations from scratch.

I think there are perhaps better alternatives for a Linux IDE. In particular, NetBeans is a cross-platform, open source project from Sun:

http://netbeans.org/
http://netbeans.org/features/cpp/

The latest 6.8 version looks terrific, and being a Sun-sponsored project (you know: Java, OpenOffice, MySQL, VirtualBox, etc.), it deserves a careful exploration IMO.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
Re: Eclipse Makefile/Project
« Reply #2 on: 2010 April 21 20:52:32 »
Hi Juan

Just installed Fedora 12 (on it right now), PI, set the environment variables... and it came the time for Eclipse. First, it was not installed, so I downloaded it with the Kpackage. Installed the core, and the CDT. Now, I'm exactly in the same place as when I was with Ubuntu. Can't get Eclipse to open any of the makefile files and get a meaningfull project. Do I have to select any specific workspace? If I create a new project, and try to import the settings, it asks for a .xml file, nowhere created...
I've got the feeling that I'm missing something. Or, Eclipse really doesn't want to work for me :D
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: Eclipse Makefile/Project
« Reply #3 on: 2010 April 22 02:23:21 »
Hi Carlos,

You did it the hard way! :) It's much easier to install Eclipse during Fedora installation, by enabling the "Personalize now" option. Anyway you should have everything you need to work on C++ projects with Eclipse.

Quote
Can't get Eclipse to open any of the makefile files and get a meaningful project.

Because you can't do that. Follow these steps to create an Eclipse project from existing code:

- Put all your source files (*cpp, *h) on one directory. Eclipse projects are tied to a directory.

- Open Eclipse and select the C++ perspective if you don't have it selected by default.

- Select File > New > C++ Project

- On the C++ Project dialog, enter the Project name for your project. Enter also the directory where you have your project.

- On Project Type, select Shared Library > Empty Project

- Click Next

- To be able to debug your project, be sure to have the Debug item checked. In general, you don't want to generate release builds with Eclipse. The correct way to generate release builds is from the command line using the makefiles automatically generated with the MakefileGenerator script in PixInsight.

- Click Finish

Now you'll see your project listed in the Project Explorer window (if you don't see it, select Window > Show View > Project Explorer). You should right-click your project now and select Properties.

In the following I assume you have the required environment variables defined.

On the Properties dialog, select the Debug configuration.

Now select the C/C++ Build > Settings item. On the Tool Settings tab, you must define the following:

- GCC C++ Compiler section:

* Preprocessor: define the required macros: __PCL_LINUX and _REENTRANT
* Directories: $(PCLINCDIR)
* Optimization: For a debug build, select None (-O0). For release builds you should use the makefiles generated with the MakefileGenerator script in PixInsight and build from the command line, instead of Eclipse.
* Debugging: Maximum (-g3)
* Warnings: All warnings (-Wall)
* Miscellaneous: -m32 -fPIC -c -fmessage-length=0 -Wno-parentheses
 (for a 64-bit build, replace -m32 with -m64)

- GCC C++ Linker section:

* Libraries: PCL-pxi
 (in addition, you may need lcms-pxi if you use the ICCProfile PCL class in your code)
* Library search paths: $(PCLLIBDIR32) $(PCLBINDIR32)
 (for a 64-bit build, replace 32 with 64)
* Shared library settings: enable Shared (-shared)

- Build Steps:

This is optional. I personally put the following in the Post-build command:
cp *-pxm.so $(PCLBINDIR32)
where you must replace 32 with 64 for a 64-bit build. This command copies your just-compiled module to your bin installation directory automatically.

- Build artifact:

Artifact type: Shared library
Artifact name: <your-module-name>-pxm
Artifact extension: so

Now you should be able to build your module. Let me know if you have further problems.

Performing a debug session of a PixInsight module with Eclipse involves some not-so-obvious steps that deserve a separate post. Let's see if you manage to build your module for now.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
Re: Eclipse Makefile/Project
« Reply #4 on: 2010 April 22 05:39:28 »
And some say PI has a non friendly interface...

Ok. I've got the project listed. I'll mess with the configurations when I return home tonight. :)


Thanks!!!
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
Re: Eclipse Makefile/Project
« Reply #5 on: 2010 May 01 18:17:51 »
Hi Juan
I'm having some problems to compile the code:
Quote
Description   Resource   Path   Location   Type
make: *** [DefectMapInstance.o] Error 127   DefectMap      line 0   C/C++ Problem
Error launching external scanner info generator (g++ -E -P -v -dD /home/carlos/workspace/.metadata/.plugins/org.eclipse.cdt.make.core/specs.cpp)   DefectMap      Unknown   C/C++ Problem
Error launching external scanner info generator (g++ -E -P -v -dD /home/carlos/workspace/.metadata/.plugins/org.eclipse.cdt.make.core/specs.cpp)   DefectMap      Unknown   C/C++ Problem

Also it did show a warning about the PCLINCDIR directory not found, but I found a workaround (writing the whole path instead of $(PCLINCDIR), $PCLINCDIR, or other variations, since neither worked). Anyway, that environment variable has been properly setted. Writing "cd $PCLINCDIR" on the console works as expected.
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
Re: Eclipse Makefile/Project
« Reply #6 on: 2010 May 08 18:32:00 »
Good news... Now I'm compiling with Eclipse at 64bits (Fedora) :D (wow, today I totally fixed that computer's problems... now I have full 64bits capabilities :D). So, it seems that is only pending the new Ubuntu 32b...
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline budguinn

  • PixInsight Addict
  • ***
  • Posts: 106
Re: Eclipse Makefile/Project
« Reply #7 on: 2010 May 08 18:40:05 »
Good news... Now I'm compiling with Eclipse at 64bits (Fedora) :D (wow, today I totally fixed that computer's problems... now I have full 64bits capabilities :D). So, it seems that is only pending the new Ubuntu 32b...

congrats, I got to figure with the blink deal coming along....64bit compiling up and working.....why, the paint tools should be just around the corner :P :P

bud

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
Re: Eclipse Makefile/Project
« Reply #8 on: 2010 May 08 19:01:04 »
I'm not going to do them ;) Complex interface processes are Juan's field. Now I'm working on the PSF stuff, and the InterChannelCurves process. After that, my schedule says something to do aperture photometry... and then... who knows :D
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2172
  • Join the dark side... we have cookies
    • http://www.astrophoto.cl
Re: Eclipse Makefile/Project
« Reply #9 on: 2010 May 08 20:11:55 »
Now compiling too in Ubuntu Lucid Lynx. x86
Note: make sure you have the g++ packages installed. In my system, there was gcc only.

:) I'm AWD (all wheel drive) now! :D
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline Niall Saunders

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1456
  • We have cookies? Where ?
Re: Eclipse Makefile/Project
« Reply #10 on: 2010 May 08 23:14:16 »
Hi Bud,

Quote
the paint tools should be just around the corner

Yes, I know, sometimes you ask for something to be added to PixInsight and it can be DAYS before someone writes the code - just not really good enough, is it ::)

And, usually, it is always the same excuse, something along the lines of, "You know, I do actually HAVE a life outside PI". And the worst offender is Juan - he has even been known to leave his PC behind when he goes on holiday. HOLIDAYS >:(, what is THAT all about? And he sometimes takes four hour's sleep EVERY day.

It seems the days of enthusiastic dedication, fuelled by Red Bull and cold pizza, are just long lost memories.

Ahh well, its Sunday morning, just gone 7am, and I have been up for two hours now, so a quick slice of Domino's and back to the keyboard . . . . . .

Cheers,
Cheers,
Niall Saunders
Clinterty Observatories
Aberdeen, UK

Altair Astro GSO 10" f/8 Ritchey Chrétien CF OTA on EQ8 mount with homebrew 3D Balance and Pier
Moonfish ED80 APO & Celestron Omni XLT 120
QHY10 CCD & QHY5L-II Colour
9mm TS-OAG and Meade DSI-IIC

Offline NKV

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 677
Re: Eclipse Makefile/Project
« Reply #11 on: 2012 March 16 02:13:08 »
I think there are perhaps better alternatives for a Linux IDE. In particular, NetBeans is a cross-platform, open source project from Sun:
http://netbeans.org/
Hello Juan.
I create in Netbeans(7.1.1) a Sandbox project according your instruction for Eclipse. I have set full patches to lib, bin, inc.
But I don't see section:
Code: [Select]
- Build artifact:

Artifact type: Shared library
Artifact name: <your-module-name>-pxm
Artifact extension: so

Can you help me.

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: Eclipse Makefile/Project
« Reply #12 on: 2012 March 16 02:34:14 »
I have never used NetBeans (other than playing with it informally). Any special reason you can't generate makefiles with the Makefile Generator script?

Surely I'd be faster helping you if you show some source code than trying to get NetBeans working.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline NKV

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 677
Re: Eclipse Makefile/Project
« Reply #13 on: 2012 March 16 02:50:39 »
I have never used NetBeans (other than playing with it informally). Any special reason you can't generate makefiles with the Makefile Generator script?
Before I use only VC++ for compilation/debugging. But after compilation my code under Linux, I found that VC++ pass many errorss. So I need NetBeans or Eclipse for debugging.

Quote
Surely I'd be faster helping you if you show some source code than trying to get NetBeans working.
Thank you, but in future, will be much better if I do it myself.

OK, I will try Eclipse. Maybe...
« Last Edit: 2012 March 16 04:32:38 by NKV »

Offline NKV

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 677
Re: Eclipse Makefile/Project
« Reply #14 on: 2012 March 16 04:38:47 »
I got successful compilation Netbeans:
Code: [Select]
g++ -c -pipe -m64 -fPIC -D_REENTRANT -D__PCL_LINUX -I"/home/user/PCL/include" -O0 -g -fvisibility=hidden -fvisibility-inlines-hidden -fnon-call-exceptions -Wall -Wno-parentheses -MMD -MP -MF"x86_64/Debug/SandboxInstance.d" -MT"x86_64/Debug/SandboxInstance.d" -o"x86_64/Debug/SandboxInstance.o" "../../SandboxInstance.cpp"
 
g++ -c -pipe -m64 -fPIC -D_REENTRANT -D__PCL_LINUX -I"/home/user/PCL/include" -O0 -g -fvisibility=hidden -fvisibility-inlines-hidden -fnon-call-exceptions -Wall -Wno-parentheses -MMD -MP -MF"x86_64/Debug/SandboxInterface.d" -MT"x86_64/Debug/SandboxInterface.d" -o"x86_64/Debug/SandboxInterface.o" "../../SandboxInterface.cpp"
 
g++ -c -pipe -m64 -fPIC -D_REENTRANT -D__PCL_LINUX -I"/home/user/PCL/include" -O0 -g -fvisibility=hidden -fvisibility-inlines-hidden -fnon-call-exceptions -Wall -Wno-parentheses -MMD -MP -MF"x86_64/Debug/SandboxModule.d" -MT"x86_64/Debug/SandboxModule.d" -o"x86_64/Debug/SandboxModule.o" "../../SandboxModule.cpp"
 
g++ -c -pipe -m64 -fPIC -D_REENTRANT -D__PCL_LINUX -I"/home/user/PCL/include" -O0 -g -fvisibility=hidden -fvisibility-inlines-hidden -fnon-call-exceptions -Wall -Wno-parentheses -MMD -MP -MF"x86_64/Debug/SandboxParameters.d" -MT"x86_64/Debug/SandboxParameters.d" -o"x86_64/Debug/SandboxParameters.o" "../../SandboxParameters.cpp"
 
g++ -c -pipe -m64 -fPIC -D_REENTRANT -D__PCL_LINUX -I"/home/user/PCL/include" -O0 -g -fvisibility=hidden -fvisibility-inlines-hidden -fnon-call-exceptions -Wall -Wno-parentheses -MMD -MP -MF"x86_64/Debug/SandboxProcess.d" -MT"x86_64/Debug/SandboxProcess.d" -o"x86_64/Debug/SandboxProcess.o" "../../SandboxProcess.cpp"
 
g++ -m64 -fPIC -Wl,-z,noexecstack -Wl,-O1 -shared -L"/home/user/PCL/lib/linux/x86_64" -L"/home/user/PCL/x64/bin" -o "/home/user/PCL/src/modules/processes/Sandbox/linux/g++/x86_64/Debug"/Sandbox-pxm.so ./x86_64/Debug/SandboxInstance.o ./x86_64/Debug/SandboxInterface.o ./x86_64/Debug/SandboxModule.o ./x86_64/Debug/SandboxParameters.o ./x86_64/Debug/SandboxProcess.o -lpthread -lPCL-pxi
/usr/bin/make -f ./makefile-x86_64-debug --no-print-directory post-build
cp "/home/user/PCL/src/modules/processes/Sandbox/linux/g++/x86_64/Debug"/Sandbox-pxm.so /home/user/PCL/x64/bin


BUILD SUCCESSFUL (total time: 6s)

But I can't start debugging.
Code: [Select]
/home/user/PCL/x64/bin/PixInsight: error while loading shared libraries: libssh2.so.1: cannot open shared object file: No such file or directory

« Last Edit: 2012 March 16 10:28:17 by NKV »