Skip to content
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

Shared Library has no symbols #1925

Closed
W4RH4WK opened this issue Mar 18, 2016 · 1 comment
Closed

Shared Library has no symbols #1925

W4RH4WK opened this issue Mar 18, 2016 · 1 comment

Comments

@W4RH4WK
Copy link

W4RH4WK commented Mar 18, 2016

The helloworld example comes with library target which will result in a libHShelloworld_something_.so and I'd like to link this dynamic library later on with a C project.

When I build the example using cabal, the resulting library will be located somewhere inside the dist folder and contains the symbols of the exposed module.

-- src/Lib.hs

{-# LANGUAGE ForeignFunctionInterface #-}

module Lib
    ( someFunc
    ) where

someFunc :: IO ()
someFunc = putStrLn "someFunc"

foreign export ccall
    someFunc :: IO ()
$ cabal build
$ nm dist/build/libHShelloworld-1.0-ghc7.8.4.so
                 ...
                 U rts_unlock
00000000002020b8 d S1dz_srt
000000000000138d T someFunc
                 U stg_bh_upd_frame_info
00000000000013e1 t stginit_export_helloworldzm1zi0_Lib_zdfstableZZC0ZZChelloworldzzm1zzi0ZZCLibZZCsomeFunc
                 ...

But when I do the same with stack I end up with a dynamic library which does not export any symbols.

$ stack build
$ nm .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/libHShelloworld-1.0-E7IpCWBehUOItxSp94BHC3-ghc7.10.3.so
nm: .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/libHShelloworld-1.0-E7IpCWBehUOItxSp94BHC3-ghc7.10.3.so: no symbols

Is this a bug, or do Ijust need to supply an additional flag?

@W4RH4WK
Copy link
Author

W4RH4WK commented Mar 22, 2016

Related: haskell/cabal#2782

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant