the-real-blackh / hexpat

A general purpose Haskell XML library using Expat to do its parsing
BSD 3-Clause "New" or "Revised" License
2 stars 7 forks source link

Failure in building #15

Open Futarimiti opened 5 months ago

Futarimiti commented 5 months ago

I am on macOS 14.4.1 (23E224) using ghc-9.4.8 to build hexpat-0.20.13, gcc Apple clang version 15.0.0 (clang-1500.3.9.4). The following error was thrown:

/var/folders/h1/vvswnzxd54lfr9n3t32k29wc0000gn/T/ghc43096_0/ghc_4.c:19:17: error:
     error: incompatible pointer to integer conversion assigning to 'ffi_arg' (aka 'unsigned long') from 'HsPtr' (aka 'void *') [-Wint-conversion]
   |
19 | *(ffi_arg*)resp = cret;
   |                 ^
*(ffi_arg*)resp = cret;
                ^ ~~~~
1 error generated.
AbsoluteNikola commented 3 months ago

If you, like me, are looking for workarounds for older compilers:

  1. install older llvm. llvm@12 works good for me
  2. add these lines in cabal.project.local (or similar for stack)
    package *
    ghc-options: -pgmc /opt/homebrew/opt/llvm@12/bin/clang
stefjoosten commented 1 month ago

I have exactly the same error. However, I'm working with stack rather than cabal. This is the error message I get:

 /private/var/folders/qw/7h1cg8qx44g1v_p4s7m_ptqr0000gq/T/stack-9f9a28f5b2a93a36/hexpat-0.20.13//var/folders/qw/7h1cg8qx44g1v_p4s7m_ptqr0000gq/T/ghc80085_0/ghc_4.c:19:17: error:
      error: incompatible pointer to integer conversion assigning to 'ffi_arg' (aka 'unsigned long') from 'HsPtr' (aka 'void *') [-Wint-conversion]
    |
 19 | *(ffi_arg*)resp = cret;
    |                 ^
 *(ffi_arg*)resp = cret;
                 ^ ~~~~
 1 error generated.

 <no location info>: error:
     `gcc' failed in phase `C Compiler'. (Exit code: 1)

For the full log, click here.

We couldn't get ghc to use a different c compiler, as suggested above by @AbsoluteNikola, because we couldn't figure out how to change the package.yaml file. We checked that /opt/homebrew/opt/llvm@12/bin/clang exists and that it executes from the command line. We added the following line to the package.yaml file, but that produced the same error.

ghc-options:
   - -pgmc /opt/homebrew/opt/llvm@12/bin/clang

The mistake prevails and effectively blocks us from using hexpat in our project.

Please...

Can you help us out? Any suggestions? workarounds?

hanjoosten commented 1 month ago

macos 12 does not have this problem yet. However, macos 14 does. I expect more and more projects will suffer from this issue, because a lot of them depend on hexpat.

hanjoosten commented 1 month ago

I have been doing some more investigation. The root-cause seems to be the mentioned incompatible pointer to integer conversion. However, previously this was reported as a warning, but now it is throwing an error.

hanjoosten commented 1 month ago

For the time being, a sufficient workaround is to build on macos 12, not macos 14. However, this does not take away the root cause, fixing this error in hexpat itself. I do wonder if @the-real-blackh is still actively maintaining this repo?

the-real-blackh commented 3 weeks ago

I do wonder if @the-real-blackh is still actively maintaining this repo?

I haven't been.

prikhi commented 3 weeks ago

This is a GHC bug:

And the fix has been backported to GHC 9.6.5 & 9.8.2