<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Karel,<div><br></div><div>Not solved yet, but I did not notice the target problem. It is obvious once pointed out. I’ll try to fix that and try again and report back.</div><div><br></div><div>Thanks,</div><div><br></div><div>Mike</div><div><br><div><div>On Jul 11, 2014, at 4:35 AM, Karel Gardas <<a href="mailto:karel.gardas@centrum.cz">karel.gardas@centrum.cz</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br>I'm not sure if this is already solved, but if you cross-compile to A9, why do you use ARMv5 platform OS?<br><br>("target arch","ArchARM {armISA = ARMv5, armISAExt = [], armABI = HARD}")<br><br>this looks really strange. armABI HARD, that means FP data in FP regs, still no VFP in armISAExt and even armISA set to ARMv5.<br><br>For example on my ubuntu 12.04 I do have:<br><br>("target arch", "ArchARM {armISA = ARMv7, armISAExt = [VFPv3,NEON], armABI = HARD}"),<br><br>which is right for pandaboard which is dual Cortex-A9.<br><br>So, shortly I really do not know if you do not hit some corner case in LLVM here. I would certainly suggest especially considering your Cortex-A9 target to update your OS to get to what I do have here: ARMv7+VFPv3/NEON+ABI HARD.<br><br>BTW: Another issue may be that GHC misconfigures on your platform and they you will need to tell us more about your target OS...<br><br>Cheers,<br>Karel<br><br>On 07/ 8/14 07:51 AM, Michael Jones wrote:<br><blockquote type="cite">I am pasting both the info from the HOST and TARGET compilers:<br><br>HOST<br>====<br><br>[("Project name","The Glorious Glasgow Haskell Compilation System")<br>,("GCC extra via C opts"," -fwrapv")<br>,("C compiler command","/usr/bin/gcc")<br>,("C compiler flags"," -fno-stack-protector -Wl,--hash-size=31<br>-Wl,--reduce-memory-overheads")<br>,("ar command","/usr/bin/ar")<br>,("ar flags","q")<br>,("ar supports at file","YES")<br>,("touch command","touch")<br>,("dllwrap command","/bin/false")<br>,("windres command","/bin/false")<br>,("perl command","/usr/bin/perl")<br>,("target os","OSLinux")<br>,("target arch","ArchX86_64")<br>,("target word size","8")<br>,("target has GNU nonexec stack","True")<br>,("target has .ident directive","True")<br>,("target has subsections via symbols","False")<br>,("LLVM llc command","llc")<br>,("LLVM opt command","opt")<br>,("Project version","7.6.3")<br>,("Booter version","7.6.3")<br>,("Stage","2")<br>,("Build platform","x86_64-unknown-linux")<br>,("Host platform","x86_64-unknown-linux")<br>,("Target platform","x86_64-unknown-linux")<br>,("Have interpreter","YES")<br>,("Object splitting supported","YES")<br>,("Have native code generator","YES")<br>,("Support SMP","YES")<br>,("Unregisterised","NO")<br>,("Tables next to code","YES")<br>,("RTS ways","l debug thr thr_debug thr_l thr_p dyn debug_dyn thr_dyn<br>thr_debug_dyn thr_debug_p")<br>,("Leading underscore","NO")<br>,("Debug on","False")<br>,("LibDir","/usr/lib/ghc")<br>,("Global Package DB","/usr/lib/ghc/package.conf.d")<br>,("Gcc Linker<br>flags","[\"-Wl,--hash-size=31\",\"-Wl,--reduce-memory-overheads\"]")<br>,("Ld Linker flags","[\"--hash-size=31\",\"--reduce-memory-overheads\"]")<br>]<br><br><br>TARGET<br>=======<br><br>[("Project name","The Glorious Glasgow Haskell Compilation System")<br>,("GCC extra via C opts"," -fwrapv")<br>,("C compiler command","arm-poky-linux-gnueabi-gcc")<br>,("C compiler flags"," -fno-stack-protector")<br>,("C compiler link flags","")<br>,("ld command","arm-poky-linux-gnueabi-ld")<br>,("ld flags","")<br>,("ld supports compact unwind","YES")<br>,("ld supports build-id","YES")<br>,("ld supports filelist","NO")<br>,("ld is GNU ld","YES")<br>,("ar command","/usr/bin/ar")<br>,("ar flags","q")<br>,("ar supports at file","YES")<br>,("touch command","touch")<br>,("dllwrap command","/bin/false")<br>,("windres command","/bin/false")<br>,("libtool command","libtool")<br>,("perl command","/usr/bin/perl")<br>,("target os","OSLinux")<br>,("target arch","ArchARM {armISA = ARMv5, armISAExt = [], armABI = HARD}")<br>,("target word size","4")<br>,("target has GNU nonexec stack","False")<br>,("target has .ident directive","True")<br>,("target has subsections via symbols","False")<br>,("Unregisterised","NO")<br>,("LLVM llc command","llc")<br>,("LLVM opt command","opt")<br>,("Project version","7.8.2")<br>,("Booter version","7.6.3")<br>,("Stage","1")<br>,("Build platform","x86_64-unknown-linux")<br>,("Host platform","x86_64-unknown-linux")<br>,("Target platform","arm-unknown-linux")<br>,("Have interpreter","YES")<br>,("Object splitting supported","NO")<br>,("Have native code generator","NO")<br>,("Support SMP","YES")<br>,("Tables next to code","YES")<br>,("RTS ways","l debug thr thr_debug thr_l ")<br>,("Support dynamic-too","YES")<br>,("Support parallel --make","YES")<br>,("Dynamic by default","NO")<br>,("GHC Dynamic","NO")<br>,("Leading underscore","NO")<br>,("Debug on","False")<br>,("LibDir","/usr/local/lib/arm-unknown-linux-gnueabi-ghc-7.8.2")<br>,("Global Package<br>DB","/usr/local/lib/arm-unknown-linux-gnueabi-ghc-7.8.2/package.conf.d")<br>]<br><br><br><br><br>On Jul 7, 2014, at 10:42 PM, Carter Schonwald<br><<a href="mailto:carter.schonwald@gmail.com">carter.schonwald@gmail.com</a><span class="Apple-converted-space"> </span><<a href="mailto:carter.schonwald@gmail.com">mailto:carter.schonwald@gmail.com</a>>> wrote:<br><br><blockquote type="cite">could you share the output of ghc --info?<br><br><br>On Tue, Jul 8, 2014 at 12:10 AM, Michael Jones <<a href="mailto:mike@proclivis.com">mike@proclivis.com</a><br><<a href="mailto:mike@proclivis.com">mailto:mike@proclivis.com</a>>> wrote:<br><br> I am having problems building a GHC cross compiler for Linux<br> (Yocto on a Wandboard) running on a Cortex A9, and need some<br> advice on how to debug it.<br><br> The cross compiler produces an executable that runs on the Target,<br> but fails to print. So I need help coming up with a strategy to<br> narrow down the root cause.<br><br> Some details:<br><br> The application:<br><br> main = do<br> putStrLn "Haskell start"<br><br><br> The command line options work. The program runs, and I can step<br> through assembly. Debug data is printed to the console. But<br> putStrLn fails, and program enters an infinite loop.<br><br> I compile my app as follows:<br><br> arm-unknown-linux-gnueabi-ghc -debug -static Main.hs<br><br> Using -threaded does not fix the problem.<br><br> Let me compare debug data from a run on my HOST, with a run on my<br> TARGET. First, a run from my HOST:<br><br> created capset 0 of type 2<br> created capset 1 of type 3<br> cap 0: initialised<br> assigned cap 0 to capset 0<br> assigned cap 0 to capset 1<br> cap 0: created thread 1<br> cap 0: running thread 1 (ThreadRunGHC)<br> cap 0: thread 1 stopped (suspended while making a foreign call)<br> cap 0: running thread 1 (ThreadRunGHC)<br> cap 0: thread 1 stopped (finished)<br> cap 0: created thread 2<br> cap 0: running thread 2 (ThreadRunGHC)<br> cap 0: thread 2 stopped (finished)<br> cap 0: starting GC<br> cap 0: GC working<br> cap 0: GC idle<br> cap 0: GC done<br> cap 0: GC idle<br> cap 0: GC done<br> cap 0: GC idle<br> cap 0: GC done<br> cap 0: GC idle<br> cap 0: GC done<br> cap 0: all caps stopped for GC<br> cap 0: finished GC<br> removed cap 0 from capset 0<br> removed cap 0 from capset 1<br> cap 0: shutting down<br> deleted capset 0<br> deleted capset 1<br><br> And, it prints properly. So this is my referenced for what it<br> should do on the TARGET.<br><br> When I run on my TARGET, I get:<br><br> created capset 0 of type 2<br> created capset 1 of type 3<br> cap 0: initialised<br> assigned cap 0 to capset 0<br> assigned cap 0 to capset 1<br> cap 0: created thread 1<br> cap 0: running thread 1 (ThreadRunGHC)<br> cap 0: thread 1 stopped (yielding)<br> cap 0: running thread 1 (ThreadRunGHC)<br> cap 0: thread 1 stopped (yielding)<br> cap 0: running thread 1 (ThreadRunGHC)<br> cap 0: thread 1 stopped (yielding)<br> cap 0: running thread 1 (ThreadRunGHC)<br> cap 0: thread 1 stopped (yielding)<br> cap 0: running thread 1 (ThreadRunGHC)<br> cap 0: thread 1 stopped (yielding)<br> cap 0: running thread 1 (ThreadRunGHC)<br> cap 0: thread 1 stopped (yielding)<br> cap 0: running thread 1 (ThreadRunGHC)<br> cap 0: thread 1 stopped (stack overflow)<br> cap 0: running thread 1 (ThreadRunGHC)<br> cap 0: thread 1 stopped (stack overflow)<br> cap 0: running thread 1 (ThreadRunGHC)<br> cap 0: thread 1 stopped (stack overflow)<br> cap 0: running thread 1 (ThreadRunGHC)<br> cap 0: thread 1 stopped (yielding)<br> cap 0: running thread 1 (ThreadRunGHC)<br> cap 0: thread 1 stopped (stack overflow)<br> cap 0: running thread 1 (ThreadRunGHC)<br> cap 0: thread 1 stopped (stack overflow)<br> cap 0: running thread 1 (ThreadRunGHC)<br> cap 0: thread 1 stopped (stack overflow)<br> cap 0: running thread 1 (ThreadRunGHC)<br> cap 0: thread 1 stopped (yielding)<br> cap 0: running thread 1 (ThreadRunGHC)<br> cap 0: thread 1 stopped (stack overflow)<br> cap 0: running thread 1 (ThreadRunGHC)<br> cap 0: thread 1 stopped (heap overflow)<br> cap 0: starting GC<br> cap 0: GC working<br> cap 0: GC idle<br> cap 0: GC done<br> cap 0: GC idle<br> cap 0: GC done<br> cap 0: GC idle<br> cap 0: GC done<br> cap 0: all caps stopped for GC<br> cap 0: finished GC<br> cap 0: running thread 1 (ThreadRunGHC)<br> cap 0: thread 1 stopped (yielding)<br> cap 0: running thread 1 (ThreadRunGHC)<br> cap 0: thread 1 stopped (stack overflow)<br> ...<br><br> And the debug data goes on forever, just as debugging assembly<br> demonstrated an infinite loop.<br><br> Clearly, the following does not occur:<br><br> cap 0: thread 1 stopped (suspended while making a foreign call)<br><br> And there are overflows.<br><br> If I had to guess, it is possible that some code is in a loop<br> retrying to foreign call, and failing. Certainly, it is in some<br> kind of a loop, because I found a place I can put a break point<br> and and telling GDB to continue will cause the break over and over<br> at the same place. So somewhere there is a loop.<br><br> I can step through the application with GDB and see names of files<br> and offsets in assembly. But without a true source code debug,<br> that is a bit rough, especially for someone that does not know the<br> RTS code. If there was a way to compile such that C source code<br> was available and a place to break, that would help. However, I<br> suspect since it never makes a foreign call, there is no place in<br> C to place the breakpoint anyway. So I am also assuming there is<br> no direct way to debug with GDB.<br><br> But, I can see debug output printed to the console. My hope is<br> there is a way to enable more printing, or a place I can add more<br> print functions to help find the problem.<br><br> So I think I need one of the following:<br><br> - A solution from someone that has seen this before, perhaps on<br> the iPhone<br> - How to enable more debug logging<br> - Where in the source code to add debug statements to narrow down<br> the problem<br><br> Thanks for any help you can give.<br><br> Mike<br><br><br> _______________________________________________<br> Glasgow-haskell-users mailing list<br> <a href="mailto:Glasgow-haskell-users@haskell.org">Glasgow-haskell-users@haskell.org</a><br> <<a href="mailto:Glasgow-haskell-users@haskell.org">mailto:Glasgow-haskell-users@haskell.org</a>><br> <a href="http://www.haskell.org/mailman/listinfo/glasgow-haskell-users">http://www.haskell.org/mailman/listinfo/glasgow-haskell-users</a><br><br><br></blockquote><br><br><br>_______________________________________________<br>Glasgow-haskell-users mailing list<br><a href="mailto:Glasgow-haskell-users@haskell.org">Glasgow-haskell-users@haskell.org</a><br><a href="http://www.haskell.org/mailman/listinfo/glasgow-haskell-users">http://www.haskell.org/mailman/listinfo/glasgow-haskell-users</a></blockquote></div></blockquote></div><br></div></body></html>