<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hi all,<br>
<br>
I have a function<br>
<br>
ft :: CMode -> FileType<br>
ft i = toEnum (fromIntegral i)<br>
<br>
which is used to marshal a function defined with c2hs, viz.<br>
<br>
{<span class="pl-k">#</span> fun archive_entry_filetype as <span
class="pl-k">^</span> { `<span class="pl-ent">ArchiveEntryPtr'</span>
} <span class="pl-k">-></span> `<span class="pl-ent">FileType'</span>
ft <span class="pl-k">#</span>}<br>
<br>
This all works fine under GHC 8.8.1-GHC-8.2.2. When I try to
compile the test suite with GHC 8.0.2 I get<br>
<br>
Linking
/home/vanessa/programming/haskell/done/libarchive/dist-newstyle/build/x86_64-linux/ghc-8.0.2/libarchive-2.0.0.0/t/libarchive-test/build/libarchive-test/libarchive-test
...<br>
/usr/bin/ld:
/home/vanessa/programming/haskell/done/libarchive/dist-newstyle/build/x86_64-linux/ghc-8.0.2/libarchive-2.0.0.0/build/libHSlibarchive-2.0.0.0-inplace.a(ArchiveEntry.o):
in function `rg6i_info':<br>
(.text+0x9cd6): undefined reference to `archive_entry_acl_next_w'<br>
/usr/bin/ld:
/home/vanessa/programming/haskell/done/libarchive/dist-newstyle/build/x86_64-linux/ghc-8.0.2/libarchive-2.0.0.0/build/libHSlibarchive-2.0.0.0-inplace.a(ArchiveEntry.o):
in function `cjVN_info':<br>
(.text+0x128c6): undefined reference to `archive_entry_acl_next_w'<br>
collect2: error: ld returned 1 exit status<br>
`gcc' failed in phase `Linker'. (Exit code: 1)<br>
<br>
When I define the marshaling function with<br>
<br>
ft :: CMode -> FileType<br>
ft 0 = error "here"<br>
ft i = toEnum (fromIntegral i)<br>
<br>
I can no longer compile the test suite; it fails with a linker
error, even with GHC 8.8.1-GHC-8.2.2. I get<br>
<br>
Linking
/home/vanessa/programming/haskell/done/libarchive/dist-newstyle/build/x86_64-linux/ghc-8.8.1/libarchive-2.0.0.0/t/libarchive-test/build/libarchive-test/libarchive-test
...<br>
/home/vanessa/programming/haskell/done/libarchive/dist-newstyle/build/x86_64-linux/ghc-8.8.1/libarchive-2.0.0.0/build/libHSlibarchive-2.0.0.0-inplace.a(ArchiveEntry.o)(.text+0x9d86):
error: undefined reference to 'archive_entry_acl_next_w'<br>
/home/vanessa/programming/haskell/done/libarchive/dist-newstyle/build/x86_64-linux/ghc-8.8.1/libarchive-2.0.0.0/build/libHSlibarchive-2.0.0.0-inplace.a(ArchiveEntry.o):function
libarchivezm2zi0zi0zi0zminplace_CodecziArchiveziForeignziArchiveEntry_zdwarchiveEntryAclNextW_info:
error: undefined reference to 'archive_entry_acl_next_w'<br>
collect2: error: ld returned 1 exit status<br>
`gcc' failed in phase `Linker'. (Exit code: 1)<br>
</p>
<p>You can have a look at some of some of the code in this branch
here: <br>
<br>
<a class="moz-txt-link-freetext" href="https://github.com/vmchale/libarchive/blob/ghc-potential-bug/src/Codec/Archive/Foreign/ArchiveEntry.chs#L27">https://github.com/vmchale/libarchive/blob/ghc-potential-bug/src/Codec/Archive/Foreign/ArchiveEntry.chs#L27</a>
<br>
<br>
and here: <br>
<br>
<a class="moz-txt-link-freetext" href="https://github.com/vmchale/libarchive/blob/ghc-potential-bug/src/Codec/Archive/Foreign/ArchiveEntry.hs#L57">https://github.com/vmchale/libarchive/blob/ghc-potential-bug/src/Codec/Archive/Foreign/ArchiveEntry.hs#L57</a><br>
<br>
Cheers,<br>
Vanessa McHale<br>
</p>
</body>
</html>