Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-4159

Building tests fails on MSYS2 (MinGW64) due to a (small?) linker error

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.11.0
    • Component/s: Build Process
    • Labels:
      None
    • Environment:

      MSYS2 MinGW64 compiler gcc-6.3

      Description

      When I build thrift in static mode with cmake, and I enable BUILD_TESTING,
      I get a linker error:

      Scanning dependencies of target SecurityTest
      [ 65%] Building CXX object lib/cpp/test/CMakeFiles/SecurityTest.dir/SecurityTest.cpp.obj
      [ 66%] Linking CXX executable ../../../bin/SecurityTest.exe
      ../../libthrift.a(TServerSocket.cpp.obj):TServerSocket.cpp:(.text+0xcb3): undefined reference to `apache::thrift::transport::TWinsockSingleton::create()'
      ../../libthrift.a(TServerSocket.cpp.obj):TServerSocket.cpp:(.text+0xcc8): undefined reference to `thrift_socketpair(int, int, int, unsigned long long*)'
      ../../libthrift.a(TServerSocket.cpp.obj):TServerSocket.cpp:(.text+0xcf8): undefined reference to `thrift_socketpair(int, int, int, unsigned long long*)'
      ../../libthrift.a(TServerSocket.cpp.obj):TServerSocket.cpp:(.text+0xfa3): undefined reference to `thrift_fcntl'
      ../../libthrift.a(TServerSocket.cpp.obj):TServerSocket.cpp:(.text+0xfc0): undefined reference to `thrift_fcntl'
      ../../libthrift.a(TServerSocket.cpp.obj):TServerSocket.cpp:(.text+0x1127): undefined reference to `thrift_sleep(unsigned int)'
      ../../libthrift.a(TServerSocket.cpp.obj):TServerSocket.cpp:(.text+0x200c): undefined reference to `thrift_poll'
      ../../libthrift.a(TServerSocket.cpp.obj):TServerSocket.cpp:(.text+0x212e): undefined reference to `thrift_fcntl'
      ../../libthrift.a(TServerSocket.cpp.obj):TServerSocket.cpp:(.text+0x214a): undefined reference to `thrift_fcntl'
      ../../libthrift.a(TSSLSocket.cpp.obj):TSSLSocket.cpp:(.text+0x211e): undefined reference to `thrift_poll'
      ../../libthrift.a(TSSLSocket.cpp.obj):TSSLSocket.cpp:(.text+0x21cd): undefined reference to `thrift_poll'
      ../../libthrift.a(TSSLSocket.cpp.obj):TSSLSocket.cpp:(.text+0x4a1a): undefined reference to `thrift_fcntl'
      ../../libthrift.a(TSSLSocket.cpp.obj):TSSLSocket.cpp:(.text+0x4a36): undefined reference to `thrift_fcntl'
      ../../libthrift.a(TSSLSocket.cpp.obj):TSSLSocket.cpp:(.text+0x58da): undefined reference to `thrift_fcntl'
      ../../libthrift.a(TSSLSocket.cpp.obj):TSSLSocket.cpp:(.text+0x58f6): undefined reference to `thrift_fcntl'
      ../../libthrift.a(TOutput.cpp.obj):TOutput.cpp:(.text+0x54): undefined reference to `thrift_ctime_r(long long const*, char*)'
      ../../libthrift.a(TSocket.cpp.obj):TSocket.cpp:(.text+0x1e76): undefined reference to `thrift_poll'
      ../../libthrift.a(TSocket.cpp.obj):TSocket.cpp:(.text+0x25a0): undefined reference to `thrift_fcntl'
      ../../libthrift.a(TSocket.cpp.obj):TSocket.cpp:(.text+0x25c5): undefined reference to `thrift_fcntl'
      ../../libthrift.a(TSocket.cpp.obj):TSocket.cpp:(.text+0x26ee): undefined reference to `thrift_poll'
      ../../libthrift.a(TSocket.cpp.obj):TSocket.cpp:(.text+0x2749): undefined reference to `thrift_fcntl'
      ../../libthrift.a(TSocket.cpp.obj):TSocket.cpp:(.text+0x2a0a): undefined reference to `thrift_fcntl'
      ../../libthrift.a(TSocket.cpp.obj):TSocket.cpp:(.text+0x35f1): undefined reference to `apache::thrift::transport::TWinsockSingleton::create()'
      ../../libthrift.a(TSocket.cpp.obj):TSocket.cpp:(.text+0x3a44): undefined reference to `thrift_gettimeofday(timeval*, timezone*)'
      ../../libthrift.a(TSocket.cpp.obj):TSocket.cpp:(.text+0x3aaf): undefined reference to `thrift_poll'
      ../../libthrift.a(TSocket.cpp.obj):TSocket.cpp:(.text+0x3cfc): undefined reference to `thrift_gettimeofday(timeval*, timezone*)'
      ../../libthrift.a(TSocket.cpp.obj):TSocket.cpp:(.text+0x3d3f): undefined reference to `thrift_usleep(unsigned int)'
      ../../libthrift.a(TSocket.cpp.obj):TSocket.cpp:(.text+0x6443): undefined reference to `apache::thrift::transport::TWinsockSingleton::create()'
      collect2.exe: error: ld returned 1 exit status
      make[2]: *** [lib/cpp/test/CMakeFiles/SecurityTest.dir/build.make:116: bin/SecurityTest.exe] Error 1
      make[1]: *** [CMakeFiles/Makefile2:1269: lib/cpp/test/CMakeFiles/SecurityTest.dir/all] Error 2
      make: *** [Makefile:161: all] Error 2
      ==> ERROR: A failure occurred in build().
          Aborting...
      

      Typically this comes from the fact that MSYS2 is more picky about undefined
      symbols than other platforms are. The symbols look a bit like they would
      be defined in a basic thrift library. Could you please check if the tests
      must link the thrift libraries and/or if a library may be missing there?

        Attachments

          Activity

            People

            • Assignee:
              jking3 James E. King III
              Reporter:
              emmenlau Mario Emmenlauer

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment