[GHC] #12209: Windows: ByteCodeLink can't find labels "lseek" and "write"

#12209: Windows: ByteCodeLink can't find labels "lseek" and "write" -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Runtime | Version: 8.0.1 System (Linker) | Keywords: | Operating System: Windows Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Tests `ffi017` and `ffi021` are failing on Windows, for `WAY=ghci`.
During interactive linking, GHCi couldn't find the following symbol: lseek
During interactive linking, GHCi couldn't find the following symbol: write
These are regressions from 7.10.3. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12209 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12209: Windows: ByteCodeLink can't find labels "lseek" and "write" -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 8.0.1 (Linker) | Resolution: | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by thomie): Changing `lseek` to `_lseek` makes `ffi017` pass. But if that is the correct fix (CPP guarded), then why did the test not fail for other ways than `WAY=ghci`? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12209#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12209: Windows: ByteCodeLink can't find labels "lseek" and "write"
-------------------------------------+-------------------------------------
Reporter: thomie | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Runtime System | Version: 8.0.1
(Linker) |
Resolution: | Keywords:
Operating System: Windows | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Thomas Miedema

#12209: Windows: ByteCodeLink can't find labels "lseek" and "write" -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 8.0.1 (Linker) | Resolution: | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Phyx-): `lseek` and `write` existed before Microsoft deprecated the POSIX functions. As such, they did used to exist https://msdn.microsoft.com/en- us/library/ms235323.aspx During `WAY=ghci` we query `msvcrt.dll` directly which is the C runtime. The function has been deprecated long enough that it's been removed. {{{ e:\temp\dynamic>dumpbin /exports c:\Windows\System32\msvcrt.dll | findstr lseek 496 1EF 0001D080 _lseek = _lseek 497 1F0 0001D230 _lseeki64 = _lseeki64 e:\temp\dynamic>dumpbin /exports c:\Windows\System32\msvcrt.dll | findstr write 998 3E5 0001FA20 _write = _write 1113 458 0004DB90 fwrite = fwrite }}} During linking, `Mingw-w64` ends up linking against the import library `msvcrt.a` which contains a redirect from `lseek` to `_lseek`. Probably for backwards compatibility. {{{ $ nm -s "inplace\mingw\x86_64-w64-mingw32\lib\libmsvcrt.a" | grep lseek _lseeki64 in dcnfs00450.o __imp__lseeki64 in dcnfs00450.o _lseek in dcnfs00449.o __imp__lseek in dcnfs00449.o lseek in dcnfs00448.o __imp_lseek in dcnfs00448.o 0000000000000000 I __imp__lseeki64 0000000000000000 T _lseeki64 0000000000000000 I __imp__lseek 0000000000000000 T _lseek 0000000000000000 I __imp_lseek 0000000000000000 T lseek }}} So the correct solution would be to use the `_` versions. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12209#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12209: Windows: ByteCodeLink can't find labels "lseek" and "write" -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.0.2 Component: Runtime System | Version: 8.0.1 (Linker) | Resolution: | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * milestone: => 8.0.2 Comment: Phyx, do you think you'll have time to submit a patch for this? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12209#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12209: Windows: ByteCodeLink can't find labels "lseek" and "write" -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.0.2 Component: Runtime System | Version: 8.0.1 (Linker) | Resolution: | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Phyx-): Sure, I'll submit one this week. I'm probably just going to allow the use of the deprecated functions. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12209#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12209: Windows: ByteCodeLink can't find labels "lseek" and "write" -------------------------------------+------------------------------------- Reporter: thomie | Owner: Phyx- Type: bug | Status: new Priority: normal | Milestone: 8.0.2 Component: Runtime System | Version: 8.0.1 (Linker) | Resolution: | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by Phyx-): * owner: => Phyx- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12209#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12209: Windows: ByteCodeLink can't find labels "lseek" and "write" -------------------------------------+------------------------------------- Reporter: thomie | Owner: Phyx- Type: bug | Status: new Priority: normal | Milestone: 8.0.2 Component: Runtime System | Version: 8.0.1 (Linker) | Resolution: | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #12497 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by Phyx-): * related: => #12497 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12209#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12209: Windows: ByteCodeLink can't find labels "lseek" and "write" -------------------------------------+------------------------------------- Reporter: thomie | Owner: Phyx- Type: bug | Status: patch Priority: normal | Milestone: 8.0.2 Component: Runtime System | Version: 8.0.1 (Linker) | Resolution: | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #12497 | Differential Rev(s): Phab:D2478 Wiki Page: | -------------------------------------+------------------------------------- Changes (by Phyx-): * status: new => patch * differential: => Phab:D2478 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12209#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12209: Windows: ByteCodeLink can't find labels "lseek" and "write" -------------------------------------+------------------------------------- Reporter: thomie | Owner: Phyx- Type: bug | Status: closed Priority: normal | Milestone: 8.0.2 Component: Runtime System | Version: 8.0.1 (Linker) | Resolution: duplicate | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #12497 | Differential Rev(s): Phab:D2478 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => duplicate Comment: Let's close this as a duplicate of #12497. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12209#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12209: Windows: ByteCodeLink can't find labels "lseek" and "write"
-------------------------------------+-------------------------------------
Reporter: thomie | Owner: Phyx-
Type: bug | Status: closed
Priority: normal | Milestone: 8.0.2
Component: Runtime System | Version: 8.0.1
(Linker) |
Resolution: duplicate | Keywords:
Operating System: Windows | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: #12497 | Differential Rev(s): Phab:D2478
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Tamar Christina
participants (1)
-
GHC