mingw and objc libraries

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

mingw and objc libraries

Jonathan Schleifer-4
Hi!

As gcc 3.x has no usable objc support (no exceptions, #import not
workign correctly, etc), I built mingw with gcc 4.3. It seems to work,
however, as soon as I try to build and use a library, it fails:

asgard:/tmp$ cat foo.h
#import <objc/Object.h>

@interface MyObj: Object
- (void)foo;
@end
asgard:/tmp$ cat foo.m
#import <stdio.h>

#import "foo.h"

@implementation MyObj
- (void)foo
{
        puts("foo!");
}
@end
asgard:/tmp$ cat test.m
#import "foo.h"

int main()
{
        MyObj *x = [MyObj new];
        [x foo];
        return 0;
}
asgard:/tmp$ mingw32-gcc -shared -Wl,--out-implib,libfoo.dll.a foo.m -o libfoo.dll -lobjc
asgard:/tmp$ mingw32-gcc -L. test.m -lfoo -lobjc
Info: resolving ___objc_class_name_MyObj by linking to __imp____objc_class_name_MyObj (auto-import)
/usr/lib/gcc/mingw32/4.3.0/../../../../mingw32/bin/ld: warning: auto-importing has been activated without --enable-auto-import specified on the command line.
This should work unless it involves constant data structures referencing symbols from auto-imported DLLs.
asgard:/tmp$ wine a.exe
objc runtime: cannot find class MyObj

Any idea? Am I doing something wrong? Does it have something todo with
that warning about auto-importing? Or is this a bug, as this is the
still experimental gcc 4.3?

Info about the mingw32-gcc I use:
asgard:/tmp$ mingw32-gcc -v
Using built-in specs.
Target: mingw32
Configured with: ../gcc-4.3.0-20080502/configure -v --prefix=/usr --libexecdir=/usr/lib --program-prefix=mingw32- --target=mingw32 --with-headers=/usr/mingw32/include --without-x --disable-nls --disable-win32-registry --disable-shared --disable-java-awt --disable-libgcj-debug --with-gcc --with-gnu-ld --with-gnu-as --enable-threads --enable-languages=c,c++,objc --enable-libgcj --enable-java-gc=boehm --enable-interpreter --enable-hash-synchronization --enable-libstdcxx-debug
Thread model: win32
gcc version 4.3.0 (GCC)

Any help is appreciated, as I'm trying to port an objc library to Win32.

--
Jonathan

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

signature.asc (817 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: mingw and objc libraries

Mikko Lehtonen
Jonathan Schleifer wrote:
> Hi!
>
> As gcc 3.x has no usable objc support (no exceptions, #import not
> workign correctly, etc), I built mingw with gcc 4.3. It seems to work,
> however, as soon as I try to build and use a library, it fails:
>  
  I don't know the details what are required for working objc
  environment (objc runtime, etc.), but you could check the Cocotron
  project for a working compiler for windows, at
  http://www.cocotron.org/
 

--
Mikko Lehtonen



------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.
Reply | Threaded
Open this post in threaded view
|

Re: mingw and objc libraries

Jonathan Schleifer-4
Am 13.12.2008 um 23:48 schrieb Mikko Lehtonen:

>  I don't know the details what are required for working objc
>  environment (objc runtime, etc.), but you could check the Cocotron
>  project for a working compiler for windows, at
>  http://www.cocotron.org/

The problem is that I want and maybe even need to cross-compile. As I  
see it, Cocotron uses GCC with a few patches. I'll have a look at  
those later.

--
Jonathan


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

PGP.sig (817 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: mingw and objc libraries

Jonathan Schleifer-4
In reply to this post by Mikko Lehtonen
Hm, I found a hint on Google to create a .def file containing the
__objc_class_name_$class entries. After that, the issued warning
disappeared, but I would still get the message that the class wasn't
found.
Any ideas?

--
Jonathan

------------------------------------------------------------------------------

_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

signature.asc (817 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: mingw and objc libraries

Jonathan Schleifer-4
The problem still exists, the runtime can't find any classes from the  
shared library. When I use static linking, everything works. Nobody an  
idea? Isn't there a single person who tried to run an Objective C  
library on Win32?

--
Jonathan


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) HTML/MIME encoded mail
3) Improper quoting
4) Improper trimming

PGP.sig (817 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: mingw and objc libraries

Marc Vaillant
On Sun, Jan 25, 2009 at 02:48:17PM +0100, Jonathan Schleifer wrote:
> The problem still exists, the runtime can't find any classes from the  
> shared library. When I use static linking, everything works. Nobody an  
> idea? Isn't there a single person who tried to run an Objective C  
> library on Win32?

The objc runtime is neglected and likely broken.  Someone had mentioned
in a previous post that you try cocotron, which is probably the best
maintained objc implementation for windows.  It has its own runtime.
Did you try it? It designed to be installed as a cross compiler on a
mac, installing in an xcode compatible configuration (the idea being
that you take your mac xcode project, add a windows target, and just
build).   I'm sure it would build just fine as a cross compiler on linux
as well.

Marc

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) HTML/MIME encoded mail
3) Improper quoting
4) Improper trimming
Reply | Threaded
Open this post in threaded view
|

