Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Dec 31, 2006, 02:56 PM   #1
wmmk
macrumors 68020
 
wmmk's Avatar
 
Join Date: Mar 2006
Location: The Library.
porting linux Qt apps to OS X (for a n00b)

hello devs!
just saw that LightCrafts LightZone was upgraded to 2.0 recently, but the price is now $249, which is rather steep. I also found that they give away a Linux binary away for free. Just for fun I downloaded that and tried to run it in X11. Of course, it didn't work. Anyway, considering that OS X is UNIX- based, I'd expect that there's some way to get this to work. What can I do?
Thanks,
wmmk

Last edited by wmmk; Jan 7, 2007 at 01:07 PM. Reason: title change
wmmk is offline   0 Reply With Quote
Old Dec 31, 2006, 03:32 PM   #2
Super Macho Man
macrumors 6502a
 
Join Date: Jul 2006
Location: Hollywood, CA
I know that FreeBSD for x86 includes an optional Linux binary compatibility package. Mac OS X is based on FreeBSD but uses a different kernel. So maybe there is a similar solution for OS X (probably not). Of course you would need to have an Intel processor even if it were possible.

Otherwise you would probably have to use something like Virtual PC (PowerPC Macs) or Parallels/Boot Camp (Intel Macs) and install Linux in a VM.
Super Macho Man is offline   0 Reply With Quote
Old Jan 1, 2007, 01:00 AM   #3
Eric5h5
macrumors 68020
 
Join Date: Dec 2004
Quote:
Originally Posted by wmmk View Post
What can I do?
Nothing. OS X isn't Linux and Linux binaries won't work. If you had the source code you could try porting it though.

--Eric
Eric5h5 is offline   0 Reply With Quote
Old Jan 1, 2007, 09:55 AM   #4
GFLPraxis
macrumors 604
 
GFLPraxis's Avatar
 
Join Date: Mar 2004
You could install Linux into Parallels...
__________________
Impraxical - My New Blog
MacBook CD/2GHz/2GB/160GB/SD
Hackintosh Core 2 Quad/2.4 GHz/4GB/660GB/8800GT
16 GB iPhone
GFLPraxis is offline   0 Reply With Quote
Old Jan 1, 2007, 10:14 AM   #5
Mitthrawnuruodo
Moderator
 
Mitthrawnuruodo's Avatar
 
Join Date: Mar 2004
Location: Bergen, Norway
See if you can get it using Fink...
__________________
Those who fail to learn history are doomed to repeat it; those who fail to learn history correctly... why, they are simply doomed.
Mitthrawnuruodo is offline   0 Reply With Quote
Old Jan 1, 2007, 10:16 AM   #6
speakerwizard
macrumors 68000
 
speakerwizard's Avatar
 
Join Date: Aug 2006
Location: London
couldnt installin x11 help? i think this is out of my league so ill shut up now lol
__________________
mac pro octo-core, 10GB, 5.25TB, 8800GT, 30"acd
iphone 3G, Macbook pro C2D
speakerwizard is offline   0 Reply With Quote
Old Jan 1, 2007, 10:19 AM   #7
mkrishnan
Moderator emeritus
 
mkrishnan's Avatar
 
Join Date: Jan 2004
Location: Grand Rapids, MI, USA
Quote:
Originally Posted by GFLPraxis View Post
You could install Linux into Parallels...
Probably the most expedient solution... I think with systems like Fink, it's not that complex to re-engineer source code to run in Fink on OS X, but this is closed-source app.

BTW, does anyone use this app? I've never heard of it on photography websites before.
__________________
Mohan
mkrishnan is offline   0 Reply With Quote
Old Jan 1, 2007, 01:03 PM   #8
risc
macrumors 68030
 
risc's Avatar
 
