Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Fix for "unknown symbol `___divmoddi4'" on 32-bit mingw builds #503

Merged
merged 1 commit into from
Sep 8, 2018

Conversation

gzh
Copy link
Contributor

@gzh gzh commented Sep 6, 2018

Hi there,

I've ran into a trouble in my project while building it with 32-bit GHC 8.4.3 on Windows (MinGW).
I'm doing an upgrade from quite an ancient GHC 7.10.3, but this upgrade went OK on Linux but on Windows I got an error like this one:

Building library for viinex-lm-0.2.0..
[14 of 15] Compiling ViinexLm.Firmware ( src\ViinexLm\Firmware.hs, dist\build\ViinexLm\Firmware.o )

<no location info>: error:
    ghc.exe: unable to load package `foundation-0.0.21'
ghc.exe:  | C:\Projects\viinex-lm\.cabal-sandbox\i386-windows-ghc-8.4.3\foundation-0.0.21-3fR5LfsB4NN8k8cOnaPWAU\HSfoundation-0.0.21-3fR5LfsB4NN8k8cOnaPWAU.o: unknown symbol `___divmoddi4'

After some googling I found this story https://ghc.haskell.org/trac/ghc/ticket/15094 which describes pretty much everything about this - it's GHC/toolchain bug, when a 32-bit compiler inserts an instrinsic instead of instruction but forgets to reference the libgcc. So it needs to be referenced explicitly.

Unfortunately this cannot be done in dependent project, only in the project where all that replacement is introduced. And I guess this is the C bit of the foundation library, namely the cbits/foundation_time.c.

With the proposed change to the foundation.cabal and rebuilding the foundation library with that change, - my project has built successfully as well.

So this is a workaround for still broken GCC but could you please accept this, - otherwise the whole bunch of libraries become unusable with those GHC who uses GCC 7 on 32-bit MinGW (that's modern 8.4). Thank you in advance.

jgm added a commit to jgm/pandoc that referenced this pull request Sep 6, 2018
jgm added a commit to jgm/pandoc that referenced this pull request Sep 7, 2018
Use a patched version of foundation until
haskell-foundation/foundation#503
is fixed.

Use latest pandoc-citeproc.
@vincenthz vincenthz merged commit b50b4ba into haskell-foundation:master Sep 8, 2018
@jgm
Copy link

jgm commented Jan 25, 2019

Thanks for making this change. It would be great to get a release with this fix in it!

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

Successfully merging this pull request may close these issues.

3 participants