undefined symbols and undefined references possibly related to template haskell
I have seen a number of instances where template-haskell (?) fails at compile time due to missing symbols. For example, when building happstack-data:
> [ 7 of 16] Compiling Happstack.Data.Xml.Base (
> src/Happstack/Data/Xml/Base.hs, dist/build/Happstack/Data/Xml/Base.o )
> Loading package ghc-prim ... linking ... done.
> Loading package integer-gmp ... linking ... done.
> Loading package base ... linking ... done.
> Loading package array-0.3.0.0 ... linking ... done.
> Loading package bytestring-0.9.1.5 ... linking ... done.
> Loading package containers-0.3.0.0 ... linking ... done.
> Loading package pretty-1.0.1.1 ... linking ... done.
> Loading package template-haskell ... linking ... done.
> Loading package syb-with-class-0.6.1 ... linking ... done.
> Loading package HUnit-1.2.2.1 ... linking ... done.
> Loading package syb-0.1.0.2 ... linking ... done.
> Loading package base-3.0.3.2 ... linking ... done.
> Loading package old-locale-1.0.0.2 ... linking ... done.
> Loading package time-1.1.4 ... linking ... done.
> Loading package random-1.0.0.2 ... linking ... done.
> Loading package QuickCheck-1.2.0.0 ... linking ... done.
> Loading package extensible-exceptions-0.1.1.1 ... linking ... done.
> Loading package mtl-1.1.0.2 ... linking ... done.
> Loading package old-time-1.0.0.3 ... linking ... done.
> Loading package parsec-2.1.0.1 ... linking ... done.
> Loading package hsemail-1.3 ... linking ... done.
> Loading package network-2.2.1.5 ... linking ... done.
> Loading package SMTPClient-1.0.1 ... linking ... done.
> Loading package filepath-1.1.0.3 ... linking ... done.
> Loading package unix-2.4.0.0 ... linking ... done.
> Loading package directory-1.0.1.0 ... linking ... done.
> Loading package process-1.0.1.2 ... linking ... done.
> Loading package hslogger-1.0.7 ... linking ... done.
> Loading package deepseq-1.1.0.0 ... linking ... done.
> Loading package parallel-2.2.0.1 ... linking ... done.
> Loading package strict-concurrency-0.2.2 ... linking ... done.
> Loading package unix-compat-0.1.2.1 ... linking ... done.
> Loading package happstack-util-0.4.1 ... linking ... done.
> Loading package binary-0.5.0.2 ... linking ... done.
> Loading package haskell98 ... linking ... done.
> Loading package HaXml-1.13.3 ... linking ... done.
> Loading package ffi-1.0 ... linking ... done.
> ghc:
> unknown symbol
> `_sybzmwithzmclasszm0zi6zi1_DataziGenericsziSYBziWithClassziInstances_dataT ypeZMad6eZN_closure'
> <<<<<
or in some private code:
Loading package extensible-exceptions-0.1.1.1 ... linking ... done.
ghc: /usr/lib/haskell-packages/ghc6/lib/generic-formlets-1.53/ghc-6.12.1/HSgeneric-formlets-1.53.o: unknown symbol `sybzmwithzmclasszm0zi6zi1_DataziGenericsziSYBziWithClassziInstances_constrZMad9AZN_closure'
Loading package hsemail-1.3 ... linking ... done.
The work around so far has been to compile with -O0
. However, it is not consistent *what* needs to be compiled with -O0. In the case of happstack-data, compiling happstack-data with -O0
fixed the problem. In the second example I pasted, I actually had to recompile the library that the missing symbol was coming from with -O0
.
I have also seen similar linking errors during the final link of an executable:
Linking dist/build/senioritymatters/senioritymatters ...
dist/build/senioritymatters/senioritymatters-tmp/Senior/Server.o: In function `s5OwR_info':
(.text+0x10559): undefined reference to `sybzmwithzmclasszm0zi6zi1_DataziGenericsziSYBziWithClassziInstances_constrZMad6fZN_closure'
dist/build/senioritymatters/senioritymatters-tmp/Senior/Server.o: In function `r5Hbl_info':
(.text+0x105a1): undefined reference to `sybzmwithzmclasszm0zi6zi1_DataziGenericsziSYBziWithClassziInstances_dataTypeZMad6eZN_closure'
dist/build/senioritymatters/senioritymatters-tmp/Senior/Server.o: In function `r5Hbj_srt':
(.data+0x2cec): undefined reference to `sybzmwithzmclasszm0zi6zi1_DataziGenericsziSYBziWithClassziInstances_constrZMad6fZN_closure'
dist/build/senioritymatters/senioritymatters-tmp/Senior/Server.o: In function `r5Hbl_srt':
(.data+0x2cf8): undefined reference to `sybzmwithzmclasszm0zi6zi1_DataziGenericsziSYBziWithClassziInstances_dataTypeZMad6eZN_closure'
dist/build/senioritymatters/senioritymatters-tmp/Senior/Store.o: In function `s5uFy_info':
(.text+0x7ad5): undefined reference to `sybzmwithzmclasszm0zi6zi1_DataziGenericsziSYBziWithClassziInstances_constrZMad6fZN_closure'
dist/build/senioritymatters/senioritymatters-tmp/Senior/Store.o: In function `s5uFy_info':
(.text+0x7b1d): undefined reference to `sybzmwithzmclasszm0zi6zi1_DataziGenericsziSYBziWithClassziInstances_dataTypeZMad6eZN_closure'
dist/build/senioritymatters/senioritymatters-tmp/Senior/Store.o: In function `r5rnO_closure':
(.data+0x16b0): undefined reference to `sybzmwithzmclasszm0zi6zi1_DataziGenericsziSYBziWithClassziInstances_constrZMad6fZN_closure'
dist/build/senioritymatters/senioritymatters-tmp/Senior/Store.o: In function `r5rnO_closure':
(.data+0x16bc): undefined reference to `sybzmwithzmclasszm0zi6zi1_DataziGenericsziSYBziWithClassziInstances_dataTypeZMad6eZN_closure'
dist/build/senioritymatters/senioritymatters-tmp/Senior/Types/Instances.o: In function `s48Uv_info':
(.text+0x6151d): undefined reference to `sybzmwithzmclasszm0zi6zi1_DataziGenericsziSYBziWithClassziInstances_constrZMad6fZN_closure'
dist/build/senioritymatters/senioritymatters-tmp/Senior/Types/Instances.o: In function `s48Uv_info':
(.text+0x61565): undefined reference to `sybzmwithzmclasszm0zi6zi1_DataziGenericsziSYBziWithClassziInstances_dataTypeZMad6eZN_closure'
dist/build/senioritymatters/senioritymatters-tmp/Senior/Types/Instances.o: In function `s4962_info':
(.text+0x61d69): undefined reference to `sybzmwithzmclasszm0zi6zi1_DataziGenericsziSYBziWithClassziInstances_constrZMad6fZN_closure'
dist/build/senioritymatters/senioritymatters-tmp/Senior/Types/Instances.o: In function `s4962_info':
(.text+0x61db1): undefined reference to `sybzmwithzmclasszm0zi6zi1_DataziGenericsziSYBziWithClassziInstances_dataTypeZMad6eZN_closure'
dist/build/senioritymatters/senioritymatters-tmp/Senior/Types/Instances.o: In function `s4jTk_info':
(.text+0x860c1): undefined reference to `sybzmwithzmclasszm0zi6zi1_DataziGenericsziSYBziWithClassziInstances_constrZMad6fZN_closure'
dist/build/senioritymatters/senioritymatters-tmp/Senior/Types/Instances.o: In function `s4jTk_info':
(.text+0x86109): undefined reference to `sybzmwithzmclasszm0zi6zi1_DataziGenericsziSYBziWithClassziInstances_dataTypeZMad6eZN_closure'
dist/build/senioritymatters/senioritymatters-tmp/Senior/Types/Instances.o: In function `s3xkI_closure':
(.data+0x74c8): undefined reference to `sybzmwithzmclasszm0zi6zi1_DataziGenericsziSYBziWithClassziInstances_constrZMad6fZN_closure'
dist/build/senioritymatters/senioritymatters-tmp/Senior/Types/Instances.o: In function `s3xkI_closure':
(.data+0x74d4): undefined reference to `sybzmwithzmclasszm0zi6zi1_DataziGenericsziSYBziWithClassziInstances_dataTypeZMad6eZN_closure'
dist/build/senioritymatters/senioritymatters-tmp/Senior/Types/Instances.o: In function `s3xkI_closure':
(.data+0x76a8): undefined reference to `sybzmwithzmclasszm0zi6zi1_DataziGenericsziSYBziWithClassziInstances_constrZMad6fZN_closure'
dist/build/senioritymatters/senioritymatters-tmp/Senior/Types/Instances.o: In function `s3xkI_closure':
(.data+0x76b4): undefined reference to `sybzmwithzmclasszm0zi6zi1_DataziGenericsziSYBziWithClassziInstances_dataTypeZMad6eZN_closure'
dist/build/senioritymatters/senioritymatters-tmp/Senior/Types/Instances.o: In function `r3or3_closure':
(.data+0xb824): undefined reference to `sybzmwithzmclasszm0zi6zi1_DataziGenericsziSYBziWithClassziInstances_constrZMad6fZN_closure'
dist/build/senioritymatters/senioritymatters-tmp/Senior/Types/Instances.o: In function `r3or3_closure':
(.data+0xb830): undefined reference to `sybzmwithzmclasszm0zi6zi1_DataziGenericsziSYBziWithClassziInstances_dataTypeZMad6eZN_closure'
collect2: ld returned 1 exit status
done.
Loading package QuickCheck-2.1.0.2 ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
In this case, compiling with -O0
also fixed the linking errors. However, I was also able to compile with -O2 -fignore-interface-pragmas
. In the case of the template-haskell errors, -fignore-interface-pragmas
did not help.
It seems that some GHC 6.12.1 users are able to compile happstack-data with out any problems. We have seen it happen under Linux and Mac OS X, and 32bit and 64bit. So there is no clear pattern there yet.
The one pattern I have noticed is that the undefined symbols/references always seem to end with _closure
.
Trac metadata
Trac field | Value |
---|---|
Version | 6.12.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | logic@seereason.com |
Operating system | |
Architecture |