Re: Failure to catch C++ exception in Haskell on OS X
Are we talking about Haskell or linking/ calling c plus plus? If the latter, that’s more of a cabal issue I think? If you mean ghc build wise No. The unwind library only supports elf format. Which OS X does not use. Even that issue aside : ghc currently can’t build with any level of dwarf enabled on OS X, eg the system linker complains about exceeding some system section object format limit. I guess my point is : dwarf data for Haskell libraries on OS X have a few challenges between here and there. On Fri, Jan 4, 2019 at 9:29 PM Bas van Dijk wrote: > On Fri, 4 Jan 2019 at 23:46, Adam Sandberg Eriksson > wrote: > > A ticket which seems to cover the same problem: > https://ghc.haskell.org/trac/ghc/ticket/11829 > > Wonderful! I can confirm[1] that adding the following to the cabal > file fixes the problem: > > if os(darwin) > ld-options: -Wl,-keep_dwarf_unwind > > Shouldn't GHC do this by default when linking on OS X? > > Bas > > [1] > https://github.com/basvandijk/darwin-cxx-exception-bug/commit/9b48441606d2fe364c2a21a4ca8ba6b7ff735fe5 > ___ > ghc-devs mailing list > ghc-devs@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs > ___ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Re: Failure to catch C++ exception in Haskell on OS X
On Fri, 4 Jan 2019 at 23:46, Adam Sandberg Eriksson wrote: > A ticket which seems to cover the same problem: > https://ghc.haskell.org/trac/ghc/ticket/11829 Wonderful! I can confirm[1] that adding the following to the cabal file fixes the problem: if os(darwin) ld-options: -Wl,-keep_dwarf_unwind Shouldn't GHC do this by default when linking on OS X? Bas [1] https://github.com/basvandijk/darwin-cxx-exception-bug/commit/9b48441606d2fe364c2a21a4ca8ba6b7ff735fe5 ___ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Re: Failure to catch C++ exception in Haskell on OS X
A ticket which seems to cover the same problem: https://ghc.haskell.org/trac/ghc/ticket/11829 —Adam > On 4 Jan 2019, at 16:50, Bas van Dijk wrote: > > On Fri, 4 Jan 2019 at 14:15, Gabor Greif wrote: >> maybe some DWARF unwind tables are not correctly installed in OS X? > > Hi Gabor, thanks, I will look into that. > >> Do intra-C++ exception catching work in your example? > > Yes, I have a C++ executable foo[1] that links with libfoo that > correctly catches the exception: > >> $(nix-build --no-link -A foo)/bin/test > ... > Whoops! > > Since it's working in pure C++ I suspect it has something to do with > how GHC calls either the C++ compiler or linker. > > Bas > > [1] > https://github.com/basvandijk/darwin-cxx-exception-bug/blob/master/foo/test.cpp > ___ > ghc-devs mailing list > ghc-devs@haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs ___ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Re: Failure to catch C++ exception in Haskell on OS X
On Fri, 4 Jan 2019 at 14:15, Gabor Greif wrote: > maybe some DWARF unwind tables are not correctly installed in OS X? Hi Gabor, thanks, I will look into that. > Do intra-C++ exception catching work in your example? Yes, I have a C++ executable foo[1] that links with libfoo that correctly catches the exception: > $(nix-build --no-link -A foo)/bin/test ... Whoops! Since it's working in pure C++ I suspect it has something to do with how GHC calls either the C++ compiler or linker. Bas [1] https://github.com/basvandijk/darwin-cxx-exception-bug/blob/master/foo/test.cpp ___ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Re: Failure to catch C++ exception in Haskell on OS X
Hi Bas, maybe some DWARF unwind tables are not correctly installed in OS X? Do intra-C++ exception catching work in your example? Cheers, Gabor On 1/4/19, Bas van Dijk wrote: > Dear GHC Devs, > > I'm debugging an issue in our haskell-opencv library where a C++ exception > that is thrown by the OpenCV C++ library isn't caught by the C++ > try...catch block we have inlined in our Haskell code using inline-c-cpp. > This results in the process terminating by SIGABRT. > > Note that this only happens on OS X. In Linux the exception is caught > correctly. > > I wrote a minimal isolated test case (which doesn't use OpenCV) at: > > https://github.com/basvandijk/darwin-cxx-exception-bug > > I wrote some instructions in the README on how to reproduce this and > included some debugging notes. > > I'm not sure the bug is caused by a mis-configuration in my code or if it's > a bug in nixpkgs, Cabal or GHC. Any idea what could be causing this? > > Bas > ___ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Failure to catch C++ exception in Haskell on OS X
Dear GHC Devs, I'm debugging an issue in our haskell-opencv library where a C++ exception that is thrown by the OpenCV C++ library isn't caught by the C++ try...catch block we have inlined in our Haskell code using inline-c-cpp. This results in the process terminating by SIGABRT. Note that this only happens on OS X. In Linux the exception is caught correctly. I wrote a minimal isolated test case (which doesn't use OpenCV) at: https://github.com/basvandijk/darwin-cxx-exception-bug I wrote some instructions in the README on how to reproduce this and included some debugging notes. I'm not sure the bug is caused by a mis-configuration in my code or if it's a bug in nixpkgs, Cabal or GHC. Any idea what could be causing this? Bas ___ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs