Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,271
    • Issues 4,271
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 413
    • Merge Requests 413
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #12816

Closed
Open
Opened Nov 08, 2016 by Sylvain Henry@hsyl20Developer

Link error with GOLD linker

  1. I think we should add "pthread" to the list of extra-libs in "rts/package.conf.in" for the threaded RTS on UNIX-like host OSes.
  2. we should include MachDeps.h in "rts/package.conf.in"

Current master branch (2e8463b2) build is broken on my system[0]. When ghc-stage1 tries to produce ghc-stage2, I get:

/home/hsyl20/repo/ghc/rts/dist/build/libHSrts_thr-ghc8.1.20161107.so: error: undefined reference to 'pthread_create'
/home/hsyl20/repo/ghc/rts/dist/build/libHSrts_thr-ghc8.1.20161107.so: error: undefined reference to 'pthread_detach

(logs: http://pastebin.com/EbqEx6Gg )

I have tracked down the regression to the following recent commit: a977c965 If I revert this commit, it builds. However I think this commit has only revealed the bug: if I add "pthread" to the list of extra-libs in "rts/package.conf.in", it builds too. We already add it on freebsd and openbsd but not on Linux.

I think I have finally found out why other devs on #ghc haven't noticed this bug: my system uses the GOLD linker (because of #12748 (closed)), but if I switch back to the BFD linker, it builds without error.

While investigating this bug, I have noticed that linker flags for 64-bit atomic ops introduced by https://git.haskell.org/ghc.git/commitdiff/c06e3f46d24ef69f3a3d794f5f604cb8c2a40cbc aren't set while they should: WORD_SIZE_IN_BITS isn't defined because we don't include MachDeps.h

[0] x86-64, ArchLinux (Linux 4.8.6), GNU gold (GNU Binutils 2.27) 1.12, gcc (GCC) 6.2.1 20160830

Trac metadata
Trac field Value
Version 8.1
Type Bug
TypeOfFailure OtherFailure
Priority high
Resolution Unresolved
Component Compiler (Linking)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Assignee
Assign to
8.0.2
Milestone
8.0.2 (Past due)
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#12816