[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 <thomasmiedema@…>): In [changeset:"1d938aa3373f464f46dd3806a21aa85dda764ec6/ghc" 1d938aa/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="1d938aa3373f464f46dd3806a21aa85dda764ec6" Testsuite: mark tests expect broken * CgStaticPointers, GcStaticPointers, ListStaticPointers, TcStaticPointers01, TcStaticPointers02: #12207 * T11535: #12210 * ffi017/ffi021: #12209 * T11108: #11108 * T9646: #9646 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12209#comment:2> 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 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 <tamar@…>): In [changeset:"e5ecb2010514405ac1b9b1285a8a65c00a5fd4e0/ghc" e5ecb20/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="e5ecb2010514405ac1b9b1285a8a65c00a5fd4e0" Added support for deprecated POSIX functions on Windows. Summary: With the introduction of 8.0.1 We've stopped supporting in GHCi the use of POSIX functions under their deprecated names on Windows. This to be compatible with object and libraries from the most popular compilers on the platform (Microsoft and Intel compilers). However this brings a confusing disparity between the compiled and interpreted behavior since MingW-W64 does support the deprecated names. Also It seems clear that package writers won't update their packages to properly support Windows. As such I have added redirects in the RTS for the deprecated functions as listed on https://msdn.microsoft.com/en-us/library/ms235384.aspx. This won't export the functions (as in, they won't be in the symbol table of compiled code for the RTS.) but we inject them into the symbol table of the dynamic linker at startup. Test Plan: ./validate and make test TEST="ffi017 ffi021" Reviewers: thomie, simonmar, RyanGlScott, bgamari, austin, hvr, erikd Reviewed By: simonmar, bgamari Subscribers: RyanGlScott, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D2500 GHC Trac Issues: #12209, #12497, #12496 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12209#comment:10> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC