MINDMAKERS Forum
Welcome, Guest. Please login or register.
September 09, 2010, 08:48:20 AM

Login with username, password and session length
Search:     Advanced search
NB: Spam bots are becoming smarter every day - we had to turn off regular registration. To become member, please send email to Kris Thorisson ([kris'_lastname] att ru dott is).
337 Posts in 99 Topics by 99 Members
Latest Member: peterwit
* Home Help Search Login Register
+  MINDMAKERS Forum
|-+  Projects
| |-+  Psyclone (Moderator: cmlabs)
| | |-+  Running on mac os x gcc 4
« previous next »
Pages: [1] Print
Author Topic: Running on mac os x gcc 4  (Read 3485 times)
eric
Newbie
*
Posts: 9


View Profile Email
« on: March 16, 2007, 04:42:50 PM »

Does anyone have experience running Psyclone on macs?

I installed 1.1.0 on an intel mac and psyclone tries to load cranks from a .so lib instead of a .dylib

any ideas would be welcome!

cheers

eric
Logged
thorlist
Jr. Member
**
Posts: 51


thorlist
View Profile WWW Email
« Reply #1 on: March 18, 2007, 02:00:00 PM »

Hi Eric,

> Does anyone have experience running Psyclone on macs?
> I installed 1.1.0 on an intel mac and psyclone tries to load cranks from a .so
> lib instead of a .dylib
> any ideas would be welcome!

Because Mac OSX is basically a UNIX system underneath, all crank libraries created using the Psyclone SDK produce .so files and not .dylib files.

This is not a problem as .so files work just fine under Mac OSX and as such should work identically to any other UNIX based system.

Can I ask: When you compile your cranks using the Psyclone SDK, does it not produce a .so file? And if so, do you have any trouble using this .so file with Psyclone?

One thing to remember: On UNIX based systems .so files always contain the string 'lib'. So, if you name your library "mycranks" and use this ("mycranks") in the PsySpec XML file, your actual .so file needs to be called "libmycranks.so". This is UNIX standard, although not very intuitive...


Best,

Thor
Logged
eric
Newbie
*
Posts: 9


View Profile Email
« Reply #2 on: March 19, 2007, 04:01:40 PM »

Hi Thor,

The trouble comes when I use Xcode 2, having in mind the standardization of the dev process/tools for the students.

But, when I use a hand-written makefile, I can build .so files. Anyhow, I get:

dlcompat: no suitable image found. Did find <my shared object file>: mach-o, but wrong architecture.

I added the flag -arch i386, without any success.

any idea?

eric
« Last Edit: March 19, 2007, 05:45:22 PM by eric » Logged
thorlist
Jr. Member
**
Posts: 51


thorlist
View Profile WWW Email
« Reply #3 on: April 14, 2007, 10:24:42 AM »

Hi Eric,

I believe that there on Mac are two different ways of creating and loading shared libraries.

The UNIX way is what is currently supported by the CoreLibrary and therefore by OpenAIR and Psyclone. (The CoreLibrary also supports the Windows way using dlls).

The Macintosh way is called dylib and is apparently somewhat different from the UNIX way, in that the libraries are created and loaded using different mechanisms only available on Macintosh.

We would love to support dylib as well and will be looking into this right away.

Have you worked with dylibs before and do you have any experience in working with these (creating and loading) on the Mac?


Best,

Thor
Logged
eric
Newbie
*
Posts: 9


View Profile Email
« Reply #4 on: April 16, 2007, 10:32:58 AM »

Hi Thor,

as far as I know, Mach-o is now the Macintel linker. It supports only one format, dylib, which can encapsulate PPC and Intel targets. dlopen / dlsym / dlclose are not supported,
according to http://developer.apple.com/technotes/tn2002/tn2071.html; dlopen can be emulated by:

const char *filename = argv[1];
NSObjectFileImage *fileImage;
NSModule handle;
NSObjectFileImageReturnCode *returnCode = NSCreateObjectFileImageFromFile(filename, &fileImage);

if(returnCode == NSObjectFileImageSuccess)
{
    handle = NSLinkModule(fileImage,filename, NSLINKMODULE_OPTION_RETURN_ON_ERROR | NSLINKMODULE_OPTION_PRIVATE);
    NSDestroyObjectFileImage(fileImage);
    if (handle) {
     /* code  here */
   }
}

However, this appears to work only for bundles, not shared libs. I tired the standard dlopen way, and seems to work fine. Apple is really not clear about all that.

Anyway, in order to cope with the current issue we experience (and we're pretty much in a hurry), if Psyclone had been compiled on a PPC mac, it might be useful to recompile it on a macintel, using, say, xcode2/Mach-o, to generate an executable that can load code for both PPC and Intel, which I don't think was possible on a PPC-mac-os-x.

What do you think?

eric

Logged
thorlist
Jr. Member
**
Posts: 51


thorlist
View Profile WWW Email
« Reply #5 on: April 16, 2007, 10:51:41 AM »

Hi Eric,

I think that we should definitely try to recompile everything on a MacIntel, but we do need to keep the build-process general by using GCC and Makefiles.

We are using dlopen and friends to load our libraries.

I would assume that it would be possible to build our code using GCC and link with binaries built using XCode2, by using certain GCC flags available under Darwin. Do you have any information or experience with this? Does XCode use the standard GCC compiler or do you know if it is binarily compatible with GCC?

This is all part of the OpenSource CoreLibrary, which means that we can test all this on your computers using all OpenSource code. We even have created a UnitTest for the DynamicLoader class, which is used for the purpose of loading shared libraries...


Best,

Thor


Logged
eric
Newbie
*
Posts: 9


View Profile Email
« Reply #6 on: April 16, 2007, 10:58:49 AM »

Hi Thor,

Xcode2 can be configured to use GCC 4.0 or 3.x.x. So I guess that I can do the recompilation job here. Anyhow, the time here is getting very short, so any help from your side would be appreciated.

Thanks,

eric
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!