g++ and g77 compile for OSX


 
Thread Tools Search this Thread
Top Forums Programming g++ and g77 compile for OSX
# 1  
Old 11-18-2011
g++ and g77 compile for OSX

I have an app based on g++ and g77 that I would like to compile for OSX. My understanding is that OSX is linux of some flavor under the hood and have seen OSX users running bash shells and such. Is there a tutorial of some kind out there that someone could point me to on the subject?

LMHmedchem
# 2  
Old 11-18-2011
OSX is UNIX under the hood, not Linux. It has an odd mixture of Linux and UNIX utilities -- a modified BSD kernel, a linux-like shell and nano editor, an extremely ancient BSD sed...

Installing Apple's xtools program would be a start. That will get you g++ and, optionally, GNU make. I'm not sure whether that might include fortran or not as well -- that's an optional part of gcc/g++ which Apple may not have thought to include. Check its options carefully when you install it.

Last edited by Corona688; 11-18-2011 at 02:24 PM..
# 3  
Old 11-18-2011
Quote:
Originally Posted by Corona688
OSX is UNIX under the hood, not Linux. It has an odd mixture of Linux and UNIX utilities -- a modified BSD kernel, a linux-like shell and nano editor, an extremely ancient BSD sed...

Installing Apple's xtools program would be a start. That will get you g++ and, optionally, GNU make. I'm not sure whether that might include fortran or not as well -- that's an optional part of gcc/g++ which Apple may not have thought to include. Check its options carefully when you install it.
I was hoping to be able to compile something under a linux or unix OS that would run on OSX. I don't have access to a mac at the moment and am trying to avoid having to get one.

Is this something I will have to compile on OSX to get it to work?

LMHmedchem
# 4  
Old 11-18-2011
xcode definitely does not have fortran by default. From man gcc on an OSX computer:
Code:
                                                         In particular, Apple
       does not currently support the compilation of Fortran, Ada, or Java,
       although there are third parties who have made these work.

One of these third parties seems to be Fink.

Quote:
Originally Posted by LMHmedchem
I was hoping to be able to compile something under a linux or unix OS that would run on OSX. I don't have access to a mac at the moment and am trying to avoid having to get one.
Doesn't work that way. Cross-compiling usually means compiling for a different architecture of the same operating system, not a different one. Otherwise there's just too many differences; different formats, different headers, different environment... Apple's gcc is fairly eccentric too and unlikely to work on a non-Apple computer.

Besides -- what good is a program you can't test?
Quote:
Is this something I will have to compile on OSX to get it to work?
Quite probably.

You don't need a new mac or a good mac to do so, though. Look for a cheap mac on ebay that has a x86 processor.
# 5  
Old 11-18-2011
Quote:
Originally Posted by Corona688
xcode definitely does not have fortran by default.
I contacted the coder I am setting this up for and they have both g77 and gfortran 4.4 with xcode tools, so that is a start.

Quote:
Originally Posted by Corona688
Doesn't work that way. Cross-compiling usually means compiling for a different architecture of the same operating system, not a different one. Otherwise there's just too many differences; different formats, different headers, different environment... Apple's gcc is fairly eccentric too and unlikely to work on a non-Apple computer.
I was hoping to get lucky. It has always been my SOP to install the necessary flavor of linux, compile, build, and test to make sure that there will be minimal issues on the other end. This came a bit out of left field, so I was hoping for a quick fix. Quick fixes don't often pan out all that well, so it's probably for the best. I seem to spend allot of time fixing quick fixes that were made in the past.

Quote:
Originally Posted by Corona688
Besides -- what good is a program you can't test? Quite probably.
There are competent folks on the other end who could have helped with this, but that's never as straight forward as doing it yourself.

Quote:
Originally Posted by Corona688
You don't need a new mac or a good mac to do so, though. Look for a cheap mac on ebay that has a x86 processor.
This is a good tip, hopefully I can pick something up without breaking the bank. Since a MAC is now Intel hardware, can I get OSX running on an Intel box or virtualized, vbox, vmware, etc?

LMHmedchem
# 6  
Old 11-18-2011
Quote:
Originally Posted by LMHmedchem
I contacted the coder I am setting this up for and they have both g77 and gfortran 4.4 with xcode tools, so that is a start.
I don't suppose he could just give you ssh access to his computer?

Quite safe for him to do if he gives you your own account. You can't manipulate the GUI without a GUI login. I couldn't even make my friend's computer beep over the internet.
Quote:
Originally Posted by LMHmedchem
Since a MAC is now Intel hardware, can I get OSX running on an Intel box or virtualized, vbox, vmware, etc?
It's possible but not trivial, and OSX is not free. You won't get it running without paying or pirating and I really shouldn't endorse the latter.

