[Hackage] #177: Include-dirs, extra-lib-dirs with spaces doesn't work under Windows

#177: Include-dirs, extra-lib-dirs with spaces doesn't work under Windows ----------------------+----------------------------------------------------- Reporter: guest | Owner: Type: defect | Status: new Priority: normal | Milestone: Component: Cabal | Version: 1.2.2.0 Severity: normal | Keywords: Difficulty: normal | Ghcversion: 6.6 Platform: Windows | ----------------------+----------------------------------------------------- Trying to build the HDBC-PostGreSQL database driver[1] revealed some poor handling of pathames under Windows. The package requires that the paths to postgre header and libraries files be added to the .cabal file. My initial attempt was the obvious: {{{ include-dirs: C:\Program Files\PostgreSQL\8.2\include, C:\Program Files\PostgreSQL\8.2\include\server, . extra-lib-dirs: C:\Program Files\PostgreSQL\8.2\include, C:\Program Files\PostgreSQL\8.2\include\server }}} However, the package would not build. The include files "pg_config.h" and some others were not found. Using single or double quotes did not help. Finally, I moved the installation to "C:\pgsql" and updated the .cabal file: {{{ include-dirs: C:\pgsql\include, C:\pgsql\include\server, . extra-lib-dirs: C:\pgsql\lib }}} And the package built. It seems the spaces in the first path caused the problem. For reference, this it the configure output on my machine: {{{ Configuring HDBC-postgresql-1.0.1.0... configure: Dependency base-any: using base-2.1.1 configure: Dependency mtl-any: using mtl-1.0.1 configure: Dependency HDBC>=1.0.0: using HDBC-1.0.1 configure: Dependency parsec-any: using parsec-2.0 configure: Using install prefix: C:\Program Files configure: Binaries installed in: C:\Program Files\Haskell\bin configure: Libraries installed in: C:\Program Files\Haskell\HDBC- postgresql-1.0.1.0\ghc-6.6.1 configure: Private binaries installed in: C:\Program Files\HDBC- postgresql-1.0.1.0 configure: Data files installed in: C:\Program Files\Common Files\HDBC- postgresql-1.0.1.0 configure: Using compiler: c:\ghc\ghc-6.6.1\bin\ghc.exe configure: Compiler flavor: GHC configure: Compiler version: 6.6.1 configure: Using package tool: c:\ghc\ghc-6.6.1\bin\ghc-pkg.exe configure: Using ar found on system at: c:\ghc\ghc-6.6.1\bin\ar.exe configure: Using haddock found on system at: C:\haddock\haddock-0.8\haddock.exe configure: No pfesetup found configure: Using ranlib found on system at: c:\MinGW\bin\ranlib.exe configure: Using runghc found on system at: c:\ghc\ghc-6.6.1\bin\runghc.exe configure: Using runhugs found on system at: C:\Program Files\WinHugs\runhugs.exe configure: No happy found configure: No alex found configure: Using hsc2hs: c:\ghc\ghc-6.6.1\bin\hsc2hs.exe configure: No c2hs found configure: No cpphs found configure: No greencard found }}} Feel free to email me at jgbailey AT gmail DOT com for more info. [1] Version 1.0.1.0 available at http://hackage.haskell.org/cgi-bin /hackage-scripts/package/HDBC-postgresql-1.0.1.0. HDBC is also required. I used 1.0.1, available at http://hackage.haskell.org/cgi-bin/hackage- scripts/package/HDBC-1.0.1. -- Ticket URL: http://hackage.haskell.org/trac/hackage/ticket/177 Hackage http://haskell.org/cabal/ Hackage: Cabal and related projects

#177: Include-dirs, extra-lib-dirs with spaces doesn't work under Windows ---------------------+------------------------------------------------------ Reporter: guest | Owner: Type: defect | Status: new Priority: normal | Milestone: Component: Cabal | Version: 1.2.2.0 Severity: normal | Resolution: Keywords: | Difficulty: normal Ghcversion: 6.6 | Platform: Windows ---------------------+------------------------------------------------------ Comment (by duncan): The solution is to use "" in the field, like: {{{ include-dirs: "C:\Program Files\PostgreSQL\8.2\include", "C:\Program Files\PostgreSQL\8.2\include\server", . extra-lib-dirs: "C:\Program Files\PostgreSQL\8.2\include", "C:\Program Files\PostgreSQL\8.2\include\server" }}} because spaces or ',' are allowed as field separators. Perhaps we should reconsider this or if we cannot change due to backwards compatability we could think about a warning. For example we might check if each directory exists and in the warning message mention that directory names with spaces have to use ""s. -- Ticket URL: http://hackage.haskell.org/trac/hackage/ticket/177#comment:1 Hackage http://haskell.org/cabal/ Hackage: Cabal and related projects

