Running a .app on Linux

600 views
Skip to first unread message

Squeaks

unread,
Feb 21, 2012, 4:35:22 AM2/21/12
to cocotr...@googlegroups.com
Would it be possible to run a .app on Linux straight off using the Cocotron framework? Forgive me if this has already been asked.

andyvn22

unread,
Jul 28, 2012, 12:42:43 PM7/28/12
to cocotr...@googlegroups.com
No--to create a Linux binary you must recompile the app with very different settings and a different compiler, linking to Cocotron. Furthermore, Cocotron's AppKit implementation (which contains all the GUI stuff) currently needs a bit of work to run on Linux, so even if you had the source, it would not be an easy task to recompile a .app for Linux.

Markus Hitter

unread,
Jul 31, 2012, 4:53:49 PM7/31/12
to cocotr...@googlegroups.com
Am 28.07.2012 00:28, schrieb semaj...@gmail.com:
> NO. Programs with the *.app extension come from NextStep or Mac OS X
> and are compiled in the Mach-o binary format. Linux binaries use the
> ELF-32 format which is not at all similar.
>
> On Tuesday, February 21, 2012 4:35:22 AM UTC-5, Squeaks wrote:
>
> Would it be possible to run a .app on Linux straight off using the
> Cocotron framework? Forgive me if this has already been asked.

While the top-posting is true, some efforts have been seen to create a
Mac OS X compatibility layer, similar to how Wine is such a layer for
Windows binaries:

http://hcpnet.free.fr/applebsd.html
https://groups.google.com/forum/?fromgroups#!msg/cocotron-dev/bTWh078tclY/f-lu0czgjw0J


Markus

--
- - - - - - - - - - - - - - - - - - -
Dipl. Ing. (FH) Markus Hitter
http://www.jump-ing.de/

Andreas Fink

unread,
Oct 16, 2012, 2:16:18 AM10/16/12
to cocotr...@googlegroups.com



On 12.10.2012, at 11:08, lub...@gmail.com wrote:

Hi.

Not quite impossible anymore. My project - http://darling.dolezel.info - has reached the state where I successfully launched a simple ObjC GUI app for OS X under Linux with the help of GNUstep.
Right now I'm checking which one has better coverage - GNUstep or Cocotron. GNUstep seems to have a better ObjC runtime, OTOH Cocotron appears to have a wider coverage of other APIs.

If anyone could come up with a list of the most serious deficiencies of Linux support in Cocotron, that would be *very* helpful for me, as I could start digging into them.

Lubos


I have Cocotron running under Linux, compiled with clang under linux (CentOS 6.3 64bit and Debian Stable) and using the GNUstep runtime. Costed us quite some time to build the makefiles but I'm more than happy to contribute it to the project in some way. It requires building the clang compiler beforehand. The clang trunk has all the nice features it has under MacOS X such as warnings for things you never thought of and the analyzer.

If anyone wants to have SVN access, let me know


Dne úterý, 21. února 2012 10:35:22 UTC+1 Squeaks napsal(a):
Would it be possible to run a .app on Linux straight off using the Cocotron framework? Forgive me if this has already been asked.

--
You received this message because you are subscribed to the Google Groups "Cocotron Developers" group.
To view this discussion on the web visit https://groups.google.com/d/msg/cocotron-dev/-/CkySn-3Kk4gJ.
To post to this group, send email to cocotr...@googlegroups.com.
To unsubscribe from this group, send email to cocotron-dev...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cocotron-dev?hl=en.

andyvn22

unread,
Oct 16, 2012, 5:41:18 AM10/16/12
to cocotr...@googlegroups.com
I think the most serious one would be how AppKit won't compile at the moment. :)


On Friday, October 12, 2012 5:08:15 AM UTC-4, Luboš Doležel wrote:
Hi.

Not quite impossible anymore. My project - http://darling.dolezel.info - has reached the state where I successfully launched a simple ObjC GUI app for OS X under Linux with the help of GNUstep.
Right now I'm checking which one has better coverage - GNUstep or Cocotron. GNUstep seems to have a better ObjC runtime, OTOH Cocotron appears to have a wider coverage of other APIs.

If anyone could come up with a list of the most serious deficiencies of Linux support in Cocotron, that would be *very* helpful for me, as I could start digging into them.

Lubos
Dne úterý, 21. února 2012 10:35:22 UTC+1 Squeaks napsal(a):
Would it be possible to run a .app on Linux straight off using the Cocotron framework? Forgive me if this has already been asked.

Andreas Fink

unread,
Jan 22, 2013, 8:09:27 PM1/22/13
to cocotr...@googlegroups.com, ea...@rtcollab.com
Hi Earl,

I have put up a webpage indicating all the steps I did to get Cocotron library compiled and working properly under Linux.
The steps have been done multiple times and multiple machines under CentOS 6.3 32bit, CentOS 6.3 64bit, Debian Stable 32 & 64bit and under Ubuntu. The steps potentially work with other distributions, possibly with little tweaking.

The instructions are on:


I would be more than happy if the contribution of the scripts and Makefiles somehow end up in the main repository somehow. It would simplify things in the long run. The original way by crosscompiling from Mac to Linux failed here most of the time because new Xcode versions appeared, the "create me a compiler" script was outdated and many other dependencies. I had it many times where it worked on one machine once but didn't on another and I got really tired to figure out how I can make the compiler work again properly. It was always something like black belt magic. Once the compiler worked and the project files where updated, it was all great.



On 22.01.2013, at 18:42, ea...@rtcollab.com wrote:

Hi Andreas,

I am trying to get Cocotron to work on Centos 6.3 to run a large server version of an app that was created in Xcode.  It seems from your post you have worked your magic on it and made it work.  Would love to learn how you did it and take advantage of anything you might want to make available.

Thanks so much.  I have been following all the work you have been posting and it has helped a lot.

Earl
To view this discussion on the web visit https://groups.google.com/d/msg/cocotron-dev/-/AY-BPvdD_JcJ.

Andreas Fink

unread,
Feb 1, 2013, 4:41:04 AM2/1/13
to cocotr...@googlegroups.com
Dear Earl,

The static library version was a short experiment which didn't work. I removed it from the Makefile afterwords but forgot to remove it in the install phase. 
Just delete the last line in the Makefile where it tries to install a .a file which is not built. The tar on my website cocotron.fink.org has been corrected a day or two after I published it. Static versions of Coctron don't work because ObjectiveC is built to be highly dynamic and somehow the dynamic linking is needed. Didn't had time to figure out what exactly breaks it but I suspect its in the core of the object passing mechanism somewhere. As it's not of importance to me, I skipped that part for now.

I currently compiled my own libraries the same way and it works.
I will share some makefile templates soon for that purpose.

The App I wanted to port doesn't work yet but this has something to do how Cocotron initializes itself. My app is not using the GUI so its a command line app. Under MacOS X I simply have a main.m looking like this:

int main(int argc, char *argv[])
{
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];

    AppDelegate *delegate = [[AppDelegate alloc]init];

    [global_appDelegate  applicationDidFinishLaunching:NULL];
    [pool drain];
    pool = [[NSAutoreleasePool alloc]init];
    while(must_quit==NO)
    {
        sleep(1);
    }
    NSLog(@"Terminating");
    [delegate autorelease];
    [pool drain];
}

And my applicationDidFinishLaunching does start background threads etc as needed.
Things like NSLog(@"Hello world"); don't work that way.
If I instatiate NSApplication beforehand however it works.

Maybe someone can shed some light on the inner workings of Cocotron in this aspect.

On 01.02.2013, at 08:30, ea...@rtcollab.com wrote:

Andreas,

Thanks so much for the help.  I have so far gotten Foundation, AppKit and using your example created a make file to CoreData.  I am now working on creating a make file for my application.  Still learning but I spent a TON of time trying to get Cocotron to work on Mac.  It just isn't set-up for x86_64.  So frustrating.  Thanks so much for sharing.

I did have one error keep popping up and that was for the static libs .a in all three builds.  Just deleted them as I didn't need them at this point. 

Again, thanks for sharing. 

Earl
To unsubscribe from this group and stop receiving emails from it, send an email to cocotron-dev...@googlegroups.com.

To post to this group, send email to cocotr...@googlegroups.com.

Andreas Fink

unread,
Feb 1, 2013, 4:44:55 AM2/1/13
to cocotr...@googlegroups.com
PS: one thing which I also discovered is that you can in theory use clang under MacOS X to compile binaries for Linux.
The only thing you would need is a linker producing ELF files. So the binutils would be enough.

However the "compiler definition" files of Xcode are cryptic and they changed far too often since XCode 3.2 to todays 4.6.
I asked Apple at WWDC about the correct way to do compiler definition files and the answer was something along the line "this is not supported, proprietary, internal" .
Others however do use it such as the Intel C++ compiler. But as we are not as big as Intel, we have little chance of getting this info without trial & error and fiddling around in every Xcode version.


Airy André

unread,
Feb 1, 2013, 4:55:42 AM2/1/13
to cocotr...@googlegroups.com, Andreas Fink
Just for info, I noticed the same when experimenting with new compilers versions about clang and targeting Windows.
I could build a simple Windows exe using Apple clang and manually doing the linking using Cocotron cross-linker.
I tried to create a spec file inheriting from Apple clang but couldn't just redefine just the linker part.

Airy
Reply all
Reply to author
Forward
0 new messages