---------- Post updated at 01:01 PM ---------- Previous update was at 12:55 PM ----------

Quote:
Originally Posted by LMHmedchem
I contacted the coder I am setting this up for and they have both g77 and gfortran 4.4 with xcode tools, so that is a start.
Wow, Apple needs to update their manual page Smilie
# 7  
Old 11-18-2011
Quote:
Originally Posted by Corona688
I don't suppose he could just give you ssh access to his computer?

Quite safe for him to do if he gives you your own account. You can't manipulate the GUI without a GUI login. I couldn't even make my friend's computer beep over the internet.
This is something I could look into.

Quote:
Originally Posted by Corona688
It's possible but not trivial, and OSX is not free. You won't get it running without paying or pirating and I really shouldn't endorse the latter.
I do believe folks should get paid for the software they write, unless they want to offer it up for free. I just think it might make more sense to pay for OSX and run it on a computer I already have if that is possible. I have been thinking of setting up virtual box or buying vmware, since I have a bunch of different OS going. I am still primarily working in XP 32-bit, so I thought I would wait until I got a new rig with more RAM.

LMHmedchem
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. OS X (Apple)

Osx terminal

hi all, first off thesis my first post so if i am not in the right forum, i apologize. i'm an absolute newbie to unix. i've been reading my books and studying my crib sheets etc. but... :/ i want to accomplish two things. 1. search and remove duplicate files i.e.. audio, doc alias etc.... (1 Reply)
Discussion started by: monkeyhateclean
1 Replies

2. OS X (Apple)

OSX and Kerberos

Our Network Security folks have mandated that we "Kerberize" our systems to allow them to perform an authenticated scan. This consists of instructions to change /etc/pam.d/sshd from: # sshd: auth account password session auth optional pam_krb5.so use_kcminit auth optional ... (0 Replies)
Discussion started by: jnojr
0 Replies

3. UNIX for Dummies Questions & Answers

Using gFORTRAN to compile something built for g77

Hi, I am having a problem compiling a program with gfortran. The program compiles with g77 and f77 but I don't have those. I edited the makefile from FC = g77 to FC = gfortran but when I run it I get a slew of undefined reference errors. Any suggestions? (8 Replies)
Discussion started by: butson
8 Replies

4. OS X (Apple)

OSX 10.7 and rsh

Hi Guys What do i need to change so that anyone can rsh into the machine, i am sure it is in the pam.d/rshd buti am hving and issue wiith it, at the moment only someone who has a pysical account on the machine can rsh in even with all the users in the passwd file it does not work ... (2 Replies)
Discussion started by: ab52
2 Replies

5. UNIX for Dummies Questions & Answers

Compiling gcc to compile make to compile yaboot

I have just installed OpenBSD on a 333MHz PPC iMac G3. It has a 6GB HDD that has been partitioned as 1GB MacOS 8.5.1, 3GB MacOS X 10.3.9, 2GB OpenBSD 4.8. I now need to install a bootloader so that my computer can recognize the OpenBSD partition at startup. I have been trying to install... (0 Replies)
Discussion started by: t04st3r
0 Replies

6. Red Hat

g77 compiler: where it is for red hat? solved

Hi all In order to build a library the g77 fortran compiler is required. I know that it is very old, but this is the requirement in order to compile this package and it seems not possible to move away from it. The problem is that I really don't know where to get this old package! I tried in... (0 Replies)
Discussion started by: manustone
0 Replies

7. OS X (Apple)

Optimizing OSX

Hi forum, I'm administrating a workstation/server for my lab and I was wondering how to optimize OSX. I was wondering what unnecessary background tasks I could kick off the system so I free up as much memory and cpu power. Other optimization tips are also welcome (HD parameters, memory... (2 Replies)
Discussion started by: deiphon
2 Replies

8. Programming

multithreading on OSX

Hi all, I have a query about multithreading. What I would like to do is, at the start of my main update() function, start a couple of threads in parallel, once they are all complete carry on with my main update function. void update() { thread1->update(); // fluid solver ... (3 Replies)
Discussion started by: memoid
3 Replies

9. AIX

g77??

hello aixperts, I really need g77 on an aix 5L 5.3 system as I do not have xlf right now, is there any way by which I can get it? eagerly waiting for the reply, MzZt. (1 Reply)
Discussion started by: mzzt
1 Replies

10. OS X (Apple)

(OSX) Capitalization using tr

Mac OSX Terminal/Unix question I would like to capitalize the words at the beggining of sentences using the tr command, im not sure if this is possible, if not please tell me another way, I oly have TextEdit, no auto capitalization so just having a quick Unix way 'round it would be great. (2 Replies)
Discussion started by: H1tokori
2 Replies
Login or Register to Ask a Question