Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,312
    • Issues 4,312
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 385
    • Merge Requests 385
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #12504

Closed
Open
Opened Aug 20, 2016 by rcook@trac-rcook

Windows: Using hsc2hs in combination with inline-c generates the .c files with invalid paths

Repro steps:

  • Install Stack on a Windows development machine.
  • Create new simple project with stack new inlinecbug simple.
  • Rename src/Main.hs to src/Main.hsc in the inlinecbug project directory.
  • Build project with stack build and run with stack exec inlinecbug to verify that hsc2hs works correctly.
  • Replace content of src/Main.hsc with following:
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}

import qualified Language.C.Inline as C

C.include "<math.h>"

main :: IO ()
main = do
  x <- [C.exp| double{ cos(1) } |]
  print x
  • In inlinecbug.cabal add inline-c to the build-depends section of executable inlinecbug.
  • Add the line c-sources: src/Main.c to the executable inlinecbug section.
  • Rebuild with stack build.

Build will fail with a linker error referring to a undefined reference to an inline_c_main... function. List the files in the root directory of the project and you'll see that inline-c has generated a file with the name srcMain.c: i.e. the backslashes in the Windows path have been removed.

Building under Linux generates the C output file with the correct, expected path of src/Main.c and the program will compile, link and run as expected.

See also: https://github.com/fpco/inline-c/issues/50

Edited Mar 10, 2019 by rcook
Assignee
Assign to
8.0.2
Milestone
8.0.2 (Past due)
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#12504