I did some more tests and the 32-bit version is not compiling. The
problem is that the 32-bit flags (-m32) are not passed to ld when
linking. That in turn is caused by the following:

> But on hitting that line the following error is spat out:
> /usr/bin/ld: cannot open output file  dist/build/libwxc.so.0.13.1: No
> such file or directory
>
> I checked all my permissions and couldn't see anything wrong, I could
> touch the file.
> Conveniently I noticed that, if the verbosity is set high enough,
> runProgram will call printRawCommandAndArgs:
> http://hackage.haskell.org/packages/archive/Cabal/latest/doc/html/src/Distribution-Simple-Utils.html#printRawCommandAndArgs
>
> The output (i.e. the linker invocation) looks like this:
> /usr/bin/gcc -fno-stack-protector -shared -Wl,-soname,libwxc.so.0 -o
> dist/build/libwxc.so.0.13.1 dist/build/src/cpp/apppath.o
> dist/build/src/cpp/dragimage.o dist/build/src/cpp/eljaccelerator.o
> [snip-rest-of-.o-files] -L/usr/local/lib -lstdc++ -lwx_baseu-2.9
> [snip-rest-of-wx-libs]
>
> Now if I cd into the wxcore and paste the command *verbatim* then gcc
> works and generates libwxc.so.0.13.1 as expected.
> You can see in Jeremy's code the linkShareLib function contains:
>> cwd <- getCurrentDirectory
>
> I used this to confirm that the we were in ./wxcore and we are, even
> making the path for -o absolute didn't sovle the issue.
> I ended up replacing runProgram line with this, less satisfactory line:
>> system $ (unwords ([show . locationPath . programLocation $ gcc] ++ opts' ++ 
>> objs' ++ lib_dirs' ++ libs'))
>
> Which works, but still doesn't explain why runProgram doesn't.
> Any suggestions?

The workaround is missing the default arguments. It works again if I
change it to:

>         args  = opts' ++ objs' ++ lib_dirs' ++ libs'
>    system $ (unwords ([programPath gcc] ++ programDefaultArgs gcc ++ args ++ 
> programOverrideArgs gcc ))

Incidentally I also tried the runProgram version, which gave me a similar error:

> ld: unknown option: -o dist/build/libwxc.dylib

I traced the problem down to the rawSystem call, i.e. in ghci:

> rawSystem "/usr/bin/gcc" ["-o test", "dist/build/cpp/apppath.o"]

gives the same error. I guess gcc/ld does not handle raw strings well???

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
wxhaskell-devel mailing list
wxhaskell-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxhaskell-devel

Reply via email to