FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Anyone had a go at Pyd for OS X?

 
Post new topic   Reply to topic     Forum Index -> PyD
View previous topic :: View next topic  
Author Message
astrec



Joined: 05 Nov 2007
Posts: 2

PostPosted: Mon Nov 05, 2007 12:20 am    Post subject: Anyone had a go at Pyd for OS X? Reply with quote

Anyone had a go at Pyd for OS X?

A quick test gives me:

gdc -fPIC -nostartfiles -shared -fdebug -o build/lib.macosx-10.3-fat-2.5/tester.so build/temp.macosx-10.3-fat-2.5/project/tester.o build/temp.macosx-10.3-fat-2.5/infra/python.o build/temp.macosx-10.3-fat-2.5/infra/class_wrap.o build/temp.macosx-10.3-fat-2.5/infra/ctor_wrap.o build/temp.macosx-10.3-fat-2.5/infra/def.o build/temp.macosx-10.3-fat-2.5/infra/dg_convert.o build/temp.macosx-10.3-fat-2.5/infra/exception.o build/temp.macosx-10.3-fat-2.5/infra/func_wrap.o build/temp.macosx-10.3-fat-2.5/infra/lib_abstract.o build/temp.macosx-10.3-fat-2.5/infra/make_object.o build/temp.macosx-10.3-fat-2.5/infra/make_wrapper.o build/temp.macosx-10.3-fat-2.5/infra/op_wrap.o build/temp.macosx-10.3-fat-2.5/infra/pyd.o build/temp.macosx-10.3-fat-2.5/infra/pydobject.o build/temp.macosx-10.3-fat-2.5/infra/struct_wrap.o build/temp.macosx-10.3-fat-2.5/infra/pydmain.o build/temp.macosx-10.3-fat-2.5/infra/Default.o build/temp.macosx-10.3-fat-2.5/infra/Demangle.o build/temp.macosx-10.3-fat-2.5/infra/Nameof.o build/temp.macosx-10.3-fat-2.5/infra/Util.o build/temp.macosx-10.3-fat-2.5/infra/python_so_linux_boilerplate.o -Wl,-soname,tester.so
i686-apple-darwin8-gdc-4.0.1: unrecognized option '-shared'
ld: unknown option: -soname
collect2: ld returned 1 exit status
error: command 'gdc' failed with exit status 1

I had a quick go at some changes to dcompiler.py, including replacing -shared with -dynamiclib but cannot work out how to get it to link.

Thoughts?
Back to top
View user's profile Send private message
Paolo Invernizzi



Joined: 20 Jul 2006
Posts: 17

PostPosted: Mon Nov 05, 2007 4:33 am    Post subject: Reply with quote

I've done this around line 500:
Code:

# _linkOpts
### <<<<<self._linkOpts = ['-fPIC', '-nostartfiles', '-shared']
self._linkOpts = ['-fPIC', '-nostartfiles', '-bundle', '-Wl,-undefined,dynamic_lookup']

and some lines after:
Code:

return []#####['-Wl,-soname,' + os.path.basename(output_filename)]

I've also added a pyd/d/python_so_darwin_boilerplate.d with:
Code:

extern(C) {

extern (C) void gc_init();
extern (C) void gc_term();
extern (C) void _moduleCtor();
extern (C) void _moduleDtor();
extern (C) void _moduleUnitTests();


pragma(GNU_attribute, constructor) void _init() {
    gc_init();
    //_moduleCtor(); // XXX PI does not work here... moded in PydMain
    //_moduleUnitTests(); // idem
}

pragma(GNU_attribute, destructor) void _fini() {
   _moduleDtor();
   gc_term();
}

}

That you must add to the extension. But I've still some problems about the garbage collection, with random crash dumps... ;-/

If you (or Kirk) want to contact me, email me to arathorn@NO_SPAMfastwebnet.it

Cheers Paolo
Back to top
View user's profile Send private message
astrec



Joined: 05 Nov 2007
Posts: 2

PostPosted: Mon Nov 05, 2007 10:52 pm    Post subject: Reply with quote

Thanks Paolo - got me up and going - no crashes yet so it's a good start.

Kirk, would you accept a patch with these changes (and whatever else comest to light as things progress)?

cheers,
Cam.
Back to top
View user's profile Send private message
KirkMcDonald



Joined: 22 Jun 2006
Posts: 23

PostPosted: Fri Nov 23, 2007 3:09 pm    Post subject: Reply with quote

Sorry for the delay in replying. I don't check this forum very often.

Yes! Please send me a patch! Though I don't have a Mac to test these things on, I am willing to add code supporting it.

This is probably obvious, but be sure that, whatever changes you make to dcompiler.py, it doesn't break compilation on Linux.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> PyD All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group