Join Date: Jul 2004
Location: Melbourne, Australia
Quote:
Originally Posted by speakerwizard View Post
couldnt installin x11 help? i think this is out of my league so ill shut up now lol
No; the only way having X11 installed would help is if the app was open source and the OP had the time to compile it (and all it's deps) for OS X. Since this app is closed source though there is no way it will work.
__________________
A penny saved is ridiculous.
risc is offline   0 Reply With Quote
Old Jan 1, 2007, 01:14 PM   #9
mkrishnan
Moderator emeritus
 
mkrishnan's Avatar
 
Join Date: Jan 2004
Location: Grand Rapids, MI, USA
Quote:
Originally Posted by risc View Post
No; the only way having X11 installed would help is if the app was open source and the OP had the time to compile it (and all it's deps) for OS X. Since this app is closed source though there is no way it will work.
Yes, absolutely. X11 is only a small subset of the APIs that the Linux binary needs access to, in order to run.

I was curious about the linux compatibility layer in BSD so I did some reading about it... can anyone help me understand what I read?

1) From what I understand, the linux compatibility layer is a relatively late addition to the FreeBSD kernel, and acts primarily at the kernel level.

2) OS X uses Mach, which is a somewhat older branching of FreeBSD, at least in the sense that NeXT was working with Mach before Linux really became so prominent as it is now.

3) So this means that Mach didn't inherit the compatibility layer, and as the kernel is owned by Apple, the fact that the compatibility layer has been developed by the FreeBSD people is pretty much useless towards the goal of an OS X / Linux compatibility layer, because only Apple can implement it by implementing it in their kernel.

Is that basically correct?

Don't get me wrong... in this proximal issue, this is nonsense to me. This application is readily available for OS X. If you want it, pay for it. But I'm curious about the general issue.
__________________
Mohan
mkrishnan is offline   0 Reply With Quote
Old Jan 1, 2007, 01:17 PM   #10
Compile 'em all
macrumors 601
 
Compile 'em all's Avatar
 
Join Date: Apr 2005
Quote:
Originally Posted by Mitthrawnuruodo View Post
See if you can get it using Fink...
Second the Fink advice. If you ever used Debian and apt-get, you will feel at home with fink. You can check as well Darwin ports.
Compile 'em all is offline   0 Reply With Quote
Old Jan 1, 2007, 01:23 PM   #11
risc
macrumors 68030
 
risc's Avatar
 
Join Date: Jul 2004
Location: Melbourne, Australia
Quote:
Originally Posted by mkrishnan View Post
Is that basically correct?
OS X uses the XNU kernel not the FreeBSD one. So the tools wont be part of OS X. You can read more about the FreeBSD Linux compatibility layer here: http://www.freebsd.org/doc/en_US.ISO.../linuxemu.html
__________________
A penny saved is ridiculous.
risc is offline   0 Reply With Quote
Old Jan 1, 2007, 01:26 PM   #12
Compile 'em all
macrumors 601
 
Compile 'em all's Avatar
 
Join Date: Apr 2005
Quote:
Originally Posted by mkrishnan View Post
Yes, absolutely. X11 is only a small subset of the APIs that the Linux binary needs access to, in order to run.

I was curious about the linux compatibility layer in BSD so I did some reading about it... can anyone help me understand what I read?

1) From what I understand, the linux compatibility layer is a relatively late addition to the FreeBSD kernel, and acts primarily at the kernel level.

2) OS X uses Mach, which is a somewhat older branching of FreeBSD, at least in the sense that NeXT was working with Mach before Linux really became so prominent as it is now.

3) So this means that Mach didn't inherit the compatibility layer, and as the kernel is owned by Apple, the fact that the compatibility layer has been developed by the FreeBSD people is pretty much useless towards the goal of an OS X / Linux compatibility layer, because only Apple can implement it by implementing it in their kernel.

Is that basically correct?
Just a minor correction.

Apple doesn't own the Mach kernel. OS X is based on the XNU kernel which is a hybrid kernel (as opposed to being monolithic or micro kernel). XNU is made up of the Mach kernel and FreeBSD components.

EDIT: risc beat me to it.
Compile 'em all is offline   0 Reply With Quote
Old Jan 1, 2007, 01:28 PM   #13
risc
macrumors 68030
 
risc's Avatar
 
Join Date: Jul 2004
Location: Melbourne, Australia
Quote:
Originally Posted by Compile 'em all View Post
Second the Fink advice. If you ever used Debian and apt-get, you will feel at home with fink. You can check as well Darwin ports.
Closed source apps are not going to be part of Fink or MacPorts. The FreeBSD Linux compatibility is kernel based so you will not find that at either location either.
__________________
A penny saved is ridiculous.
risc is offline   0 Reply With Quote
Old Jan 1, 2007, 01:29 PM   #14
mkrishnan
Moderator emeritus
 
mkrishnan's Avatar
 
