-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GHC Linking-Error: Unknown symbol when newtype deriving #87
Comments
Possibly. I suspect it is because of As a workaround, try disabling the |
@bruderj15 please raise an issue at https://gitlab.haskell.org/ghc/ghc/-/issues, this is fundamentally a GHC issue. |
@bruderj15 any news on this? |
@Bodigrim Will investigate further and then issue a ticket at ghc as soon as there is some spare time. |
@bruderj15 could you please share a self-contained reproducer? |
Surely. {-# LANGUAGE KindSignatures #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE GeneralisedNewtypeDeriving #-}
module BitvecNewTypeDerivingLinkingError where
import Data.Bit as Bit
import Data.Bits
import GHC.TypeNats
import qualified Data.Vector.Unboxed.Sized as V
newtype Bitvector (n :: Nat) = Bitvector { unsign :: V.Vector n Bit.Bit }
deriving stock (Eq, Ord)
deriving newtype (Show, Bits)
main :: IO ()
main = putStrLn "Hello World!" The module compiles successfully. ghci> main
ghc-9.6.5.exe:| C:\cabal\store\ghc-9.6.5\bitvec-1.1.5.0-505e12042e6d0bd4f1d718085478e089a7c3bbe0\lib\libHSbitvec-1.1.5.0-505e12042e6d0bd4f1d718085478e089a7c3bbe0.a: unknown symbol `__cpu_model'
ghc-9.6.5.exe:| C:\cabal\store\ghc-9.6.5\bitvec-1.1.5.0-505e12042e6d0bd4f1d718085478e089a7c3bbe0\lib\libHSbitvec-1.1.5.0-505e12042e6d0bd4f1d718085478e089a7c3bbe0.a: unknown symbol `_hs_bitvec_select_bits'
ghc-9.6.5.exe: ^^ Could not load 'bitveczm1zi1zi5zi0zm505e12042e6d0bd4f1d718085478e089a7c3bbe0_DataziBitziImmutable_zdfBitsVector_closure', dependency unresolved. See top entry above.
GHC.ByteCode.Linker.lookupCE
During interactive linking, GHCi couldn't find the following symbol:
bitveczm1zi1zi5zi0zm505e12042e6d0bd4f1d718085478e089a7c3bbe0_DataziBitziImmutable_zdfBitsVector_closure Removing the newtype-derived This problem only seems to occur on Win 11, works fine on Linux. |
Disabling |
I reproduced the issue on Windows with GHC 9.10.1, so it's unlikely to be fixed already.
This is not a right syntax, I think. |
Judging from GHC tracker, the simplest solution is to avoid |
Hello all,
i have been playing around with
Bit
and made a type-level length- and sign-indexed version.However, deriving Bits for the newtype always ends up in a GHC linking error.
Is this related to the C SIMD-optimizations?
This is on Win 11.
The text was updated successfully, but these errors were encountered: