commercialhaskell/stack

nonportable-include-path warning on case-insensitive systems

Open

#3,918 opened on Mar 13, 2018

View on GitHub
 (14 comments) (7 reactions) (0 assignees)Haskell (4,060 stars) (848 forks)batch import
component: Windowscomponent: buildcomponent: macOShelp wantedtype: bug

Description

General summary/comments

The common case of using the same name for the executable (e.g. interplay) and the top-level module of the corresponding library (e.g. Interplay.Types) leads to a spurious warning being displayed while building using stack on a case-insensitive filesystem:

     warning: non-portable path to file '".stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/Interplay/autogen/cabal_macros.h"'; specified path differs in case from file name on disk [-Wnonportable-include-path]
#include ".stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/interplay/autogen/cabal_macros.h"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         ".stack-work/dist/x86_64-osx/Cabal-2.0.1.0/build/Interplay/autogen/cabal_macros.h"
1 warning generated.

It looks like stack tries to create both a folder named interplay and one named Interplay, but the OS considers them the same. As a result, the files generated for the module and for the executable end up in the same folder. Luckily, the files have different names so this doesn't cause any problems, except for the fact that the above warning is generated.

The problem does not occur when building using cabal, because it uses a different folder scheme. Similarly, stack could change its folder scheme (e.g. put the executable folders and the module folders in two different sub-folders) in order to avoid the warning.

Steps to reproduce

For your convenience, I have created a minimal project which demonstrates the problem. The important parts are the fact that the package.yaml specifies an executable named interplay:

name: interplay
dependencies:
- base

library:
  source-dirs: src

executables:
  interplay:
    main: Main.hs
    source-dirs: app

and the fact that the project contains a file src/Interplay/Types.hs, that is, there is a top-level module named Interplay.

Simply run stack build on a case-insensitive system and you will see the warning. I have tried it on macOS, and I suspect that the problem will also occur on Windows but not on Linux.

Expected

The project builds with no warning.

Actual

The projects builds successfully, but displays the above warning. Here is the full output of stack build --verbose, after a stack clean --full.

Stack version

I tried with both stack-1.6.5 and stack-HEAD.

$ stack --version
Version 1.6.5, Git revision 24ab0d6ff07f28276e082c3ce74dfdeb1a2ca9e9 (5514 commits) x86_64 hpack-0.20.0

Method of installation

  • Other: stack upgrade --git for stack-HEAD and then stack upgrade --force-download for stack-1.6.5

Contributor guide