Ticket #1270 (closed defect: fixed)

Opened 5 years ago

Last modified 5 years ago

Cairo register wrong library in extra-ghci-libraries on Windows

Reported by: guest Owned by: paolo
Priority: normal Milestone:
Component: Cairo bindings Version:
Keywords: Cc: schernichkin@…


Cairo's setup script (Gtk2HsSetup.hs) attempts to guess Cairo dll name and does it incorrectly. Original guess function looks like that:

fixLibs :: [FilePath?] -> [String] -> [String] fixLibs dlls = concatMap $ \ lib ->

case filter (("lib" ++ lib) isPrefixOf) dlls of

dll:_ -> [dropExtension dll] _ -> if lib == "z" then [] else [lib]

this may cause (and actually cause on my system) Cairo to select libcairo-script-interpreter-2.dll or libcairo-gobject-2.dll instead of libcairo-2.dll. As the result Cairo can't be used from ghci and several depended libraries can't be installed ("unknown symbol" error). The simpliest way to fix this fuction is to sort libraries by name length, like this:

fixLibs :: [FilePath?] -> [String] -> [String] fixLibs dlls = concatMap $ \ lib ->

case sortBy (compare on length) $ filter (("lib" ++ lib) isPrefixOf) dlls of

dll:_ -> [dropExtension dll] _ -> if lib == "z" then [] else [lib]

I also suggest to log list of libraries added as extralibs during setup. This will help to debug in case of futher problems.

(Cairo version is

Change History

Changed 5 years ago by dmwit

  • status changed from new to closed
  • resolution set to fixed

(copy of message from previous Trac that was missed during migration)

I believe dcoutts has sent in a patch for this (and it was included in the 0.12.4 release). Please reopen this bug if 0.12.4 still does not work for you.

Note: See TracTickets for help on using tickets.