Join Date: Jan 2004
Location: Grand Rapids, MI, USA
Sorry, I meant own in a project management sense, not in an intellectual property sense. What I meant is that only Apple can implement a change on the kernel. Which means that the fact that the compatibility layer exists for a relatively close sibling of the OS X kernel doesn't mean that a third-party could just go and implement Linux compatibility in OS X easily.

But also thank you for clarifying about the hybridity. I keep saying Mach, but I do recognize that what Apple uses is not the current official Mach branch.
__________________
Mohan
mkrishnan is offline   0 Reply With Quote
Old Jan 2, 2007, 06:20 PM   #15
GeeYouEye
macrumors 68000
 
GeeYouEye's Avatar
 
Join Date: Dec 2001
Location: State of Denial
Send a message via AIM to GeeYouEye Send a message via Yahoo to GeeYouEye
Well, there's TECHNICALLY nothing stopping you from writing an ELF loader... but one does not exist at present.

Alternately, you could try downloading it (and binaries of all its dependencies), and running it in OpenFirmware, which DOES have an ELF loader.

Unfortunately, neither are very practical solutions.
__________________
I bring order to chaos. You are in chaos Windows, you are the contradiction, a bug wishing to be an OS.
Visit Softyards Software
NEW DEFINITION OF GEEK
Like politics, free speech, computers, entertainment, and more? Join us at Wordforge.net
GeeYouEye is offline   0 Reply With Quote
Old Jan 5, 2007, 11:33 PM   #16
wmmk
Thread Starter
macrumors 68020
 
wmmk's Avatar
 
Join Date: Mar 2006
Location: The Library.
no big deal. there is another app which I do have the source for, but I'm a n00b who has no idea about porting stuff. how would I go about this? thanks!
wmmk is offline   0 Reply With Quote
Old Jan 6, 2007, 12:53 AM   #17
therevolution
macrumors 6502
 
Join Date: May 2003
Quote:
Originally Posted by wmmk View Post
no big deal. there is another app which I do have the source for, but I'm a n00b who has no idea about porting stuff. how would I go about this? thanks!
Try to compile the source. Look at the errors. Fix them.
therevolution is offline   0 Reply With Quote
Old Jan 6, 2007, 08:00 PM   #18
wmmk
Thread Starter
macrumors 68020
 
wmmk's Avatar
 
Join Date: Mar 2006
Location: The Library.
Quote:
Originally Posted by therevolution View Post
Try to compile the source. Look at the errors. Fix them.
if it was obj-c, I could at least give this a shot, but it's Qt4. I tried configuring QT mac, but some directories were messed up or something. anyway, how would I go about correcting these errors. would this be obvious?
wmmk is offline   0 Reply With Quote
Old Jan 6, 2007, 09:52 PM   #19
MisterMe
macrumors G4
 
Join Date: Jul 2002
Location: USA
Quote:
Originally Posted by wmmk View Post
if it was obj-c, I could at least give this a shot, but it's Qt4. I tried configuring QT mac, but some directories were messed up or something. anyway, how would I go about correcting these errors. would this be obvious?
Qt is a C++ cross-platform framework. Objective-C is an object-oriented version of the C programming language.

If you need help, it might be useful to explain which OS, which version of Qt, and which development environment you are using.
__________________
Neither a borrower nor a lender be
For loan oft loses both itself and friend
William Shakespeare from Hamlet
MisterMe is offline   0 Reply With Quote
Old Jan 7, 2007, 01:05 PM   #20
wmmk
Thread Starter
macrumors 68020
 
wmmk's Avatar
 
Join Date: Mar 2006
Location: The Library.
Quote:
Originally Posted by MisterMe View Post
Qt is a C++ cross-platform framework. Objective-C is an object-oriented version of the C programming language.

If you need help, it might be useful to explain which OS, which version of Qt, and which development environment you are using.
what i meant by the obj-c thing was that maybe then I could get this working in xcode, which I've used a bit. I'm not a programmer, just a photographer who wants to use a linux HDR creation app, and all of this is a bit over my head. To answer your question I'm using OS X 10.4.8, trying to use Qt4, and I don't even know what development environment I'm trying to use.