#177: Include-dirs, extra-lib-dirs with spaces doesn't work under Windows ---------------------+------------------------------------------------------ Reporter: guest | Owner: Type: defect | Status: new Priority: normal | Milestone: Component: Cabal | Version: 1.2.2.0 Severity: normal | Resolution: Keywords: | Difficulty: normal Ghcversion: 6.6 | Platform: Windows ---------------------+------------------------------------------------------ Comment (by ross@soi.city.ac.uk): Yes, this is documented behaviour, and can't be changed because we need to preserve backwards compatibility for the .cabal file format. But I also think space separators are a good thing, both for human editing and machine-generated field values. -- Ticket URL: http://hackage.haskell.org/trac/hackage/ticket/177#comment:2 Hackage http://haskell.org/cabal/ Hackage: Cabal and related projects

#177: Include-dirs, extra-lib-dirs with spaces doesn't work under Windows ---------------------+------------------------------------------------------ Reporter: guest | Owner: Type: defect | Status: new Priority: normal | Milestone: Component: Cabal | Version: 1.2.2.0 Severity: normal | Resolution: Keywords: | Difficulty: normal Ghcversion: 6.6 | Platform: Windows ---------------------+------------------------------------------------------ Comment (by duncan): I agree. It would be nice if we could provide a helpful warning though. We do expect all these paths to exist at configure time, so we could check for them. -- Ticket URL: http://hackage.haskell.org/trac/hackage/ticket/177#comment:3 Hackage http://haskell.org/cabal/ Hackage: Cabal and related projects

#177: Check Include-dirs, extra-lib-dirs etc exist at configure time. ----------------------------+----------------------------------------------- Reporter: guest | Owner: Type: defect | Status: new Priority: normal | Milestone: Component: Cabal library | Version: 1.2.2.0 Severity: normal | Resolution: Keywords: | Difficulty: easy (<4 hours) Ghcversion: 6.6 | Platform: Windows ----------------------------+----------------------------------------------- Changes (by duncan): * difficulty: normal => easy (<4 hours) * summary: Include-dirs, extra-lib-dirs with spaces doesn't work under Windows => Check Include-dirs, extra-lib-dirs etc exist at configure time. Comment: It should be easy to check at configure time if all the dirs we will need actually exist. If they do not exist it's a good indication of a mistake. Should these be warnings or errors? To help with the misunderstanding in the original example perhaps the warning message should mention that paths with spaces need to use ""s. -- Ticket URL: http://hackage.haskell.org/trac/hackage/ticket/177#comment:4 Hackage http://haskell.org/cabal/ Hackage: Cabal and related projects

#177: Check Include-dirs, extra-lib-dirs etc exist at configure time. ----------------------------+----------------------------------------------- Reporter: guest | Owner: Type: defect | Status: new Priority: normal | Milestone: Component: Cabal library | Version: 1.2.2.0 Severity: normal | Resolution: Keywords: | Difficulty: easy (<4 hours) Ghcversion: 6.6 | Platform: Windows ----------------------------+----------------------------------------------- Comment (by duncan): Actually it's not clear that we should warn, and it certainly should not be an error. Packages sometimes have to specify include dirs that exist on one machine and not another. What is important is not if the dirs exist or not, but if the include files and libraries can be found by searching them. This would make it harder to detect when someone has accidentally left out "" around a path containing a space. Hmm. -- Ticket URL: http://hackage.haskell.org/trac/hackage/ticket/177#comment:5 Hackage http://haskell.org/cabal/ Hackage: Cabal and related projects

