[Haskell-iPhone] ld: warning with HEAD

Maxwell Swadling maxwellswadling at gmail.com
Sat Dec 21 04:23:09 UTC 2013


I think you need to set your "--package-db" option when using ghc-pkg the
subsequently ghc.

The value should be in the cabal config file.

Can you post your cabal config?



On Sat, Dec 21, 2013 at 3:15 PM, Schell Scivally <efsubenovex at gmail.com>wrote:

> No, I'm not - I'm using arm-apple-darwin10-cabal
> --config-file=path/to/arm.config install vector, which yields:
>
> Resolving dependencies...
>
> All the requested packages are already installed:
>
> vector-0.10.9.1
>
> Use --reinstall if you want to reinstall anyway.
>
> Though it doesn't look like it's actually installed:
>
> arm-apple-darwin10-ghc-pkg list
>
> /usr/local/lib/arm-apple-darwin10-ghc-7.7.20131217/package.conf.d
>
>    Cabal-1.18.1.2
>
>    array-0.5.0.0
>
>    base-4.7.0.0
>
>    bin-package-db-0.0.0.0
>
>    binary-0.7.1.0
>
>    bytestring-0.10.4.0
>
>    containers-0.5.3.1
>
>    deepseq-1.3.0.2
>
>    directory-1.2.0.2
>
>    filepath-1.3.0.2
>
>    ghc-prim-0.3.1.0
>
>    hoopl-3.10.0.0
>
>    hpc-0.6.0.1
>
>    integer-simple-0.1.1.0
>
>    old-locale-1.0.0.6
>
>    pretty-1.1.1.1
>
>    process-1.2.0.0
>
>    rts-1.0
>
>    template-haskell-2.9.0.0
>
>    time-1.4.1
>
>    transformers-0.3.0.0
>
>    unix-2.7.0.0
>
> If I don't include my arm.config file I get this:
>
> arm-apple-darwin10-cabal install vector
>
> Resolving dependencies...
>
> Configuring primitive-0.5.1.0...
>
> Failed to install primitive-0.5.1.0
>
> Last 10 lines of the build log (
> /Users/schell/.cabal/logs/primitive-0.5.1.0.log ):
>
> cabal: Error: some packages failed to install:
>
> primitive-0.5.1.0 failed during the configure step. The exception was:
>
> ExitFailure 127
>
> vector-0.10.9.1 depends on primitive-0.5.1.0 which failed to install
>
>
>
>
> On Fri, Dec 20, 2013 at 8:11 PM, Maxwell Swadling <
> maxwellswadling at gmail.com> wrote:
>
>> were you using cabal sandbox? If so, delete the cabal sandbox and cabal
>> install the dependencies (vector in this case is missing).
>>
>>
>> On Sat, Dec 21, 2013 at 3:08 PM, Schell Scivally <efsubenovex at gmail.com>wrote:
>>
>>> 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
>>>
>>
>>
>>
>> --
>> Maxwell Swadling
>>
>>
>
>
> --
> Schell Scivally
> http://blog.efnx.com
> http://github.com/schell
> http://twitter.com/schellsan
>



-- 
Maxwell Swadling
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/iphone/attachments/20131221/55257179/attachment-0001.html>


More information about the iPhone mailing list