Unable to compile modules [OSX Lion]

Archives Forums/BlitzMax Bug Reports/Unable to compile modules [OSX Lion]

Nigel Brown(Posted 2011) [#1]
I have just upgraded from Snow leopard to Lion and updated to the latest BlitzMAX and Xcode. I am unable to build modules without the following:

sh: gcc-4.2: command not found

OSX: 10.7.2
BCC: 1.44(b)
Path: /Applications/BlitzMax
GCC Version: 4.2.1
G++ Version 4.2.1
Xcode 4.2


Nigel Brown(Posted 2011) [#2]
I have had to make two symbolic links to get any modules to build, I don't think this is the best way to solve the problem, advice from the powers that be would be good?

sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
sudo ln -s /usr/bin/g++ /usr/bin/g++-4.2


marksibly(Posted 2011) [#3]
Hi,

I've upgraded here, and have had no problems.

Typing 'gcc-4.2' or 'g++-4.2' from a shell also works fine.

Did you upgrade to xcode 4.2, or is it the first time you've installed xcode on Lion?

Also, my 'upgrade' didn't exactly go smoothly - the AppStore install failed towards the end so I had to manually find/run the 'install xcode.app' app it left behind.

With the latest xcode, it may now be possible for bmk to just use plain gcc/g++ (which are the llvm versions I think) anyway. I will have a look into this...


GfK(Posted 2011) [#4]
>>>the AppStore install failed towards the end so I had to manually find/run the 'install xcode.app' app it left behind

That's normal. Xcode3 was the same.


Pit-le-rouge(Posted 2011) [#5]
Same problem for me:
sh: g++-4.2: command not found


Pit-le-rouge(Posted 2011) [#6]
Well... is there anybody in there ???


xlsior(Posted 2011) [#7]
Nigel's workaround above will make it work for you.

Apparently BRL hasn't been able to replicate the problem themselves, so there is no 'official' fix at this point.


matt!(Posted 2011) [#8]
I am also having this issue.

My situation: that I've just bought a new iMac and migrated all my data. I tried reinstalling Xcode from the Mac App Store but no joy.

Nigel's solution above worked for me, though.

Last edited 2011


Grey Alien(Posted 2011) [#9]
i also cannot build on of my Grey Alien Framework modules. My situation is that I have a new Macbook Air with Lion and BlitMax 1.44. Originally I had XCode 4 (or maybe it was 4.1) and I was able to use Blitzmax to compile modules totally fine. I recently upgraded to XCode 4.2 in order to ship some iOS titles, and it's since I did this that the module compiling fails. So this was not a convoluted upgrade path, it was a very simple upgrade of XCode to the most current version.

Here are the errors I'm getting:



Last edited 2011


AdamRedwoods(Posted 2011) [#10]
Those header files you're missing are under the iPhone LLVM stuff.


Grey Alien(Posted 2011) [#11]
I don't even know what LLVM? This is one objective C file called GAGMacLib.m that I wrote before iPhone existed.


GaryV(Posted 2011) [#12]
I don't even know what LLVM?

The Low Level Virtual Machine (LLVM) is a compiler infrastructure written in C++ that is designed for compile-time, link-time, run-time, and "idle-time" optimization of programs written in arbitrary programming languages.


matt!(Posted 2011) [#13]
Odd that they're all 10.6?

When you installed Xcode did you deselect the 10.6 stuff? Try reinstalling and leaving that selected?


Grey Alien(Posted 2011) [#14]
10.6 is still installed and those files in the list are present. That's what's weird about this.


AdamRedwoods(Posted 2011) [#15]
Huh, so those files are GCC files, here's the path on my system:
/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin10/4.2.1/include


you may need to make links to those files, or copy them, to wherever it's trying to search for them.

EDIT:
The compiler may be getting confused on which file to use. That is why it may be messing up. There's two different versions. One in the link that I showed above and the link where you're getting the errors.

Try swapping them (make backups)?

EDIT AGAIN:
Yup, OSX Lion moves the GCC location (jerks!):
http://superuser.com/questions/313107/does-updating-to-os-x-lion-delete-gcc

Last edited 2011


Grey Alien(Posted 2011) [#16]
Interesting thanks Adam! I do have the correct files in that same path you mentioned above: (/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin10/4.2.1/include) so yeah it seems the compiler is looking at my OSX10.6 files instead of those ones.

I followed that link you posted and added :/Developer/usr/bin to my $PATH variable but that didn't work. Same result. (my PATH was this before: /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin. I found that out by typing echo $PATH in terminal.)

I also checked Developer/usr/bin/ and there is an alias called gcc and another called g++ that point to Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 and Developer/usr/llvm-gcc-4.2/bin/llvm-g++-4.2. So in theory everything is fine there. Something higher up in the BMax module building must be ignoring all that and going straight for the MacOSX10.6.sdk folder instead... Unfortunately I have no knowledge of how the BlitzMax internals of gcc work :-(

[EDIT]I just renamed my Developer/usr/bin/ folder and copied the bin folder from Developer/usr/llvm-gcc-4.2/ into its place and renamed the llvm-g++-4.2 and llvm-gcc-4.2 files to be just g++ and gcc, but still have the same result i.e. moaning about MacOSX10.6.sdk

Last edited 2011


BlitzSupport(Posted 2011) [#17]
Just did a search and found there are a couple of references to this string in bmk_util.bmx, under CompileC() and LinkApp():

/Developer/SDKs/MacOSX10.6.sdk


Perhaps have a fiddle with those.


Grey Alien(Posted 2011) [#18]
Thanks James, I found those 2 refs and changed them to 10.7 but the error still exists. Does that bmk_util.bmx need to be compiled or something?

Something interesting in the changes log was this:

* Fullscreen mode doesn't seem to work on Lion with 10.7 SDK, but does with 10.6 so kludged BMK to use 10.6 when building on Lion. Not at all pretty, but will have to do for now as I really have no idea what is going on with this one.

So I wonder if the "kludge" was undone, it would build modules (but full-screen would fail) and then I could reset the kludge to compile my game...Problem is I don't know what was in that file before. I guess I could download blitzmax 1.42 and see...

[Edit] I downloaded 1.42 and copied across bmk_util but still got the 10.6 error which suggests that bmk_util is compiled or something. Or it's a completely different bug I'm getting. Also I tried to run the 1.42 IDE but it doesn't run on Lion which is why I guess the 1.43 version came out except now you can only get 1.43b.

Last edited 2011


BlitzSupport(Posted 2011) [#19]

Does that bmk_util.bmx need to be compiled or something?


Yeah, you'd have to rebuild bmk.bmx (with "Build GUI App" OFF), which (indirectly) imports bmk_util.bmx, then move the resulting bmk executable to the BlitzMax\bin folder.

Last edited 2011


AdamRedwoods(Posted 2011) [#20]
try putting the
/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin10/4.2.1/include

in your path?

The other option is to hard-code the path into the MacOSXSDK10.6 stdarg.h.

Here's a possible explanation, since I think mark is using "-isysroot /Developer/SDKs/MacOSX10.6.sdk" in bmk_utils.bmx:
http://hintsforums.macworld.com/showthread.php?t=107057

Other people having similar problems:
http://lists.apple.com/archives/xcode-users/2009/Jan/msg00410.html
http://www.cocoabuilder.com/archive/cocoa/308737-sdk-10-5-on-xcode-4-1.html?q=stdarg#308746
http://www.cocoabuilder.com/archive/xcode/289217-errors-linking-to-stdarg-and-float.html?q=stdarg#290073

Last edited 2011


Grey Alien(Posted 2011) [#21]
Thanks James. But is it even possible to rebuild that file with my build modules problem? (catch 22). I tried Build modules in the IDE but it did nothing. Is there a command line (Terminal) statement to build mods on Mac? Thx for any help in advance!

@Adam: OK I can try that path out. Thanks for the links, will follow up on them. May have been to some of them before in my endless research.


BlitzSupport(Posted 2011) [#22]
I hadn't noticed a Build Mods problem (OK, so I haven't read all the thread!) but bmk isn't a module, just a standard command-line utility, so, provided you build it as one, and move it to the /bin folder, it ought to work! (If that's the cause.)

EDIT: Ohhhh... hang on... perhaps it won't build as a standard program either (sorry, no modern Mac here). I guess we need some other kindly x86/latest OS X) reader [or Mark!] to build and upload?)

Last edited 2011


Grey Alien(Posted 2011) [#23]
Agreed. We need a kindly reader! :-)

btw, if I type gcc-4.2 or g++-4.2 or gcc or g++ in terminal I get "no input files" so I guess PATH is setup right to point at those. I also have 10.6 and 10.7 sdks installed so this is pretty weird. So it doesn't sound like my prob is same as original posters, although the thread title still fits.

Last edited 2011


Grey Alien(Posted 2011) [#24]
@Adam Adding the path to my PATH didn't result in anything different. I can confirm that mark is using isysroot in bmk_util.bmx, but even if I change it, I can't recompile it. Need a friendly forum member to help out there, or supply a pre-lion compiled one.

Following your link I made gcc show what paths it's using:

gcc -v -x c -E /dev/null
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.1~1/src/configure --disable-checking --enable-werror --prefix=/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.1~1/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)
 /usr/llvm-gcc-4.2/bin/../libexec/gcc/i686-apple-darwin11/4.2.1/cc1 -E -quiet -v -imultilib x86_64 -iprefix /usr/llvm-gcc-4.2/bin/../lib/gcc/i686-apple-darwin11/4.2.1/ -D__DYNAMIC__ /dev/null -fPIC -mmacosx-version-min=10.7.2 -m64 -mtune=core2
ignoring nonexistent directory "/usr/llvm-gcc-4.2/bin/../lib/gcc/i686-apple-darwin11/4.2.1/../../../../i686-apple-darwin11/include"
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/../../../../i686-apple-darwin11/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/llvm-gcc-4.2/bin/../lib/gcc/i686-apple-darwin11/4.2.1/include
 /Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.
# 1 "/dev/null"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/dev/null"



Grey Alien(Posted 2011) [#25]
Update: OK so I downloaded BlitzMax 1.42 and copied bin/bmk into my 1.44 bin folder and the module compiles!! The problem is that full screen doesn't work. I think the full screen bug was the whole reason 1.43 was made.

So basically the 1.44 bmk file is not compatible with a update Mac using Lion and Xcode 4.2. That really needs fixing. Think I'll start a new thread to make it clear. Done: http://www.blitzbasic.com/Community/posts.php?topic=96562

Last edited 2011