Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,866
    • Issues 4,866
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 455
    • Merge requests 455
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #21669
Closed
Open
Created May 28, 2022 by Ryan Scott@RyanGlScottMaintainer

GHC 9.4+: unused '--unwindlib=libunwind' argument warning when compiling C++ code on Windows

Attempting to compile any project that uses C++ code on GHC 9.4 or later on Windows results in a warning that did not appear in previous versions of Windows. Here is a minimal example:

// hello.cpp
#include <iostream>

extern "C"
void hello() {
  std::cout << "Hello, World!" << std::endl;
}
-- Main.hs
{-# LANGUAGE ForeignFunctionInterface #-}
module Main (main) where

foreign import ccall unsafe "hello" cpp_hello :: IO ()

main :: IO ()
main = cpp_hello

On GHC 9.2.3, this compiles without warnings:

$ ghc-9.2.3 -fforce-recomp Main.hs hello.cpp -lstdc++
[1 of 1] Compiling Main             ( Main.hs, Main.o )
Linking Main.exe ...

On GHC 9.4+, however:

$ ../../../Software/ghc-9.5.20220527/bin/ghc -fforce-recomp Main.hs hello.cpp -lc++ -lc++abi
clang++: warning: argument unused during compilation: '--unwindlib=libunwind' [-Wunused-command-line-argument]
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking Main.exe

Note the '--unwindlib=libunwind' warning, which did not appear previously. This likely arises from this line. I'm unclear if clang++ supports --unwindlib.

Edited May 28, 2022 by Ryan Scott
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking