[Insight-users] [insight-users] Eclipse setup : debug, viewing sources and correct project tree

Michael Jackson mike.jackson at bluequartz.net
Wed Mar 10 10:33:36 EST 2010


On Mar 10, 2010, at 9:52 AM, Antonin Perrot-Audet wrote:

> On 3/10/10 3:15 PM, Michael Jackson wrote:
>>   Since ITK builds its libraries without any "install_name" you  
>> need to set the "DYLD_LIBRARY_PATH" to the absolute path to the ITK  
>> Libraries. Attached is a screen shot showing where this setting is  
>> at. Within Eclipse go to the "Debug" icon, click to drop it down,  
>> select "Debug Configurations", a new window pops up, select your  
>> executable, the select the "Environment" tab.
>>
>> Also, you need to go to the "Window" menu, then "Show View" then "C/ 
>> C++ Projects". From your screen shot, you are using the Generic  
>> "Projects View". Using the "C/C++ Projects" view will give you some  
>> additional features.
>>
>> ___________________________________________________________
>> Mike Jackson                      www.bluequartz.net
>> Principal Software Engineer       mike.jackson at bluequartz.net
>> BlueQuartz Software               Dayton, Ohio
>>
>>
>> On Mar 10, 2010, at 4:59 AM, Antonin Perrot-Audet wrote:
>>
>>> Thanks Mr Jackson, for your help, I am definitely moving forward :  
>>> I now have a project which seems to be set up approximatively  
>>> right in Eclipse :
>>> 1) I can now see my sources, in the project explorer and edit them  
>>> etc... btw, code completion works great
>>> 2) I can compile and make a nice executable, which works well
>>> 3) I also added the false target, to run cmake from eclipse.
>>> BUT :
>>> 1) I still have problems debugging : when I try to debug, (the bug  
>>> icon)
>>>
>>>   I get many warnings of this type :
>>> "
>>> warning: Unable to read symbols for "libitksys.3.16.dylib" (file  
>>> not found).
>>> warning: Unable to read symbols from "libitksys.3.16.dylib" (not  
>>> yet mapped into memory).
>>> "
>>>   and then an error :
>>> "
>>> Target selection failed.
>>> /dev/ttyS0: No such file or directory
>>> /dev/ttyS0: No such file or directory
>>> /dev/ttyS0: No such file or directory
>>> "
>>>
>>> 2) I don't see my "main" in the Maketargets view, there is  
>>> actually nothing in this view but my project's tree (and the  
>>> target I manually added to execute Cmake)
>>>
>>>
>>> I posted a screen capture on this server, it might be of any help  
>>> understanding my problem :
>>> http://fex.insa-lyon.fr/get?k=JG3zsR8MEZkeiOKHS27
>>>
>>> Regards,
>>>
>>> Antonin Perrot-Audet
>>> _____________________________________
>>
> Thank you, I figured that out this morning (france), and I was quite  
> reluctant to edit my system's variables :
> 1)how portable would be such a solution?
> 2)would I face this type of problem if I compile and install ITK  
> without shared libs (ITK_SHARED_LIBS = OFF)?
> 3)howto compile my executable without shared libraries (if I want to  
> put it all in the executable) if I installed itk on my system *with*  
> shared libraries.
>
> however, the solution is indeed to edit the .profile and export  
> ITK's shared libs folder to DYLD_LIBRARY_PATH .
>
> Thanks to your help, I could get it up and running, thank you very  
> much for your attention !
> Regards,
>
> Antonin
>
> PS : some details which are not in the tutorial :
> 1)you need to put your project within Eclipse's workspace,  
> otherwise, even if you specify absolute paths, eclipse will struggle  
> finding sources and binaries.
> 2)if you use shared libraries, you need to add that to eclipse's  
> environment variables
> this may be obvious for most users.
> I was looking for this issue and found out that one also needs to  
> manually edit the DYLD_LIBRARY_PATH for VTK.
>
> -- 
> Antonin Perrot-Audet
> Electrical Engineering&  Computer Sciences, INSA Lyon
> M2 GEGP Signal&  Image Processing, INSA Lyon, UCBL, Centrale Lyon
>

1) The solution is NOT portable. The more portable way to do this  
would be to use CMake's "BundleUtilities" to fix the 'install_name'  
encoded in the ITK libraries when you package your application for use  
on another machine.
2) NO you would not. If you compile ITK as static libraries all of  
these issues go away, which is why I compile ITK as static libraries.  
One less headache to worry about.
3) Delete the ITK installation that has Shared libraries. Clean your  
ITK build. Rerun CMake on ITK this time selecting to  
"BUILD_SHARED_LIBS" to OFF. Rebuild and install ITK. Now go to your  
Project. Clean EVERYTHING from the build directory and rerun CMake on  
the completely clean Build directory. CMake should now find the static  
ITK libraries. Build your application as usual with Eclipse.

Just FYI. Exporting a DYLD_LIBRARY_PATH can be VERY dangerous from the  
point of view if you have multiple ITK installations installed, (Say a  
debug and a Release version) then your executable will find what every  
libraries show up FIRST in the DYLD_LIBRARY_PATH since ITK does NOT  
take any actions to name debug libraries differently than release  
libraries.


PS Section:
  Thanks. I'll see if I can make some changes to the Wiki for those  
feedback points.

Mike Jackson


More information about the Insight-users mailing list