Re: mingw and objc libraries

Jonathan Schleifer-4
Am 26.01.2009 um 04:37 schrieb Marc Vaillant:

> The objc runtime is neglected and likely broken.  Someone had  
> mentioned
> in a previous post that you try cocotron, which is probably the best
> maintained objc implementation for windows.  It has its own runtime.
> Did you try it? It designed to be installed as a cross compiler on a
> mac, installing in an xcode compatible configuration (the idea being
> that you take your mac xcode project, add a windows target, and just
> build).   I'm sure it would build just fine as a cross compiler on  
> linux
> as well.
The problem is that I'm currently writing my own Objective C  
framework, so using an other framework isn't really an idea. The bug  
is either on linking or with the runtime itself, as it even happens  
with the gcc 4 from cygwin and with all versions of gcc 4 I built on  
Linux.

If it's a runtime thing, I could maybe replace the code in my  
framework so it doesn't use libobjc for that. But I think it should be  
fixed in libobjc, as most frameworks still have a dependency on libobjc.

Any ideas?

--
Jonathan


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) HTML/MIME encoded mail
3) Improper quoting
4) Improper trimming

PGP.sig (817 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: mingw and objc libraries

Marc Vaillant
On Mon, Jan 26, 2009 at 02:33:08PM +0100, Jonathan Schleifer wrote:

> Am 26.01.2009 um 04:37 schrieb Marc Vaillant:
>
>> The objc runtime is neglected and likely broken.  Someone had  
>> mentioned
>> in a previous post that you try cocotron, which is probably the best
>> maintained objc implementation for windows.  It has its own runtime.
>> Did you try it? It designed to be installed as a cross compiler on a
>> mac, installing in an xcode compatible configuration (the idea being
>> that you take your mac xcode project, add a windows target, and just
>> build).   I'm sure it would build just fine as a cross compiler on  
>> linux
>> as well.
>
> The problem is that I'm currently writing my own Objective C framework,
> so using an other framework isn't really an idea.

So you don't want your framework to depend on Foundation?  BTW, what machine
have you been developing for before trying mingw?

> The bug is either on
> linking or with the runtime itself, as it even happens with the gcc 4
> from cygwin and with all versions of gcc 4 I built on Linux.
>
> If it's a runtime thing, I could maybe replace the code in my framework
> so it doesn't use libobjc for that. But I think it should be fixed in
> libobjc, as most frameworks still have a dependency on libobjc.
>
> Any ideas?

Your best bet would be to track down the lead developer of cocotron.
He's on #macdev at irc.freenode.org just about every day.  His nick is
cocotron.  He's there right now in fact.  He should be able to help you.

Good luck,
Marc


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) HTML/MIME encoded mail
3) Improper quoting
4) Improper trimming
Reply | Threaded
Open this post in threaded view
|

Re: mingw and objc libraries

Jonathan Schleifer-4
Am 26.01.2009 um 15:39 schrieb Marc Vaillant:

> So you don't want your framework to depend on Foundation?

Exactly. It provides functionality and features similar to those of  
Foundation, so it would be having two frameworks. Yes, yes, I know,  
there are other portable objfw frameworks, but I wanted to write my  
own for a few reasons + out of fun + for the learning effect (how  
often do you implement the lowlevel stuff like dictionaries yourself?)

> BTW, what machine have you been developing for before trying mingw?


It's tested on Linux, NetBSD and OS X atm. It should also run on  
FreeBSD and Solaris. When disabling shared linking, it also works on  
Win32. More platforms to follow ;) (read: As soon as I got a way to  
test it on them, I can support them)

> Your best bet would be to track down the lead developer of cocotron.
> He's on #macdev at irc.freenode.org just about every day.  His nick is
> cocotron.  He's there right now in fact.  He should be able to help  
> you.

Thanks a lot! I'll ask him soon :) That really helps, as couldn't find  
anyone having used objc on win32 ;)

>
>
> Good luck,
> Marc
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> MinGW-users mailing list
> [hidden email]
>
> You may change your MinGW Account Options or unsubscribe at:
> https://lists.sourceforge.net/lists/listinfo/mingw-users
>
> _______________________________________________
> This list observes the Etiquette found at
> http://www.mingw.org/Mailing_Lists.
> We ask that you be polite and do the same.
>
> Most annoying abuses are:
> 1) Top posting
> 2) HTML/MIME encoded mail
> 3) Improper quoting
> 4) Improper trimming
>
--
Jonathan


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) HTML/MIME encoded mail
3) Improper quoting
4) Improper trimming

PGP.sig (817 bytes) Download Attachment