If it helps, the developer of the app sent me this a while ago
Quote:
Originally Posted by Giuseppe Rota, developer of qtpfsgui
Hi,
I wanted to give it a try with the compiling process on mac:
first you need to download Qt4 from
www.trolltech.com/developer/downloads/qt/mac
then I found out that there's a darwin port of exiv2 as well, at:
exiv2.darwinports.com
the website right now doesn't seem to work, I found the google cache:
209.85.135.104/search?q=cache:yxwKEdb9SWAJ:exiv2.darwinports.com/+darwinports+exiv2&hl=en&ct=clnk&cd=1&client=firefox-a
As an alternative you can download the sources of exiv2 from:
www.exiv2.org/exiv2-0.12.tar.gz
untar it with:
tar xzf evix2-0.12.tar.gz
cd exiv2-0.12
./configure
make
make install
(last step as root)
Once you have Qt4 and exiv2 installed you can download the sources of qtpfsgui, type:
qmake
then with:
make
you compile the sources; at the end of the process you can run it with
./qtpfsgui
that should be it. I'd like to stress the "should" part because OS X could have its quirks that I don't know about.
Let me know,
Giuseppe
I know it seems cut and dry, but I just couldn't get Qt to configure properly...
wmmk is offline   0 Reply With Quote
Old Jan 7, 2007, 04:08 PM   #21
MisterMe
macrumors G4
 
Join Date: Jul 2002
Location: USA
Quote:
Originally Posted by wmmk View Post
.... I'm not a programmer, just a photographer who wants to use a linux HDR creation app, and all of this is a bit over my head. To answer your question I'm using OS X 10.4.8, trying to use Qt4, and I don't even know what development environment I'm trying to use.

....
Instead of worrying about trying to compile an app, you should concern yourself with finding a MacOS X app which does what you need done. If you install the Qt4 frameworks on your Mac, any Qt4-dependent app which you install should just work. Again, which Linux HDR creation app and is there a Mac version of it already?
__________________
Neither a borrower nor a lender be
For loan oft loses both itself and friend
William Shakespeare from Hamlet
MisterMe is offline   0 Reply With Quote
Old Jan 7, 2007, 07:32 PM   #22
wmmk
Thread Starter
macrumors 68020
 
wmmk's Avatar
 
Join Date: Mar 2006
Location: The Library.
Quote:
Originally Posted by MisterMe View Post
Instead of worrying about trying to compile an app, you should concern yourself with finding a MacOS X app which does what you need done. If you install the Qt4 frameworks on your Mac, any Qt4-dependent app which you install should just work. Again, which Linux HDR creation app and is there a Mac version of it already?
the app is qtpfsgui (I linked to it earlier in this thread), no, there is not a mac version of it, and there is no open source Mac app that does the same thing. I know that there are free HDR mac apps, but they use tone mapping engines that I don't really like the output of, whereas qtpfsgui uses many operators, including the fattal contrast enhancing engine, which I really like. Anyway, this app is only available as platform independent source and Windows exe, so I'll have to compile.
wmmk is offline   0 Reply With Quote
Old Jan 10, 2007, 04:34 PM   #23
wmmk
Thread Starter
macrumors 68020
 
wmmk's Avatar
 
Join Date: Mar 2006
Location: The Library.
does anyone have any tips for this? sorry to bump, but this is really important for me
thanks/sorry...
wmmk is offline   0 Reply With Quote
Old Jan 10, 2007, 06:45 PM   #24
Grover
macrumors member
 
Join Date: May 2004
If it helps, I tried this and QT4 installed fine for me following the instructions in their README file. Basically I did this:

1. Unzip and untar to desktop
2. CD into resulting directory
3. ./configure -universal
4. make
5. sudo make install
6. Add:

PATH=/usr/local/Trolltech/Qt-4.2.2/bin:$PATH
export PATH

to ~/.profile

I then compiled and installed exiv2 according to the instructions in their README - unzip, untar, cd to resulting directory and:

