[gambit-list] A couple of random questions
Adam King
akingcoder at gmail.com
Sun Jul 31 20:18:23 EDT 2011
BTW, to get Gambit to compile as an iOS library using this script, you need
to make a small tweak to Xcode after some Xcode updates (or fresh install).
You'll get a link error to crt1.10.6 unless you make the following change
in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib
(or
any earlier version of the SDK):
sudo ln -s crt1.3.1.o crt1.10.6.o
Then it all compiles fine. You don't need this change for the sim or osx as
both already have that lib available. Cheers,
Adam
On Sun, Jul 31, 2011 at 7:58 PM, Adam King <akingcoder at gmail.com> wrote:
> I'm now using 'Apple LLVM compiler 3.0" to compile Gambit (osx, iOS
> Simulator and iOS device). I've switched to clang as my main compiler now
> since Apple seems to be making that their main compiler. I use my own set
> of compile scripts to compile Gambit (from latest git) into a static lib
> that I then link into my XCode project. I keep 3 separate builds, one for
> each 'platform' (osx, ios sim and ios device), each in their own directory
> with separate setup and config scripts. I generally only rebuild the libs
> when the Gambit repo is updated. Each script is a little different, but to
> compile the static Gambit lib an iOS arm device (arm7 only), I use the
> following 2 scripts:
>
> setup.sh (to setup the env):
>
> export
> PATH="/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:$PATH"
> export CC="/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang
> -arch armv7 -isysroot
> /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk"
> export
> CXX="/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang++ -arch
> armv7 -isysroot
> /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk"
>
> compile.sh:
>
> CFLAGS="-arch armv7" LDFLAGS="-arch armv7" ./configure --host=arm
> --prefix=/usr/local/Gambit-C/iPhoneOS
> CFLAGS="-arch armv7" LDFLAGS="-arch armv7" make
> sudo make install
>
> The script for each type of build is slightly different and is based on
> getting Gambit to build over the last year or so - and originally based on
> JLongster's scripts. This is using the latest beta Xcode 4.2 with iOS 5.0
> under Lion and SL - but it was working under XCode 4.0 with just changing
> the CC/CXX paths in setup.sh.
>
> Adam
>
> On Sun, Jul 31, 2011 at 6:14 PM, Marc Feeley <feeley at iro.umontreal.ca>wrote:
>
>>
>> On 2011-07-31, at 4:48 PM, mikel evins wrote:
>>
>> >
>> > On Jul 31, 2011, at 6:50 AM, Marc Feeley wrote:
>> >
>> >> I have encountered this problem also (with Lion and the new Xcode).
>> The problem is due to LLVM gcc which is the default C compiler now and
>> which does not compile the Gambit sources properly when the
>> --enable-single-host configure option is given. I've tried using gdb to
>> find where the error is, but it is giving me an execution trace which
>> doesn't correlate with the sources so I am confused in regards to the
>> location of the error.
>> >>
>> >> So to fix the problem temporarily I did
>> >>
>> >> CC="i686-apple-darwin11-gcc-4.2.1" ./configure --enable-single-host
>> >> make
>> >> make check
>> >>
>> >> I also committed a patch to look for "i686-apple-darwin11-gcc-4.2.1"
>> before "gcc", but that is not a long term solution.
>> >>
>> >> My guess is that LLVM gcc is buggy, but I have not yet found a proof.
>> >
>> > Using the above workaround, I certainly get farther than before. I can
>> make it through the make check without crashes or errors.
>> >
>> > After that, I tried this:
>> >
>> > 1. rm examples/iOS/Prefix.pch (needed because otherwise make update
>> fails when git is unable to update that file)
>> >
>> > 2. make update
>> >
>> > 3. cd examples/iOS
>> >
>> > 4. make examples
>> >
>> > 5. ./build-gambit-iOS
>> >
>> >
>> > A cursory examination seems to show that these steps all succeeded, but
>> I'm unable to run Gambit-REPL in the iPad or iPhone simulator. It launches
>> and immediately crashes, complaining that it can't access memory address 1.
>> >
>> > Perhaps I need to alter the Makefiles used in the iOS build to ensure
>> that LLVM is not used? Or perhaps I overlooked some other step?
>>
>> Indeed the build-gambit-iOS script also has to be modified to avoid LLVM
>> gcc. That can be achieved by changing the lines:
>>
>> case "$kind$platform_type" in
>>
>> iPhoneOS) config_options_extras=--host=arm-apple-darwin
>> ;;
>>
>> iPhoneSimulator) config_options_extras=
>> ;;
>>
>> esac
>>
>> export CC="$ios_platform_dir/Developer/usr/bin/gcc -isysroot $ios_sdk_dir
>> -arch $arch"
>> export CXX="$ios_platform_dir/Developer/usr/bin/g++ -isysroot
>> $ios_sdk_dir -arch $arch"
>>
>> to
>>
>> case "$kind$platform_type" in
>>
>> iPhoneOS) config_options_extras=--host=arm-apple-darwin
>> export
>> CC="$ios_platform_dir/Developer/usr/bin/arm-apple-darwin10-gcc-4.2.1
>> -isysroot $ios_sdk_dir -arch $arch"
>> export
>> CXX="$ios_platform_dir/Developer/usr/bin/arm-apple-darwin10-g++-4.2.1
>> -isysroot $ios_sdk_dir -arch $arch"
>> ;;
>>
>> iPhoneSimulator) config_options_extras=
>> export
>> CC="$ios_platform_dir/Developer/usr/bin/i686-apple-darwin11-gcc-4.2.1
>> -isysroot $ios_sdk_dir -arch $arch"
>> export
>> CXX="$ios_platform_dir/Developer/usr/bin/i686-apple-darwin11-g++-4.2.1
>> -isysroot $ios_sdk_dir -arch $arch"
>> ;;
>>
>> esac
>>
>> I wonder why Apple is moving to LLVM gcc. I've read somewhere that Apple
>> thinks gcc is more buggy than LLVM gcc, and that it generates better code.
>> At least for compiling Gambit, this seems to be a mistaken belief on both
>> counts.
>>
>> Marc
>>
>> _______________________________________________
>> Gambit-list mailing list
>> Gambit-list at iro.umontreal.ca
>> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20110731/36d895f4/attachment.htm>
More information about the Gambit-list
mailing list