Leopard first-time compilation problems


#1

Hi,

I’m new to a lot of things here - Mac development, Juce, and I’m more versed in other languages than C++, but there are various reasons why Juce seems worth checking out, so here I am.

Trying to get the libraries compiled under Leopard, XCode 3. I am using a config that looks like this:

ARCHS = ppc i386

// For 10.2 compatibility, use these values:
MACOSX_DEPLOYMENT_TARGET = 10.4
SDKROOT = (DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk GCC_VERSION_ppc = 4.0 MACOSX_DEPLOYMENT_TARGET_ppc = 10.2 OTHER_LD_FLAGS_ppc = (DEVELOPER_SDK_DIR)/MacOSX10.5.sdk/usr/lib/gcc/darwin/3.3/libstdc++.a
SDKROOT_ppc = $(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk

I’m not sure what a lot of this is, but I poked around looking for the files that XCode was complaining about, and I found these substitutions to work. I’m not sure about the GCC version - as I have both gcc-4.0 and gcc-4.0.1 files on my disk (OK, I don’t even know what GCC is. But that’s not the point of my question And I’m not sure if the ARCHS is correct either for a MacBook, but I figure I’ll find the docs on this part eventually also).

Anyway, I finally got XCode to stop complaining about missing files, and it starts compiling some hundreds of cpp files, and it stops when it gets a conversion error related to Sockets - I copied the error from the Build results window and pasted below. I appreciate any help you can give. Thanks.

cd /Users/warrensirota/Desktop/juce/build/macosx
/Developer/usr/bin/gcc-4.0 -x c++ -arch ppc -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type -Wunused-variable -D_DEBUG=1 -DDEBUG=1 -fmessage-length=0 -mtune=G5 -fvisibility=hidden -mmacosx-version-min=10.2 -gdwarf-2 -I/Users/warrensirota/Desktop/juce/build/macosx/../../bin/Juce.build/Debug/Juce.build/jucedebug.hmap -F/Users/warrensirota/Desktop/juce/build/macosx/../../bin -I/Users/warrensirota/Desktop/juce/build/macosx/../../bin/include -I/Users/warrensirota/Desktop/juce/build/macosx/../../bin/Juce.build/Debug/Juce.build/DerivedSources -isysroot /Developer/SDKs/MacOSX10.5.sdk -c /Users/warrensirota/Desktop/juce/build/macosx/../../src/juce_core/io/network/juce_Socket.cpp -o /Users/warrensirota/Desktop/juce/build/macosx/../../bin/Juce.build/Debug/Juce.build/Objects-normal/ppc/juce_Socket.o

/Users/warrensirota/Desktop/juce/build/macosx/…/…/src/juce_core/io/network/juce_Socket.cpp: In member function ‘juce::StreamingSocket* juce::StreamingSocket::waitForNextConnection() const’:
/Users/warrensirota/Desktop/juce/build/macosx/…/…/src/juce_core/io/network/juce_Socket.cpp:460: error: invalid conversion from ‘int*’ to ‘socklen_t*’
/Users/warrensirota/Desktop/juce/build/macosx/…/…/src/juce_core/io/network/juce_Socket.cpp:460: error: initializing argument 3 of ‘int accept(int, sockaddr*, socklen_t*)’
/Users/warrensirota/Desktop/juce/build/macosx/…/…/src/juce_core/io/network/juce_Socket.cpp: In member function ‘juce::DatagramSocket* juce::DatagramSocket::waitForNextConnection() const’:
/Users/warrensirota/Desktop/juce/build/macosx/…/…/src/juce_core/io/network/juce_Socket.cpp:572: error: invalid conversion from ‘int*’ to ‘socklen_t*’
/Users/warrensirota/Desktop/juce/build/macosx/…/…/src/juce_core/io/network/juce_Socket.cpp:572: error: initializing argument 6 of ‘ssize_t recvfrom(int, void*, size_t, int, sockaddr*, socklen_t*)’
/Users/warrensirota/Desktop/juce/build/macosx/…/…/src/juce_core/io/network/juce_Socket.cpp:460: error: invalid conversion from ‘int*’ to ‘socklen_t*’
/Users/warrensirota/Desktop/juce/build/macosx/…/…/src/juce_core/io/network/juce_Socket.cpp:460: error: initializing argument 3 of ‘int accept(int, sockaddr*, socklen_t*)’
/Users/warrensirota/Desktop/juce/build/macosx/…/…/src/juce_core/io/network/juce_Socket.cpp:572: error: invalid conversion from ‘int*’ to ‘socklen_t*’
/Users/warrensirota/Desktop/juce/build/macosx/…/…/src/juce_core/io/network/juce_Socket.cpp:572: error: initializing argument 6 of ‘ssize_t recvfrom(int, void*, size_t, int, sockaddr*, socklen_t*)’


#2

You can’t just bodge those flags and expect it all to work! As you can see if you look at the code that’s giving the error, I’ve had to do special workarounds because of differences between each edition of the apple SDK. So if you tell it that it’s doing a 10.2 build, but point it at the 10.5 libraries, it doesn’t stand a chance! Maybe you just need to install the 10.2 SDK.

The latest version that’s on Sourceforge should build ok, according to other people on the forum (I’m still avoiding installing leopard myself…)


#3

Well, it’s a new thing for me to have learning about build parameters be the first thing I learn about a new development system, but whatever works is good. That turned out to be just enough of a pointer for me to get the libraries compiled and demo app running.


#4

So what did you have to do to get it going? If there’s something else I should add to the build instructions for Leopard, I’d be keen to know.


#5

OK, well, there were a couple of stupidly obvious things (which still might be worth mentioning for total newbies to the environment) that were happening because I am new to Mac development and new to Xcode and was never a C++ jock… so I didn’t realize:

  • that I could install Xcode 2.5 from the Web alongside Xcode 3.0, and so I’d be able to follow along with any examples I encounter without that “wait a second, I don’t see that button on the screen” experience.
  • that I could/should target an OS version in any Xcode project, that I did that through Project/Edit Project Settings, that 2.8 was a good version to use as a target, that I could find it in the xcode tools 2…5 download file, that I couldn’t install it or put it in the same folder as the active sdks, but could put a copy wherever I wished
  • that the settings in the xcconfig file were standard Xcode flags and not specific to Juce
  • that sure, I could manually dork around with the xcconfig file, but that the Project Settings dialog gives me a very nice interface, complete with explanations
  • that I could make my life simpler just to get started by choosing a target of just i386, since right now I’d be happy to have things just running on my own MacBook, and that in that case any of the _ppc settings in the default xcconfig files became irrelevant so it didn’t matter if I’d already messed them up

This part wasn’t so ignorant, it was just something that anyone would have to do:

  • In Project Settings, set the Header Search Paths appropriately. On my computer, it’s set to /Users/warrensirota/Desktop/SDKs/MacOSX10.2.8.sdk/usr/include/gcc/darwin/3.3/c++,
    but I’m sure that there’s both a better place to have put the SDK copy and a better symbolic way to refer to the location. Also, the recursive checkbox should be checked for the location.

My current status is this: I got the Juce libraries to compile. And I thought I got Jucer to compile yesterday, but somehow I lost it. Now I’m getting a similar problem for Jucer and the other example apps. Compile seems to go ok, but the link, not so much:

Building target “Jucer” of project “Jucer” with configuration “Release” — (1 error)

mkdir "/Users/warrensirota/Desktop/juce/extras/the jucer/build/mac/build/Release/Jucer.app/Contents/MacOS"
cd "/Users/warrensirota/Desktop/juce/extras/the jucer/build/mac"
/Xcode2.5/usr/bin/g++-4.0 -o /Users/warrensirota/Desktop/juce/extras/the\ jucer/build/mac/build/Release/Jucer.app/Contents/MacOS/Jucer -L/Users/warrensirota/Desktop/juce/extras/the\ jucer/build/mac/build/Release -L../../../../bin -F/Users/warrensirota/Desktop/juce/extras/the\ jucer/build/mac/build/Release -filelist /Users/warrensirota/Desktop/juce/extras/the\ jucer/build/mac/build/Jucer.build/Release/Jucer.build/Objects-normal/i386/Jucer.LinkFileList /Users/warrensirota/Desktop/juce/bin/libjuce.a -framework AGL -framework Carbon -framework CoreAudio -framework CoreMIDI -framework CoreServices -framework IOKit -framework OpenGL -framework QuickTime -arch i386 -Wl,-Y,1455 -mmacosx-version-min=10.2 -Wl,-dead_strip -Wl,-Sp -isysroot /Developer/MacOSX10.2.8.sdk

/Xcode2.5/usr/bin/…/libexec/gcc/i686-apple-darwin8/4.0.1/ld: warning /Developer/MacOSX10.2.8.sdk/usr/lib/gcc/…/crt1.o cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded)
/Xcode2.5/usr/bin/…/libexec/gcc/i686-apple-darwin8/4.0.1/ld: warning /Developer/MacOSX10.2.8.sdk/System/Library/Frameworks/AGL.framework/AGL cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded)
/Xcode2.5/usr/bin/…/libexec/gcc/i686-apple-darwin8/4.0.1/ld: warning /Developer/MacOSX10.2.8.sdk/System/Library/Frameworks/Carbon.framework/Carbon cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded)
/Xcode2.5/usr/bin/…/libexec/gcc/i686-apple-darwin8/4.0.1/ld: warning /Developer/MacOSX10.2.8.sdk/System/Library/Frameworks/CoreAudio.framework/CoreAudio cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded)
/Xcode2.5/usr/bin/…/libexec/gcc/i686-apple-darwin8/4.0.1/ld: warning /Developer/MacOSX10.2.8.sdk/System/Library/Frameworks/CoreMIDI.framework/CoreMIDI cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded)
/Xcode2.5/usr/bin/…/libexec/gcc/i686-apple-darwin8/4.0.1/ld: warning /Developer/MacOSX10.2.8.sdk/System/Library/Frameworks/CoreServices.framework/CoreServices cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded)
/Xcode2.5/usr/bin/…/libexec/gcc/i686-apple-darwin8/4.0.1/ld: warning /Developer/MacOSX10.2.8.sdk/System/Library/Frameworks/IOKit.framework/IOKit cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded)
/Xcode2.5/usr/bin/…/libexec/gcc/i686-apple-darwin8/4.0.1/ld: warning /Developer/MacOSX10.2.8.sdk/System/Library/Frameworks/OpenGL.framework/OpenGL cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded)
/Xcode2.5/usr/bin/…/libexec/gcc/i686-apple-darwin8/4.0.1/ld: warning /Developer/MacOSX10.2.8.sdk/System/Library/Frameworks/QuickTime.framework/QuickTime cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded)
/Xcode2.5/usr/bin/…/libexec/gcc/i686-apple-darwin8/4.0.1/ld: can’t locate file for: -lstdc++
collect2: ld returned 1 exit status


#6

Ok, I was kind of assuming that most people coming to juce would already have this kind of stuff sorted out. It’s hard to know how much detail to put in there…

The errors here just look like you’re trying to build an i386 build against the 10.2 SDK (10.4 was the first release to run on intel, so 10.2 won’t be much good for that).


#7