#4115: hsc2hs puts linker flags before object file, causes linker errors
---------------------------------+------------------------------------------
Reporter: guest | Owner:
Type: bug | Status: new
Priority: normal | Component: hsc2hs
Version: 6.10.2 | Keywords:
Os: Unknown/Multiple | Testcase:
Architecture: Unknown/Multiple | Failure: Other
---------------------------------+------------------------------------------
I'm trying to write a Haskell wrapper for a C library (called unibilium)
using hsc2hs. In one of my files I have custom macros that reference
functions from the C library (and #include "unibilium.h").
When I run hsc2hs -I.. foo.hsc, I get linker errors for those functions,
as expected. However:
{{{
% hsc2hs -I.. foo.hsc -L-L.. -L-lunibilium
foo_hsc_make.o: In function `main':
foo_hsc_make.c:(.text+0x1a0): undefined reference to `unibi_name_bool'
foo_hsc_make.c:(.text+0x23b): undefined reference to `unibi_name_bool'
collect2: ld returned 1 exit status
linking foo_hsc_make.o failed
command was: gcc -L.. -lunibilium foo_hsc_make.o -o foo_hsc_make
}}}
Same error. This is because hsc2hs calls gcc with the -l option before the
filename, at which point there are no unresolved references, so the
library is simply discarded.
hsc2hs should leave my linker options where I put them, at the end of the
command line.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4115>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs