Difference between revisions of "EiffelVision Cocoa"

(Build instructions)
m (Replaced origo.ethz.ch by eiffel.com in SVN URL)
 
(16 intermediate revisions by 2 users not shown)
Line 5: Line 5:
 
=Overview=
 
=Overview=
 
This project was created with the goal of running Eiffel Studio natively on the Mac and succeeds the previous Carbon based EiffelVision implementation.
 
This project was created with the goal of running Eiffel Studio natively on the Mac and succeeds the previous Carbon based EiffelVision implementation.
 +
=Screenshots=
 +
 +
[[Image:EiffelStudio-19-05-09.png|200px|thumb|left|EiffelStudio on 19.5.09]]
 +
[[Image:EiffelStudio-3-07-09.png|200px|thumb|left|EiffelStudio on 3.7.09]]
 +
[[Image:EiffelStudio-21-08-09.png|200px|thumb|left|EiffelStudio on 21.8.09]]
 +
<br/><br/>
 +
<br/><br/>
 +
<br/><br/>
 +
<br/><br/>
 +
  
 
=Build instructions=
 
=Build instructions=
* Get the latest EiffelStudio for the Mac. If you have MacPorts installed you can do this by typing
+
<ol>
   port install eiffelstudio65
+
<li> Get the latest EiffelStudio for the Mac. If you have MacPorts installed you can do this by typing
* Check out the latest source code from the trunk
+
   <pre>sudo port install eiffelstudio68</pre></li>
   svn co https://svn.origo.ethz.ch/eiffelstudio/trunk
+
<li> Check out the latest source code from the trunk
* Set your EIFFEL_SRC and ISE_LIBRARY to the directory
+
   <pre>svn co https://svn.eiffel.com/eiffelstudio/trunk</pre></li>
   export EIFFEL_SRC=/directory/to/your/checkout/trunk/Src
+
<li>Set your EIFFEL_SRC and ISE_LIBRARY like this
 +
<pre>
 +
   export ISE_LIBRARY=/directory/to/your/checkout/trunk/Src
 
   export EIFFEL_SRC=$ISE_LIBRARY
 
   export EIFFEL_SRC=$ISE_LIBRARY
* Locate EiffelStudio's config.sh file (probably /Applications/MacPorts/Eiffel65/studio/spec/macosx-x86/include/config.sh) and add the flag -ObjC to the definition of the ccflags, like this:
+
</pre>
   ccflags='-ObjC -pipe -no-cpp-precomp -fno-common -fPIC'
+
</li>
* Compile the C-parts of the library
+
<li>Locate EiffelStudio's config.sh file (probably /Applications/MacPorts/Eiffel68/studio/spec/macosx-x86/include/config.sh) and add the flag -ObjC to the definition of the ccflags, like this:
   cd $ISE_LIBRARY/experimental/library/objc_base/Clib
+
<pre>
 +
   ccflags='-ObjC -arch i386 -pipe -no-cpp-precomp -fno-common -fPIC'
 +
</pre>
 +
</li>
 +
<li>Compile the C-parts of the library
 +
<pre>
 +
   cd $ISE_LIBRARY/library/objc_base/Clib
 
   finish_freezing -library
 
   finish_freezing -library
   cd $ISE_LIBRARY/experimental/library/cocoa/Clib
+
   cp -R $ISE_LIBRARY/library/objc_base/spec $ISE_EIFFEL/library/objc_base/spec
 +
  cd $ISE_LIBRARY/library/cocoa/Clib
 
   finish_freezing -library
 
   finish_freezing -library
* Now open the .ecf file of your project and add the following line to your target:
+
  cp -R $ISE_LIBRARY/library/cocoa/spec $ISE_EIFFEL/library/cocoa/spec
 +
</pre>
 +
</li>
 +
<li>Now open the .ecf file of your project and add the following line to your target:
 +
<pre>
 
   <variable name="vision_implementation" value="cocoa"/>
 
   <variable name="vision_implementation" value="cocoa"/>
alternatively you can add another target which will allow you to easily compile both, a GTK+ and a Cocoa version of your application:
+
</pre>
 +
alternatively you can add another target which will allow you to easily compile both a GTK+ and a Cocoa version of your application:
 +
<pre>
 
   <target name="cocoa" extends="classic">
 
   <target name="cocoa" extends="classic">
 
       <variable name="vision_implementation" value="cocoa"/>
 
       <variable name="vision_implementation" value="cocoa"/>
 
   </target>
 
   </target>
 +
</pre>
 
If you want to compile Eiffel Studio there is already a target called "bench_cocoa" which you can select.
 
If you want to compile Eiffel Studio there is already a target called "bench_cocoa" which you can select.
* Use ec -experiment (or estudio -experiment) to compile
+
</li>
 +
</ol>
 +
 
 +
= Documentation =
 +
 
 +
Much of the inner working of EiffelVision and the underlying frameworks is described in my master thesis which you can find [http://dfurrer.com/masterthesis/thesis.pdf here]. (You can also check out the presentation [http://dfurrer.com/masterthesis/presentation.pdf here].)
 +
 
 +
== TODO ==
 +
Here are a couple of tasks that would help EiffelVision Cocoa to a more mature level.
 +
 
 +
=== Memory management ===
 +
We need to make sure the Objective-C objects are properly retained and released on creation and destruction of the dual Eiffel object. We also have to make sure there is never more than one dual Eiffel object for an Objective-C object. (This is currently the case)
 +
Most of the code for the first part is in NS_OBJECT - for the second part some adjustments in the way the descendants of NS_OBJECT implement queries is needed.
 +
 
 +
=== SmartDocking library ===
 +
The SmartDocking library is used by EiffelStudio and at the moment we only have a very basic Cocoa based implementation. Improving this implementation would help the EiffelStudio experience on Mac OS X a lot.
 +
 
  
 
= FAQ =
 
= FAQ =
 +
== Eiffel compilation errors==
 +
'''Note''': The last time I checked precompiles for Vision did not work correctly. Try removing them from your configuration and recompile.
 +
 +
==C compilation errors==
 +
'''Problem'''
 +
 +
C compilation yields syntax errors:
 +
<pre>
 +
Compiling C code in C190
 +
In file included from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:12,
 +
                from /System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12,
 +
                from ns6299.c:27,
 +
                from big_file_C191_c.c:54:
 +
/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:124: error: stray '@' in program
 +
/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:124: error: syntax error before 'NSString'
 +
/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:126: error: syntax error before '*' token
 +
/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:127: error: syntax error before '*' token
 +
/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:129: error: syntax error before '*' token
 +
/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:130: error: syntax error before '*' token
 +
/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:132: error: syntax error before '*' token
 +
/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:132: error: syntax error before '*' token
 +
/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:133: error: syntax error before '*' token
 +
/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:133: error: syntax error before '*' token
 +
/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:137: error: syntax error before '*' token
 +
/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:138: error: syntax error before '*' token
 +
In file included from /System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:6,
 +
                from /System/Library/Frameworks/Foundation.framework/Headers/NSAffineTransform.h:5,
 +
                from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:13,
 +
                from /System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12,
 +
                from ns6299.c:27,
 +
                from big_file_C191_c.c:54:
 +
/System/Library/Frameworks/Foundation.framework/Headers/NSZone.h:8: error: stray '@' in program
 +
</pre>
 +
 +
'''Solution'''
 +
 +
Make sure your config.sh was changed to allow compiling Objective-C (see step 4 above).
 +
 +
==Linker errors==
 +
'''Problem'''
 +
 +
C compilation yields an linker error (symbols not found):
 +
  Compiling C code in C1
 +
  Compiling C code in E1
 +
  Undefined symbols:
 +
    "_bridge_void_general", referenced from:
 +
        _bridge_void_general$non_lazy_ptr in Cobj160.o
 +
    "_bridge_void_ptr_ptr", referenced from:
 +
        _bridge_void_ptr_ptr$non_lazy_ptr in Cobj160.o
 +
  ld: symbol(s) not found
 +
  collect2: ld returned 1 exit status
 +
  make: *** [ec] Error 1
 +
'''Solution'''
 +
 +
Make sure you compiled the C-parts of the libraries (see step 5 above).
  
 
= Contact =
 
= Contact =

Latest revision as of 13:05, 4 June 2012


Overview

This project was created with the goal of running Eiffel Studio natively on the Mac and succeeds the previous Carbon based EiffelVision implementation.

Screenshots

EiffelStudio on 19.5.09
EiffelStudio on 3.7.09
EiffelStudio on 21.8.09










Build instructions

  1. Get the latest EiffelStudio for the Mac. If you have MacPorts installed you can do this by typing
    sudo port install eiffelstudio68
  2. Check out the latest source code from the trunk
    svn co https://svn.eiffel.com/eiffelstudio/trunk
  3. Set your EIFFEL_SRC and ISE_LIBRARY like this
       export ISE_LIBRARY=/directory/to/your/checkout/trunk/Src
       export EIFFEL_SRC=$ISE_LIBRARY
    
  4. Locate EiffelStudio's config.sh file (probably /Applications/MacPorts/Eiffel68/studio/spec/macosx-x86/include/config.sh) and add the flag -ObjC to the definition of the ccflags, like this:
       ccflags='-ObjC -arch i386 -pipe -no-cpp-precomp -fno-common -fPIC'
    
  5. Compile the C-parts of the library
       cd $ISE_LIBRARY/library/objc_base/Clib
       finish_freezing -library
       cp -R $ISE_LIBRARY/library/objc_base/spec $ISE_EIFFEL/library/objc_base/spec
       cd $ISE_LIBRARY/library/cocoa/Clib
       finish_freezing -library
       cp -R $ISE_LIBRARY/library/cocoa/spec $ISE_EIFFEL/library/cocoa/spec
    
  6. Now open the .ecf file of your project and add the following line to your target:
       <variable name="vision_implementation" value="cocoa"/>
    

    alternatively you can add another target which will allow you to easily compile both a GTK+ and a Cocoa version of your application:

       <target name="cocoa" extends="classic">
          <variable name="vision_implementation" value="cocoa"/>
       </target>
    

    If you want to compile Eiffel Studio there is already a target called "bench_cocoa" which you can select.

Documentation

Much of the inner working of EiffelVision and the underlying frameworks is described in my master thesis which you can find here. (You can also check out the presentation here.)

TODO

Here are a couple of tasks that would help EiffelVision Cocoa to a more mature level.

Memory management

We need to make sure the Objective-C objects are properly retained and released on creation and destruction of the dual Eiffel object. We also have to make sure there is never more than one dual Eiffel object for an Objective-C object. (This is currently the case) Most of the code for the first part is in NS_OBJECT - for the second part some adjustments in the way the descendants of NS_OBJECT implement queries is needed.

SmartDocking library

The SmartDocking library is used by EiffelStudio and at the moment we only have a very basic Cocoa based implementation. Improving this implementation would help the EiffelStudio experience on Mac OS X a lot.


FAQ

Eiffel compilation errors

Note: The last time I checked precompiles for Vision did not work correctly. Try removing them from your configuration and recompile.

C compilation errors

Problem

C compilation yields syntax errors:

Compiling C code in C190
In file included from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:12,
                 from /System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12,
                 from ns6299.c:27,
                 from big_file_C191_c.c:54:
/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:124: error: stray '@' in program
/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:124: error: syntax error before 'NSString'
/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:126: error: syntax error before '*' token
/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:127: error: syntax error before '*' token
/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:129: error: syntax error before '*' token
/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:130: error: syntax error before '*' token
/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:132: error: syntax error before '*' token
/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:132: error: syntax error before '*' token
/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:133: error: syntax error before '*' token
/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:133: error: syntax error before '*' token
/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:137: error: syntax error before '*' token
/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:138: error: syntax error before '*' token
In file included from /System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:6,
                 from /System/Library/Frameworks/Foundation.framework/Headers/NSAffineTransform.h:5,
                 from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:13,
                 from /System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12,
                 from ns6299.c:27,
                 from big_file_C191_c.c:54:
/System/Library/Frameworks/Foundation.framework/Headers/NSZone.h:8: error: stray '@' in program

Solution

Make sure your config.sh was changed to allow compiling Objective-C (see step 4 above).

Linker errors

Problem

C compilation yields an linker error (symbols not found):

  Compiling C code in C1
  Compiling C code in E1
  Undefined symbols:
    "_bridge_void_general", referenced from:
        _bridge_void_general$non_lazy_ptr in Cobj160.o
    "_bridge_void_ptr_ptr", referenced from:
        _bridge_void_ptr_ptr$non_lazy_ptr in Cobj160.o
  ld: symbol(s) not found
  collect2: ld returned 1 exit status
  make: *** [ec] Error 1

Solution

Make sure you compiled the C-parts of the libraries (see step 5 above).

Contact

If you run into any problems or have any other feedback I'll be happy to hear from you.