1. ./configure --without-zlib (because there was some other dependency I didn't want to fool with just to see if I could get this compiled.)
2. make
3. sudo make install

All of that appeared to go well.

Now when I went to compile qtpfsgui I got past the qmake stage OK (after changing the location of exiv2 to match the OSX path in the project.pro file as the instructions required).

At that point I went to make qtpfsgui and I get this:

src/hdrcreate/createhdr.cpp:15: error: 'open_memstream' was not declared in this scope
make: *** [generated_obj/createhdr.o] Error 1

At that point the code looks like:

Code:
#ifdef _WIN32
void       createHDR(QList<QImage*> &list, const float * arrayofexptime, config_triple* chosen_config, bool antighosting, int iterations, const char * outfname) {
    FILE *fpout=fopen(outfname,"wb");
#else
QByteArray createHDR(QList<QImage*> &list, const float * arrayofexptime, config_triple* chosen_config, bool antighosting, int iterations){
    //prepare "fake" FILE* where pfs library will write the output hdr to, in pfs stream format.
    char *pfshdr;
    size_t size;
    FILE * fpout=open_memstream(&pfshdr, &size);
#endif
So we're getting into the unix-specific code correctly and it's failing there. I'm not sure why - maybe open_memstream has some trick to it on OSX. Hopefully this is enough of a clue for someone else to spot what's going on.

Anyway, I didn't get the whole thing working but I can say that QT4 appears to install fine for me on an Intel Mac (for anyone else who wants to try this, be forewarned that building it takes a good long time) so with any luck you'll be able to get over that hurdle. It was necessary to read the documentation to catch that I had to specify the flag for a universal build and that I needed to add QT to my path so if you didn't do that, that may have been your QT problem.
Grover is offline   0 Reply With Quote
Old Jan 11, 2007, 04:03 PM   #25
wmmk
Thread Starter
macrumors 68020
 
wmmk's Avatar
 
Join Date: Mar 2006
Location: The Library.
Quote:
Originally Posted by Grover View Post
If it helps, I tried this and QT4 installed fine for me following the instructions in their README file. Basically I did this:

1. Unzip and untar to desktop
2. CD into resulting directory
3. ./configure -universal
4. make
5. sudo make install
6. Add:

PATH=/usr/local/Trolltech/Qt-4.2.2/bin:$PATH
export PATH

to ~/.profile

I then compiled and installed exiv2 according to the instructions in their README - unzip, untar, cd to resulting directory and:

1. ./configure --without-zlib (because there was some other dependency I didn't want to fool with just to see if I could get this compiled.)
2. make
3. sudo make install

All of that appeared to go well.

Now when I went to compile qtpfsgui I got past the qmake stage OK (after changing the location of exiv2 to match the OSX path in the project.pro file as the instructions required).

At that point I went to make qtpfsgui and I get this:

src/hdrcreate/createhdr.cpp:15: error: 'open_memstream' was not declared in this scope
make: *** [generated_obj/createhdr.o] Error 1

At that point the code looks like:

Code:
#ifdef _WIN32
void       createHDR(QList<QImage*> &list, const float * arrayofexptime, config_triple* chosen_config, bool antighosting, int iterations, const char * outfname) {
    FILE *fpout=fopen(outfname,"wb");
#else
QByteArray createHDR(QList<QImage*> &list, const float * arrayofexptime, config_triple* chosen_config, bool antighosting, int iterations){
    //prepare "fake" FILE* where pfs library will write the output hdr to, in pfs stream format.
    char *pfshdr;
    size_t size;
    FILE * fpout=open_memstream(&pfshdr, &size);
#endif
So we're getting into the unix-specific code correctly and it's failing there. I'm not sure why - maybe open_memstream has some trick to it on OSX. Hopefully this is enough of a clue for someone else to spot what's going on.

Anyway, I didn't get the whole thing working but I can say that QT4 appears to install fine for me on an Intel Mac (for anyone else who wants to try this, be forewarned that building it takes a good long time) so with any luck you'll be able to get over that hurdle. It was necessary to read the documentation to catch that I had to specify the flag for a universal build and that I needed to add QT to my path so if you didn't do that, that may have been your QT problem.
wow! thank you so(!) much!
this will be immensely helpful!
I'll get as far as I can with this, then MSN with the dev (he's in Italy) on saturday afternoon. hopefully, there will be a universal OS X build of qtpfsgui by Sunday morning. maybe I'll even photoshop some new buttons to make it mire mac-like!
wmmk is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
iPad: Help porting! thedeejay Jailbreaks and iOS Hacks 0 Feb 4, 2014 12:51 AM
Complete n00b to DAWs need help... Noetics Digital Audio 15 Nov 15, 2013 11:39 AM
Free Ubuntu Linux/basic Linux manual? RedCroissant Windows, Linux & Others on the Mac 7 Feb 6, 2013 12:48 AM
Safari n00B question apollo1444 OS X 10.8 Mountain Lion 5 Jan 22, 2013 08:12 AM
Porting HID code from Linux to OS X Starfox Mac Programming 5 Sep 12, 2012 11:58 AM

Forum Jump

All times are GMT -5. The time now is 12:12 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC