[Haskell-iPhone] ld: warning with HEAD

Schell Scivally efsubenovex at gmail.com
Sat Dec 21 04:08:41 UTC 2013


Okay, the hsc2hs step worked and I have IOS/Touch.hs. Now the next error is:

arm-apple-darwin10-ghc -staticlib Main.hs -threaded

IOS/Touch.hsc:6:8:

    Could not find module 'Data.Vector.Storable'

    Use -v to see a list of the files searched for.


Is there a way for me to manually include the Data.Vector.Storable package?


On Fri, Dec 20, 2013 at 6:26 PM, Maxwell Swadling <maxwellswadling at gmail.com
> wrote:

> So it doesn't know how to deal with IOS/Touch/Touch.hsc, which is one of
> the reasons I'm trying to use cabal, since it seems to be pretty good at
> running hsc2hs on that file automagically. Though ghc is supposed to work
> with .hsc, no?
>
> If I try to compile Touch.hsc by itself I get something interesting:
>
> arm-apple-darwin10-ghc IOS/Touch.hsc
>
> GHC doesn't!
>
> You should be able to run `hsc2hs IOS/Touch/Touch.hsc` and it will produce
> `IOS/Touch/Touch.hs`.
>
> You will have to add any header include paths you need (CocoaTouch ?).
>
> I would recommend a vanilla makefile to run `hsc2hs` then `ghc`.
>
> On 21/12/2013, at 1:01 PM, Schell Scivally <efsubenovex at gmail.com> wrote:
>
> Carter: Yes, I've followed the instructions on the wiki and updated
> Xcode's build settings.
> Maxwell: When I try it errors with:
>
> arm-apple-darwin10-ghc Main.hs -o Main.a
>
> Main.hs:5:8:
>
>     Could not find module 'IOS.Touch'
>
>     Use -v to see a list of the files searched for.
>
>
> And then following it down the rabbit hole:
>
> arm-apple-darwin10-ghc Main.hs -o Main.a -v
>
> Glasgow Haskell Compiler, Version 7.7.20131217, stage 1 booted by GHC
> version 7.6.3
>
> Using binary package database:
> /usr/local/lib/arm-apple-darwin10-ghc-7.7.20131217/package.conf.d/package.cache
>
> wired-in package ghc-prim mapped to
> ghc-prim-0.3.1.0-ba68fe37a0bba905324e76d7bb331c12
>
> wired-in package integer-simple mapped to
> integer-simple-0.1.1.0-abf1895bcd711c07e5c06ea0798b38ff
>
> wired-in package base mapped to
> base-4.7.0.0-725128dc24ae24a83ca24be4defe9728
>
> wired-in package rts mapped to builtin_rts
>
> wired-in package template-haskell mapped to
> template-haskell-2.9.0.0-dc5244f6b2a07b2bd654d776e81eb7ba
>
> wired-in package dph-seq not found.
>
> wired-in package dph-par not found.
>
> Hsc static flags:
>
> wired-in package ghc-prim mapped to
> ghc-prim-0.3.1.0-ba68fe37a0bba905324e76d7bb331c12
>
> wired-in package integer-simple mapped to
> integer-simple-0.1.1.0-abf1895bcd711c07e5c06ea0798b38ff
>
> wired-in package base mapped to
> base-4.7.0.0-725128dc24ae24a83ca24be4defe9728
>
> wired-in package rts mapped to builtin_rts
>
> wired-in package template-haskell mapped to
> template-haskell-2.9.0.0-dc5244f6b2a07b2bd654d776e81eb7ba
>
> wired-in package dph-seq not found.
>
> wired-in package dph-par not found.
>
> *** Chasing dependencies:
>
> Chasing modules from: *Main.hs
>
>
> Main.hs:5:8:
>
>     Could not find module 'IOS.Touch'
>
>     Locations searched:
>
>       IOS/Touch.hs
>
>       IOS/Touch.lhs
>
> *** Deleting temp files:
>
> Deleting:
>
> *** Deleting temp dirs:
>
> Deleting:
>
>
> So it doesn't know how to deal with IOS/Touch/Touch.hsc, which is one of
> the reasons I'm trying to use cabal, since it seems to be pretty good at
> running hsc2hs on that file automagically. Though ghc is supposed to work
> with .hsc, no?
>
> If I try to compile Touch.hsc by itself I get something interesting:
>
> arm-apple-darwin10-ghc IOS/Touch.hsc
>
> ld: warning: ignoring file IOS/Touch.hsc, file was built for unsupported
> file format ( 0x7B 0x2D 0x23 0x20 0x4C 0x41 0x4E 0x47 0x55 0x41 0x47 0x45
> 0x20 0x46 0x6F 0x72 ) which is not the architecture being linked (armv7):
> IOS/Touch.hsc
>
> Undefined symbols for architecture armv7:
>
>   "_ZCMain_main_closure", referenced from:
>
>       _main in ghc85846_2.o
>
> ld: symbol(s) not found for architecture armv7
>
> clang: error: linker command failed with exit code 1 (use -v to see
> invocation)
>
> ld: warning: ignoring file IOS/Touch.hsc, file was built for unsupported
> file format ( 0x7B 0x2D 0x23 0x20 0x4C 0x41 0x4E 0x47 0x55 0x41 0x47 0x45
> 0x20 0x46 0x6F 0x72 ) which is not the architecture being linked (armv7s):
> IOS/Touch.hsc
>
> Undefined symbols for architecture armv7s:
>
>   "_ZCMain_main_closure", referenced from:
>
>       _main in ghc85846_2.o
>
> ld: symbol(s) not found for architecture armv7s
>
> clang: error: linker command failed with exit code 1 (use -v to see
> invocation)
>
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo:
> can't open input file: a-armv7.o (No such file or directory)
>
> rm: a-armv7.o: No such file or directory
>
> rm: a-armv7s.o: No such file or directory
>
>
> On Fri, Dec 20, 2013 at 5:49 PM, Maxwell Swadling <
> maxwellswadling at gmail.com> wrote:
>
>> Can you run arm-apple-darwin10-ghc  Blocks.hs -o Blocks.a ?
>>
>> Also I'm not sure why you have a Main.a as well. You should link the
>> Blocks.a in Xcode. You shouldn't need two .a's.
>>
>> __END__ Maxwell Swadling
>>
>> On 21 Dec 2013, at 12:43 pm, Carter Schonwald <carter.schonwald at gmail.com>
>> wrote:
>>
>> Aren't there some settings that need to be manipulated in Xcode? Like
>> "don't run strip. Just don't"?  Are you doing that stuff?
>>
>> On Friday, December 20, 2013, Schell Scivally wrote:
>>
>>> Sorry in the last message I meant "(with the list of _warnings_
>>> mentioned on the wiki)".
>>>
>>>
>>> On Fri, Dec 20, 2013 at 5:10 PM, Schell Scivally <efsubenovex at gmail.com>wrote:
>>>
>>> I'll sum up the process I'm going through. I `cd` into Blocks where
>>> Blocks.cabal lives, then I do a `arm-apple-darwin10-cabal
>>> --config-file=path/to/arm/config build`. The config file was created by
>>> arm-apple-darwin10-cabal the first time I ran it. The build ends in two
>>> different ways depending on the `ghc-options` field in the Blocks.cabal
>>> file. With ghc-options: -staticlib -threaded it errors (or warns, or
>>> outputs - as it isn't specified):
>>>
>>> Resolving dependencies...
>>>
>>> Configuring Blocks-0.1.0.0...
>>>
>>> Building Blocks-0.1.0.0...
>>>
>>> Preprocessing executable 'Blocks' for Blocks-0.1.0.0...
>>>
>>> Linking dist-arm/build/Blocks/Blocks.a ...
>>>
>>> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool:
>>> can't locate file for: -lpthread
>>> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool:
>>> file: -lpthread is not an object file (not allowed in a library)
>>>
>>> With ghc-options: -staticlib it looks like the build completes (with the
>>> list of errors mentioned on the wiki). I then have two libs, src/Main.a and
>>> dist-arm/build/Blocks/Blocks.a
>>>
>>> I then add either Blocks.a or Main.a to my project (or both, which I've
>>> also tried). Then I build for my device with command-b. Both static libs
>>> are ignored for each architecture and then clang ends in a linker error.
>>> Here is the build log from Xcode: http://lpaste.net/97304 and my setup:
>>> https://gist.github.com/schell/f3a737171ce2f6b1119c and the source:
>>> https://github.com/schell/blocks-ios/
>>>
>>> Please let me know if you need more information.
>>>
>>>
>>> On Fri, Dec 20, 2013 at 4:38 PM, Schell Scivally <efsubenovex at gmail.com>wrote:
>>>
>>> Currently I'm using `arm-apple-darwin10-cabal
>>> --config-file=path/to/my/arm/config build
>>>
>>> The cabal file and the rest of the source can be found at
>>> https://github.com/schell/blocks-ios/
>>>
>>> I'm following the directions at
>>> https://ghc.haskell.org/trac/ghc/wiki/Building/CrossCompiling/iOS as
>>> much as possible but I don't really know how to use ghc to build all the
>>> files in a project (when I try it can't find the IOS.Touch module), which
>>> is why I'm trying to use cabal. That wiki page says nothing of using cabal
>>> so I'm assuming that I'm in dragon territory with most of this, so forgive
>>> me if I'm making some obvious mistake.
>>>
>>>
>>>
>>> On Fri, Dec 20, 2013 at 4:27 PM, Maxwell Swadling <
>>> maxwellswadling at gmail.com> wrote:
>>>
>>> How are you compiling the static library? What command are you using?
>>>
>>> __END__
>>> Maxwell Swadling
>>>
>>> On 21 Dec 2013, at 10:24 am, Schell Scivally <efsubenovex at gmail.com>
>>> wrote:
>>>
>>> Carter pointed out I only mentioned the warning. ld spits out a warning
>>> and then the build fails in the linking phase because the static lib was
>>> ignored and not linked, making the main() provided by the lib undefined:
>>>
>>> ld: warning: ignoring file
>>> /Users/schell/Code/blocks-ios/Blocks/dist-arm/build/Blocks/Blocks.a, file
>>> was built for archive which is not the architecture being linked (armv7):
>>> /Users/schell/Code/blocks-ios/Blocks/dist-arm/build/Blocks/Blocks.a
>>>
>>> ld: warning: ignoring file /Users/schell/Code/blocks-ios/Blocks
>>>
>>>
>
>
> --
> Schell Scivally
> http://blog.efnx.com
> http://github.com/schell
> http://twitter.com/schellsan
>
>
>


-- 
Schell Scivally
http://blog.efnx.com
http://github.com/schell
http://twitter.com/schellsan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/iphone/attachments/20131220/6945f862/attachment-0001.html>


More information about the iPhone mailing list