Skip to content

Commit

Permalink
Fix error building on some 32 bit targets.
Browse files Browse the repository at this point in the history
Ignore-this: 212d1935582b619313032033a20834d

Apply patch due to Heinrich Apfelmus (apfelmus@quantentunnel.de). His description
attached below:

"I just tripped over a bug in the  Setup.hs  belonging to  wxc  that
 prevented me from compiling wxHaskell with 32bit architecture.

 The problem is the following: in the function  linkSharedLib , the
 function  runProgram  is commented out and the function  system  is used
 instead. This is not correct because  gcc  may (and in my case: does)
 carry additional command line options! (Besides, the verbose output is
 lost.)

 Apparently, this was done because the   runProgram  didn't work for some
 reason. The reason is that some command line options are actually two
 arguments. In particular, setting the output file via

   "-o " ++ out_dir </> sharedLibName ver basename,

 is not correct, the right way to go about it are two arguments

   "-o", out_dir </> sharedLibName ver basename,

 Same for the "-install_name" option. Four lines need to be changed in
 the  linkCxxOpts  file, then  runProgram  will work."

darcs-hash:20120414142124-75908-2cab48a05599cd3556734f64dbd712a24fe6c619.gz
  • Loading branch information
jodonoghue committed Apr 14, 2012
1 parent 7e6e043 commit a57ff51
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions wxc/Setup.hs
Expand Up @@ -165,16 +165,16 @@ linkCxxOpts ver out_dir basename basepath =
implib_pathname = normalisePath (out_dir </> "lib" ++ addExtension basename ".a") in implib_pathname = normalisePath (out_dir </> "lib" ++ addExtension basename ".a") in
case buildOS of case buildOS of
Windows -> ["--dll", "-shared", Windows -> ["--dll", "-shared",
"-o " ++ out_dir </> sharedLibName ver basename, "-o", out_dir </> sharedLibName ver basename,
"-Wl,--out-implib," ++ "lib" ++ addExtension basename ".a", "-Wl,--out-implib," ++ "lib" ++ addExtension basename ".a",
"-Wl,--export-all-symbols", "-Wl,--enable-auto-import"] "-Wl,--export-all-symbols", "-Wl,--enable-auto-import"]
OSX -> ["-dynamiclib", OSX -> ["-dynamiclib",
"-o " ++ out_dir </> sharedLibName ver basename, "-o", out_dir </> sharedLibName ver basename,
"-install_name " ++ basepath </> sharedLibName ver basename, "-install_name", basepath </> sharedLibName ver basename,
"-Wl,-undefined,dynamic_lookup"] "-Wl,-undefined,dynamic_lookup"]
_ -> ["-shared", _ -> ["-shared",
"-Wl,-soname,lib" ++ basename ++ ".so", "-Wl,-soname,lib" ++ basename ++ ".so",
"-o " ++ out_dir </> sharedLibName ver basename] "-o", out_dir </> sharedLibName ver basename]


-- | Compile a single source file using the configured gcc, if the object file does not yet -- | Compile a single source file using the configured gcc, if the object file does not yet
-- exist, or is older than the source file. -- exist, or is older than the source file.
Expand Down Expand Up @@ -232,8 +232,8 @@ linkSharedLib gcc opts lib_dirs libs objs ver out_dir dll_name dll_path =
opts' = opts ++ linkCxxOpts ver (out_dir') dll_name dll_path opts' = opts ++ linkCxxOpts ver (out_dir') dll_name dll_path
objs' = map normalisePath objs objs' = map normalisePath objs
libs' = ["-lstdc++"] ++ map ("-l" ++) libs libs' = ["-lstdc++"] ++ map ("-l" ++) libs
--runProgram verbose gcc (opts' ++ objs' ++ lib_dirs' ++ libs') runProgram verbose gcc (opts' ++ objs' ++ lib_dirs' ++ libs')
system $ (unwords ([show . locationPath . programLocation $ gcc] ++ opts' ++ objs' ++ lib_dirs' ++ libs')) --system $ (unwords ([show . locationPath . programLocation $ gcc] ++ opts' ++ objs' ++ lib_dirs' ++ libs'))
return () return ()


-- | The 'normalise' implementation in System.FilePath does not meet the requirements of -- | The 'normalise' implementation in System.FilePath does not meet the requirements of
Expand Down
4 changes: 2 additions & 2 deletions wxc/wxc.cabal
@@ -1,5 +1,5 @@
name: wxc name: wxc
version: 0.90 version: 0.90.0.2
license: OtherLicense license: OtherLicense
license-file: LICENSE license-file: LICENSE
maintainer: wxhaskell-devel@lists.sourceforge.net maintainer: wxhaskell-devel@lists.sourceforge.net
Expand Down Expand Up @@ -157,7 +157,7 @@ library
wxc_types.h wxc_types.h


build-depends: build-depends:
base, base >= 4 && < 5,
wxdirect >= 0.90 wxdirect >= 0.90


x-dll-sources: x-dll-sources:
Expand Down

0 comments on commit a57ff51

Please sign in to comment.