#177: Check Include-dirs, extra-lib-dirs etc exist at configure time. ----------------------------+----------------------------------------------- Reporter: guest | Owner: Type: defect | Status: new Priority: normal | Milestone: Component: Cabal library | Version: 1.2.2.0 Severity: normal | Resolution: Keywords: | Difficulty: easy (<4 hours) Ghcversion: 6.6 | Platform: Windows ----------------------------+----------------------------------------------- Comment (by duncan): We now check that relative paths do exist, eg: {{{ include-dir: include }}} But we do not check absolute paths. The rationale is that relative paths are part of the package so if they're missing then we have a problem, but absolute paths are on the system and these might be just a list of possible paths that may exist on some systems and not others. Incidentally this would help in the original complaint {{{ include-dirs: C:\Program Files\PostgreSQL\8.2\include, C:\Program Files\PostgreSQL\8.2\include\server, . extra-lib-dirs: C:\Program Files\PostgreSQL\8.2\include, C:\Program Files\PostgreSQL\8.2\include\server }}} We would get a warning: {{{ Warning: 'include-dirs: Files\PostgreSQL\8.2\include' directory does not exist. Warning: 'include-dirs: Files\PostgreSQL\8.2\include\server' directory does not exist. Warning: 'extra-lib-dirs: Files\PostgreSQL\8.2\include' directory does not exist. Warning: 'extra-lib-dirs: Files\PostgreSQL\8.2\include\server' directory does not exist. }}} -- Ticket URL: http://hackage.haskell.org/trac/hackage/ticket/177#comment:6 Hackage http://haskell.org/cabal/ Hackage: Cabal and related projects

#177: Check Include-dirs, extra-lib-dirs etc exist at configure time. ----------------------------+----------------------------------------------- Reporter: guest | Owner: Type: defect | Status: new Priority: normal | Milestone: Component: Cabal library | Version: 1.2.2.0 Severity: normal | Resolution: Keywords: | Difficulty: easy (<4 hours) Ghcversion: 6.6 | Platform: Windows ----------------------------+----------------------------------------------- Comment (by guest): See also: * #15 and #159 - implement dependency analysis * #216 - specify more kinds of dependencies in .cabal files * #262 - check for required foreign libraries -- Ticket URL: http://hackage.haskell.org/trac/hackage/ticket/177#comment:7 Hackage http://haskell.org/cabal/ Hackage: Cabal and related projects

#177: Check Include-dirs, extra-lib-dirs etc exist at configure time. ----------------------------+----------------------------------------------- Reporter: guest | Owner: Type: defect | Status: new Priority: normal | Milestone: Component: Cabal library | Version: 1.2.2.0 Severity: normal | Resolution: Keywords: | Difficulty: easy (<4 hours) Ghcversion: 6.6 | Platform: Windows ----------------------------+----------------------------------------------- Comment (by duncan): Module/file dependency analysis is not relevant (#15 and #159). That's a different kind of dependency. -- Ticket URL: http://hackage.haskell.org/trac/hackage/ticket/177#comment:8 Hackage http://haskell.org/cabal/ Hackage: Cabal and related projects

#177: Check Include-dirs, extra-lib-dirs etc exist at configure time. ----------------------------+----------------------------------------------- Reporter: guest | Owner: Type: defect | Status: new Priority: normal | Milestone: Cabal-1.6 Component: Cabal library | Version: 1.2.2.0 Severity: normal | Resolution: Keywords: | Difficulty: easy (<4 hours) Ghcversion: 6.6 | Platform: Windows ----------------------------+----------------------------------------------- Changes (by duncan): * milestone: => Cabal-1.6 -- Ticket URL: http://hackage.haskell.org/trac/hackage/ticket/177#comment:9 Hackage http://haskell.org/cabal/ Hackage: Cabal and related projects

#177: Check Include-dirs, extra-lib-dirs etc exist at configure time. ----------------------------+----------------------------------------------- Reporter: guest | Owner: Type: defect | Status: new Priority: low | Milestone: Component: Cabal library | Version: 1.2.2.0 Severity: normal | Resolution: Keywords: | Difficulty: normal Ghcversion: 6.6 | Platform: Windows ----------------------------+----------------------------------------------- Changes (by duncan): * priority: normal => low * difficulty: easy (<4 hours) => normal * milestone: Cabal-1.6 => Comment: So I think the decision is that we should only require that relative paths exist, not absolute paths. Ticket #262 covers checking that libs, and headers can actually be found. We should check that the configure flags `--extra-lib-dirs=`, `--extra- include-dirs=` do point to directories that actually exist. The only other improvement we could make would be to somehow notice that joining two adjacent components of a directory field with a space form a valid absolute path that actually exists, when both components do not, and in such a case suggest that the user perhaps meant to use a path with an embedded space in which case they must use "" Haskell String syntax. -- Ticket URL: http://hackage.haskell.org/trac/hackage/ticket/177#comment:10 Hackage http://haskell.org/cabal/ Hackage: Cabal and related projects
participants (1)
-
Hackage