[GHC] #9215: GHC 7.8.2 mingw-w64: symbol not found in link

#9215: GHC 7.8.2 mingw-w64: symbol not found in link ------------------------------------+------------------------------------- Reporter: stuartallenmills | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Keywords: | Operating System: Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ------------------------------------+------------------------------------- This includes calls such as strdup, stat, , and snprintf. These calls are not available in the 64 bit libraries (though 64 bit versions are such as _strdup, _snprintf) These problems have occurred in building yaml and unix-compat. They also occurred in system-fileio but jmilikin generated a patch for that library -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9215 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9215: GHC 7.8.2 mingw-w64: symbol not found in link -------------------------------------+---------------------------------- Reporter: stuartallenmills | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+---------------------------------- Changes (by stuartallenmills): * architecture: Unknown/Multiple => x86_64 (amd64) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9215#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9215: GHC 7.8.2 mingw-w64: symbol not found in link -------------------------------------+---------------------------------- Reporter: stuartallenmills | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 (amd64) Type of failure: Other | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+---------------------------------- Changes (by stuartallenmills): * failure: None/Unknown => Other * os: Unknown/Multiple => Windows -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9215#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9215: GHC 7.8.2 mingw-w64: symbol not found in link -------------------------------------+---------------------------------- Reporter: stuartallenmills | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 (amd64) Type of failure: Other | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+---------------------------------- Changes (by snoyberg): * cc: snoyberg (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9215#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9215: GHC 7.8.2 mingw-w64: symbol not found in link -------------------------------------+------------------------------------- Reporter: | Owner: stuartallenmills | Status: new Type: bug | Milestone: Priority: normal | Version: 7.8.2 Component: Compiler | Keywords: Resolution: | Architecture: x86_64 (amd64) Operating System: Windows | Difficulty: Unknown Type of failure: Other | Blocked By: Test Case: | Related Tickets: #9218 Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by gintas): * related: => #9218 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9215#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9215: GHC 7.8.2 mingw-w64: symbol not found in link -------------------------------------+------------------------------------- Reporter: stuartallenmills | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 | (amd64) Type of failure: Other | Test Case: Blocked By: 9218 | Blocking: Related Tickets: #9218 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Phyx-): Hmm these functions are marked deprecated on MSDN. The recommendation is to use the C++ ISO conforming version of these POSIX calls https://msdn.microsoft.com/en-us/library/ms235454.aspx which always includes the _ in the names. Even when using cdecl. Is this ticket still an issue? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9215#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9215: GHC 7.8.2 mingw-w64: symbol not found in link -------------------------------------+------------------------------------- Reporter: stuartallenmills | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 | (amd64) Type of failure: Other | Test Case: Blocked By: 9218 | Blocking: Related Tickets: #9218 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by Phyx-): * cc: Phyx- (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9215#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9215: GHC 7.8.2 mingw-w64: symbol not found in link -------------------------------------+------------------------------------- Reporter: stuartallenmills | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 | (amd64) Type of failure: Other | Test Case: Blocked By: 9218 | Blocking: Related Tickets: #9218 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by thomie): Some projects have changed their code: {{{ #if _WIN64 #define STRDUP _strdup #else #define STRDUP strdup #endif }}} * https://github.com/snoyberg/yaml/pull/45 * https://github.com/bsl/bindings- GLFW/commit/86271bcff4897c1c563af0058111705111d1ba7e We should probably not add any special cases to the linker (it's complicated enough already!) to effectively un-deprecate those functions. It is still rather unfortunate that those ifdefs are unnecessary though. @snoyberg might have an opinion, since he mentioned in https://github.com/snoyberg/yaml/issues/44#issuecomment-46459264: "There's no good reason why C code being compiled by GHC should need to be modified to avoid using strdup, that's certainly a bug in the toolchain, not the code." -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9215#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9215: GHC 7.8.2 mingw-w64: symbol not found in link -------------------------------------+------------------------------------- Reporter: stuartallenmills | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 | (amd64) Type of failure: Other | Test Case: Blocked By: 9218 | Blocking: Related Tickets: #9218 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Phyx-): I have just removed all the special cases from the linker in Phab:D1805 which means GHCi will *probably* not load this library anymore either... If it ever did.. I also think that their patch only fixes 64bit compilation but not 32bit. The prefixed _ has nothing to do with the usual name mangling of functions. Instead it was a conscious choice by Microsoft to deprecate the functions that are not part of the C standard (`strdup` is `POSIX`, not `C`, and the Microsoft POSIX Subsystem was never fully POSIX compliant afaik, SUA was but that's now deprecated.) into a different namespace following the C++ ISO naming convention. https://msdn.microsoft.com/en- us/subscriptions/7e259932-c6c8-4c1a-9637-639e591681a5(v=vs.90) in order to free up the namespace to user defined functions. As in, on Windows `strdup` should always be used as `_strdup` regardless if it's 32 or 64bit. And indeed, if you look at the export table of the standard C runtime on Windows (msvcrt) which both GHCi and MingW-w64 link to: {{{
dumpbin /exports c:\Windows\SysWOW64\msvcrt.dll | findstr "strdup" 859 35A 000247AD _strdup 860 35B 000801D6 _strdup_dbg
dumpbin /exports c:\Windows\System32\msvcrt.dll | findstr "strdup" 742 2E5 000152D0 _strdup 743 2E6 0006635C _strdup_dbg }}}
Both the 32bit and the 64bit version report only the undeprecated function, always with the _ prefix. So this is not a GHC bug, nor a Windows one. The library just did not use the correct function as stated on MSDN. The correct fix would probably be {{{ #if _WIN32 #define STRDUP _strdup #else #define STRDUP strdup #endif }}} Because it will always be the case on Windows. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9215#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9215: GHC 7.8.2 mingw-w64: symbol not found in link -------------------------------------+------------------------------------- Reporter: stuartallenmills | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: invalid | Keywords: Operating System: Windows | Architecture: x86_64 | (amd64) Type of failure: Other | Test Case: Blocked By: 9218 | Blocking: Related Tickets: #9218 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * status: new => closed * resolution: => invalid Comment: Alright, sounds convincing to me. Let's close this.
I have just removed all the special cases from the linker in Phab:D1805
Maybe you want to add something to the [wiki:Migration/8.0 migration guide] on that, or to the release notes maybe. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9215#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9215: GHC 7.8.2 mingw-w64: symbol not found in link -------------------------------------+------------------------------------- Reporter: stuartallenmills | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: invalid | Keywords: Operating System: Windows | Architecture: x86_64 | (amd64) Type of failure: Other | Test Case: Blocked By: 9218 | Blocking: Related Tickets: #9218 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Phyx-):
I have just removed all the special cases from the linker in Phab:D1805
Maybe you want to add something to the [wiki:Migration/8.0 migration guide] on that, or to the release notes maybe.
Fair point, I'll add a todo for when the patch is accepted. Thanks! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9215#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC