Opened 2 years ago

Closed 2 years ago

#7690 closed bug (fixed)

iOS patch no 1: Select operating system

Reported by: StephenBlackheath Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.7
Keywords: Cc: chak@…
Operating System: Other Architecture: arm
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description

This is the first in a series of patches for adding cross-compile ability for iOS.

For now, 'arm-apple-darwin10' will be interpreted as iOS. Later we will need to tweak this to detect the difference between the iOS simulator (with an i386 cpu) and the native Mac.

I am creating a new logical OS name 'ios' because the differences between iOS and Mac can be quite significant. I thought it would we best not to introduce the idea of an OS variant (as we did with ARM cpus) for two reasons: 1. it's over-complicating the issue and 2. it would require some modification of cabal.

Versioning: I'm submitting patch version 1a here. If I have to revise a patch, I'll bump the letter.

Attachments (2)

ios-patch-1a-select-operating-system.patch (5.2 KB) - added by StephenBlackheath 2 years ago.
iOS patch 1 rev a: Select operating system
ios-patch-1b-select-operating-system.patch (4.2 KB) - added by StephenBlackheath 2 years ago.
iOS patch 1 rev a: Select operating system, uses TargetPlatformFull instead of unnecessarily adding TargetPlatform_GNU

Download all attachments as: .zip

Change History (10)

Changed 2 years ago by StephenBlackheath

iOS patch 1 rev a: Select operating system

comment:1 Changed 2 years ago by StephenBlackheath

  • Status changed from new to patch

comment:2 Changed 2 years ago by chak

  • Cc chak@… added

comment:3 Changed 2 years ago by chak

Stephen, it's great to see progress on this!

I had a look at the patch (well, actually the master-merge-ios branch in the ghc-ios repo on GitHub) and noticed that the changes in https://github.com/ghc-ios/ghc/blob/master-merge-ios/compiler/deSugar/DsForeign.lhs hardcoded iOS-specific settings, which can be traced back to this patch: https://github.com/ghc-ios/ghc/commit/6f01b16ba94c275683fccdc748f0b6e95f94e5d0 (e.g., the setting of libFFI and the removal of insertRetAddr) — it might be worthwhile to double check that that patch didn't hardcoded platform-specifics in other places as well. Do you know how to get at the platform info in DsForeign?

Moreover, my compile dies with

Configuring ghctags-0.1...
Configuring ghc-pwd-0.1...
Configuring ghc-pkg-6.9...
Configuring hsc2hs-0.67...
Configuring haddock-2.13.2...
ghc-cabal: At least the following dependencies are missing:
terminfo -any
make[1]: *** [utils/ghc-pkg/dist-install/package-data.mk] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [all] Error 2

(I wonder why we are using crappy Trac instead of GitHub for such discussions?!?)

comment:4 Changed 2 years ago by StephenBlackheath

Yes, master-merge-ios is full of iOS-specific changes hard-coded in, left over from the "just get it working" phase of the project, which I am in the process of progressively cleaning up.

The patch I submitted here is not intended to actually do anything useful yet when you select iOS as a target. I mainly just need to know whether this method of OS selection is acceptable so I can get on with the rest of the work.

comment:5 Changed 2 years ago by simonmar

  • difficulty set to Unknown

Rather than adding TargetPlatform_GNU, could you use the existing TargetPlatformFull?

Changed 2 years ago by StephenBlackheath

iOS patch 1 rev a: Select operating system, uses TargetPlatformFull instead of unnecessarily adding TargetPlatform_GNU

comment:6 Changed 2 years ago by StephenBlackheath

Hey chak & anyone who wants to build our work in progress at https://github.com/ghc-ios/, some instructions. There is currently some breakage with a Cabal change needed.

{{ git clone git@…:ghc-ios/ghc.git git checkout master-merge-ios ./sync-all --no-dph get }}

the usual cross-compile build.mk

{{ cat > mk/build.mk << EOF HADDOCK_DOCS = NO BUILD_DOCBOOK_HTML = NO BUILD_DOCBOOK_PS = NO BUILD_DOCBOOK_PDF = NO SPLIT_OBJS = NO INTEGER_LIBRARY = integer-simple Stage1Only = YES EOF

perl boot

cp arm-apple-darwin10-bin/* ~/bin # or anywhere in your path PATH=~/bin:$PATH ./configure --target=arm-apple-darwin10 --prefix=/usr/local/ghc-ios-armv7/

make sudo make install }}

comment:7 Changed 2 years ago by StephenBlackheath

(Let's try that again.)

Hey chak & anyone who wants to build our work in progress in the master-merge-ios branch at https://github.com/ghc-ios/, some instructions. There is currently some breakage with a Cabal change needed.

git clone [email protected]:ghc-ios/ghc.git
git checkout master-merge-ios
./sync-all --no-dph get

the usual cross-compile build.mk

cat > mk/build.mk << EOF
HADDOCK_DOCS       = NO
BUILD_DOCBOOK_HTML = NO
BUILD_DOCBOOK_PS   = NO
BUILD_DOCBOOK_PDF  = NO
SPLIT_OBJS		   = NO
INTEGER_LIBRARY    = integer-simple
Stage1Only 		   = YES
EOF

perl boot

cp arm-apple-darwin10-bin/* ~/bin # or anywhere in your path
PATH=~/bin:$PATH ./configure --target=arm-apple-darwin10 --prefix=/usr/local/ghc-ios-armv7/

make
sudo make install

comment:8 Changed 2 years ago by igloo

  • Resolution set to fixed
  • Status changed from patch to closed

Applied, thanks:

commit 94914b967be27ae04cdba098d9557bbf161639c5
Author: Ian Lynagh <[email protected]>
Date:   Sun Feb 17 13:41:29 2013 +0000

    iOS patch no 1: Select operating system; from StephenBlackheath
Note: See TracTickets for help on using tickets.