[GHC] #11155: Trivial error thunk gives "undefined reference to stg_ap_0_upd_info"

#11155: Trivial error thunk gives "undefined reference to stg_ap_0_upd_info"
-------------------------------------+-------------------------------------
Reporter: simonpj | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.10.2
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
This error popped up when Alan was coding the solution for #11028. The
error is utterly unrelated to what Alan was working on. Here's a
reproducer
{{{
{-# OPTIONS_GHC -O -fno-full-laziness #-}
module Main where
foo :: Bool
{-# NOINLINE foo #-}
foo = error "rk"
bar x = let t :: Char
t = case foo of { True -> 'v'; False -> 'y' }
in [t]
main = print (bar ())
}}}
Just compile that and you get
{{{
Foo.o: In function `c1Sm_info':
(.text+0x29a): undefined reference to `stg_ap_0_upd_info'
}}}
Why do we get that unresolved symbol? The STG code for `bar` looks like
{{{
Main.bar :: forall t_aup. t_aup -> [GHC.Types.Char]
[GblId, Arity=1, Str=DmdType

#11155: Trivial thunk gives "undefined reference to stg_ap_0_upd_info" -------------------------------------+------------------------------------- Reporter: simonpj | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11155#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11155: Trivial thunk gives "undefined reference to stg_ap_0_upd_info" -------------------------------------+------------------------------------- Reporter: simonpj | Owner: Type: bug | Status: new Priority: high | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by hvr): * priority: normal => high Comment: Fyi, I'm seeing this during GHC building as well (which makes the current Ubuntu PPA nightlies fail): {{{ ... AR compiler/stage2/build/libHSghc-7.11.20151202.a HC [stage 1] compiler/stage2/build/libHSghc-7.11.20151202-ghc7.11.20151202.so /usr/bin/ar: creating compiler/stage2/build/libHSghc-7.11.20151202.a Warning: -rtsopts and -with-rtsopts have no effect with -shared. Call hs_init_ghc() from your main() function to set these options. "rm" -f compiler/stage2/build/libHSghc-7.11.20151202.a.contents HC [stage 1] ghc/stage2/build/GhciTags.dyn_o HC [stage 1] ghc/stage2/build/InteractiveUI.dyn_o HC [stage 1] ghc/stage2/build/Main.dyn_o HC [stage 1] ghc/stage2/build/tmp/ghc-stage2 Warning: -rtsopts and -with-rtsopts have no effect with -no-hs-main. Call hs_init_ghc() from your main() function to set these options. /«PKGBUILDDIR»/compiler/stage2/build/libHSghc-7.11.20151202-ghc7.11.20151202.so: undefined reference to `stg_ap_0_upd_info' collect2: ld returned 1 exit status `gcc' failed in phase `Linker'. (Exit code: 1) make[3]: *** [ghc/stage2/build/tmp/ghc-stage2] Error 1 make[2]: *** [all] Error 2 make[2]: Leaving directory `/«PKGBUILDDIR»' make[1]: *** [override_dh_auto_build] Error 2 make[1]: Leaving directory `/«PKGBUILDDIR»' make: *** [build] Error 2 }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11155#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11155: Trivial thunk gives "undefined reference to stg_ap_0_upd_info" -------------------------------------+------------------------------------- Reporter: simonpj | Owner: Type: bug | Status: new Priority: high | Milestone: Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by alanz): * cc: alanz (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11155#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11155: Trivial thunk gives "undefined reference to stg_ap_0_upd_info"
-------------------------------------+-------------------------------------
Reporter: simonpj | Owner:
Type: bug | Status: new
Priority: high | Milestone:
Component: Compiler | Version: 7.10.2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Simon Peyton Jones

#11155: Trivial thunk gives "undefined reference to stg_ap_0_upd_info" -------------------------------------+------------------------------------- Reporter: simonpj | Owner: Type: bug | Status: closed Priority: high | Milestone: Component: Compiler | Version: 7.10.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | simplCore/should_compile/T11155 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * status: new => closed * testcase: => simplCore/should_compile/T11155 * resolution: => fixed Comment: I claim this is fixed. Alan, Herbert, does this fix the manifestations you see? I'll close it meanwhile. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11155#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11155: Trivial thunk gives "undefined reference to stg_ap_0_upd_info" -------------------------------------+------------------------------------- Reporter: simonpj | Owner: Type: bug | Status: closed Priority: high | Milestone: Component: Compiler | Version: 7.10.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | simplCore/should_compile/T11155 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by alanz): Yes, the linker error is gone for haddock in D1558. Thanks. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11155#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11155: Trivial thunk gives "undefined reference to stg_ap_0_upd_info" -------------------------------------+------------------------------------- Reporter: simonpj | Owner: Type: bug | Status: closed Priority: high | Milestone: Component: Compiler | Version: 7.10.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | simplCore/should_compile/T11155 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by hvr): I don't see the manifestation either anymore (i.e. the PPA builds work again now) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11155#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11155: Trivial thunk gives "undefined reference to stg_ap_0_upd_info" -------------------------------------+------------------------------------- Reporter: simonpj | Owner: Type: bug | Status: closed Priority: high | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | simplCore/should_compile/T11155 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by gridaphobe): I just ran into this (or a similar issue) when building GHC (9b6820cdd6bac8b8346be48224627e3feefa9036) on OSX. This is a clean build with the default settings, and it fails at the very last step of stage 2. {{{ HC [stage 1] ghc/stage2/build/tmp/ghc-stage2 Warning: -rtsopts and -with-rtsopts have no effect with -no-hs-main. Call hs_init_ghc() from your main() function to set these options. Undefined symbols for architecture x86_64: "_stg_sel_17_upd_info", referenced from: _s1s8Z_info in UI.dyn_o _s1s9w_info in UI.dyn_o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) `gcc' failed in phase `Linker'. (Exit code: 1) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11155#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11155: Trivial thunk gives "undefined reference to stg_ap_0_upd_info" -------------------------------------+------------------------------------- Reporter: simonpj | Owner: Type: bug | Status: closed Priority: high | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | simplCore/should_compile/T11155 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by wereHamster): Ran into this trying to build HEAD today on Mac OS X 10.11.3. But a slightly different message: {{{ Warning: -rtsopts and -with-rtsopts have no effect with -no-hs-main. Call hs_init_ghc() from your main() function to set these options. Undefined symbols for architecture x86_64: "_stg_sel_17_upd_info", referenced from: _s1xPf_info in UI.dyn_o _s1xQA_info in UI.dyn_o _s1xZU_info in UI.dyn_o _s1y0r_info in UI.dyn_o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) `gcc' failed in phase `Linker'. (Exit code: 1) make[1]: *** [ghc/stage2/build/tmp/ghc-stage2] Error 1 make: *** [all] Error 2 }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11155#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11155: Trivial thunk gives "undefined reference to stg_ap_0_upd_info" -------------------------------------+------------------------------------- Reporter: simonpj | Owner: Type: bug | Status: closed Priority: high | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | simplCore/should_compile/T11155 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by George): I ran into this today building 8.0.1 rc3 on Mac 10.11.4 with XCode 7.3 invoking with "make -j5": Warning: -rtsopts and -with-rtsopts have no effect with -no-hs-main. Call hs_init_ghc() from your main() function to set these options. Undefined symbols for architecture x86_64: "_stg_sel_17_upd_info", referenced from: _s1xEL_info in UI.dyn_o _s1xG6_info in UI.dyn_o _s1xPC_info in UI.dyn_o _s1xQ9_info in UI.dyn_o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) `gcc' failed in phase `Linker'. (Exit code: 1) make[1]: *** [ghc/stage2/build/tmp/ghc-stage2] Error 1 make: *** [all] Error 2 bash-3.2$ -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11155#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11155: Trivial thunk gives "undefined reference to stg_ap_0_upd_info"
-------------------------------------+-------------------------------------
Reporter: simonpj | Owner:
Type: bug | Status: new
Priority: high | Milestone: 8.0.1
Component: Compiler | Version: 7.10.2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
| simplCore/should_compile/T11155
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Changes (by bgamari):
* status: closed => new
* resolution: fixed =>
@@ -4,1 +4,1 @@
- {{{
+ {{{#!hs
New description:
This error popped up when Alan was coding the solution for #11028. The
error is utterly unrelated to what Alan was working on. Here's a
reproducer
{{{#!hs
{-# OPTIONS_GHC -O -fno-full-laziness #-}
module Main where
foo :: Bool
{-# NOINLINE foo #-}
foo = error "rk"
bar x = let t :: Char
t = case foo of { True -> 'v'; False -> 'y' }
in [t]
main = print (bar ())
}}}
Just compile that and you get
{{{
Foo.o: In function `c1Sm_info':
(.text+0x29a): undefined reference to `stg_ap_0_upd_info'
}}}
Why do we get that unresolved symbol? The STG code for `bar` looks like
{{{
Main.bar :: forall t_aup. t_aup -> [GHC.Types.Char]
[GblId, Arity=1, Str=DmdType

#11155: Trivial thunk gives "undefined reference to stg_ap_0_upd_info" -------------------------------------+------------------------------------- Reporter: simonpj | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | simplCore/should_compile/T11155 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * priority: high => highest -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11155#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11155: Trivial thunk gives "undefined reference to stg_ap_0_upd_info" -------------------------------------+------------------------------------- Reporter: simonpj | Owner: Type: bug | Status: closed Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | simplCore/should_compile/T11155 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => closed * resolution: => fixed Comment: This actually appears to be a much different issue from that originally reported in this ticket as the symbol in question are update closures instead of zero-arity applications. Let's track this new issue in #11823. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11155#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11155: Trivial thunk gives "undefined reference to stg_ap_0_upd_info" -------------------------------------+------------------------------------- Reporter: simonpj | Owner: Type: bug | Status: closed Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | simplCore/should_compile/T11155 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): See Phab:D2230 for a quick patch to catch this sort of issue during C-- pretty-printing. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11155#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11155: Trivial thunk gives "undefined reference to stg_ap_0_upd_info"
-------------------------------------+-------------------------------------
Reporter: simonpj | Owner:
Type: bug | Status: closed
Priority: highest | Milestone: 8.0.1
Component: Compiler | Version: 7.10.2
Resolution: fixed | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
| simplCore/should_compile/T11155
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#11155: Trivial thunk gives "undefined reference to stg_ap_0_upd_info"
-------------------------------------+-------------------------------------
Reporter: simonpj | Owner: (none)
Type: bug | Status: closed
Priority: highest | Milestone: 8.0.1
Component: Compiler | Version: 7.10.2
Resolution: fixed | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
| simplCore/should_compile/T11155
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Simon Peyton Jones
participants (1)
-
GHC