Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Met LNK2019 error when building a project which contains libs(built via msvc2017 32) with Kit msvc2015 32bits
Forum Updated to NodeBB v4.3 + New Features

Met LNK2019 error when building a project which contains libs(built via msvc2017 32) with Kit msvc2015 32bits

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
9 Posts 3 Posters 2.5k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    GingerMoon
    wrote on last edited by
    #1

    Hi All,
    I am trying to use grpc in QT.
    I met the link error below (sorry that it's Chinese...):
    crypto.lib(windows.obj):-1: error: LNK2019: 无法解析的外部符号 _SystemFunction036@8,该符号在函数 _CRYPTO_sysrand 中被引用

    Actually crypto.lib was build via VS2017 Win32 according to the grpc document(the part "cmake: Using Visual Studio 2015 or 2017..."), however, since there is no Kit for VS2017 32 bit, so I use Kit 2015 32 bit instead and get this link error.

    So it seems that we still net QT 32 bit for VS2017... am I right?
    Any insight would be very much appreciated!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @GingerMoon

      If you followed the instructions by the letter you have a 64bit build of gRPC, did you check that it is not the case before building your 32 bit application with it ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      G 2 Replies Last reply
      0
      • SGaistS SGaist

        @GingerMoon

        If you followed the instructions by the letter you have a 64bit build of gRPC, did you check that it is not the case before building your 32 bit application with it ?

        G Offline
        G Offline
        GingerMoon
        wrote on last edited by
        #3

        @SGaist
        Thank you very much for your reply.
        "If you followed the instructions by the letter you have a 64bit build of gRPC"
        Actually I follow the steps mentioned in the part "cmake: Using Visual Studio 2015 or 2017 (can only bui...“ and only get a grpc.sln. I didn't use Ninja or msys2.
        Anyway I am sure that the libs are generated by grpc.sln Win32 Debug vs2017.
        (I tired to build grpc.sln in vs2017 using x64 debug but failed.)

        I also tried to build the qt project with the kit msvc2017 64bit and got the expected error:
        libprotobufd.lib(generated_message_util.obj):-1: error: LNK1112: 模块计算机类型“x86”与目标计算机类型“x64”冲突
        (sorry for the Chinese again, it says libprotobufd.lib is x86 which confilicts with the target type x64)

        I am sorry if my another post is duplicate and confusing. I made that post before I know I got the notification of your reply. I hadn't thought you could reply to me so quickly! Really appreciate!

        Best Regards,
        Moon

        1 Reply Last reply
        0
        • SGaistS SGaist

          @GingerMoon

          If you followed the instructions by the letter you have a 64bit build of gRPC, did you check that it is not the case before building your 32 bit application with it ?

          G Offline
          G Offline
          GingerMoon
          wrote on last edited by
          #4

          @SGaist
          Just in case you wanna reproduce it, you can use https://github.com/Microsoft/vcpkg to download the grpc libs.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            I moved all answers here.

            As for your problem it's exactly what I wrote, you are mixing different architectures. In this case it has noting to do with the compiler you use.

            What errors did you get when building your dependencies in 64bit ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            G 2 Replies Last reply
            0
            • SGaistS SGaist

              I moved all answers here.

              As for your problem it's exactly what I wrote, you are mixing different architectures. In this case it has noting to do with the compiler you use.

              What errors did you get when building your dependencies in 64bit ?

              G Offline
              G Offline
              GingerMoon
              wrote on last edited by
              #6

              @SGaist
              I am pretty sure that the grpc libs were generated via building grpc.sln via vs2017 default configuration (Debug Win32).
              The grpc.sln was generated by [ cmake .. -G "Visual Studio 15 2017" -DCMAKE_BUILD_TYPE=Release ] mentioned in the mentioned grpc document.

              And these libs can be used for a Helloworld project in vs2017.

              If I tried to build grpc.sln in vs2017 with the configuration Debug x64,
              (below is some configuration of projects' Debug x64:
              /OUT:"C:\cppWorkspace\grpc.build\x64\Debug\gpr.lib" /MACHINE:X64 /NOLOGO
              /OUT:"C:\cppWorkspace\grpc.build\x64\Debug\grpc.lib" /MACHINE:X64 /NOLOGO )

              the link errors look like below:
              96>x64\Debug\main.obj : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'x86'
              96>Done building project "protoc.vcxproj" -- FAILED.
              ...
              Severity Code Description Project File Line Suppression State
              Error LNK1112 module machine type 'x64' conflicts with target machine type 'x86' dsa C:\cppWorkspace\grpc.build\third_party\boringssl\crypto\dsa\x64\Debug\dsa.obj 1
              Error LNK1112 module machine type 'x64' conflicts with target machine type 'x86' ec_extra C:\cppWorkspace\grpc.build\third_party\boringssl\crypto\ec_extra\x64\Debug\ec_asn1.obj 1
              ...

              1 Reply Last reply
              0
              • SGaistS SGaist

                I moved all answers here.

                As for your problem it's exactly what I wrote, you are mixing different architectures. In this case it has noting to do with the compiler you use.

                What errors did you get when building your dependencies in 64bit ?

                G Offline
                G Offline
                GingerMoon
                wrote on last edited by GingerMoon
                #7

                @SGaist
                The root cause seems to be that in QT my compiler cannot find the Advapi32.lib.
                However, in VS2017, it can be found.
                ...zlibd.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib"...

                I think maybe it is a bug of QT, or shall we add QT 32 bit for vs20117link text?

                After add this lib C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\um\x86\advapi32 to the project, the link error is solved.

                Related links:
                https://irclog.whitequark.org/crystal-lang/2018-01-17

                My QT version is
                Qt Creator 4.5.0
                Based on Qt 5.10.0 (MSVC 2015, 32 bit)
                Built on Dec 4 2017 04:12:22

                jsulmJ 1 Reply Last reply
                0
                • G GingerMoon

                  @SGaist
                  The root cause seems to be that in QT my compiler cannot find the Advapi32.lib.
                  However, in VS2017, it can be found.
                  ...zlibd.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib"...

                  I think maybe it is a bug of QT, or shall we add QT 32 bit for vs20117link text?

                  After add this lib C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\um\x86\advapi32 to the project, the link error is solved.

                  Related links:
                  https://irclog.whitequark.org/crystal-lang/2018-01-17

                  My QT version is
                  Qt Creator 4.5.0
                  Based on Qt 5.10.0 (MSVC 2015, 32 bit)
                  Built on Dec 4 2017 04:12:22

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @GingerMoon said in Met LNK2019 error when building a project which contains libs(built via msvc2017 32) with Kit msvc2015 32bits:

                  My QT version is
                  Qt Creator 4.5.0
                  Based on Qt 5.10.0 (MSVC 2015, 32 bit)
                  Built on Dec 4 2017 04:12:22

                  This is not your Qt version, this is Qt version which was used to build QtCreator.
                  Which Qt version did you install?
                  You can check this in your Kit configurations.

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  G 1 Reply Last reply
                  0
                  • jsulmJ jsulm

                    @GingerMoon said in Met LNK2019 error when building a project which contains libs(built via msvc2017 32) with Kit msvc2015 32bits:

                    My QT version is
                    Qt Creator 4.5.0
                    Based on Qt 5.10.0 (MSVC 2015, 32 bit)
                    Built on Dec 4 2017 04:12:22

                    This is not your Qt version, this is Qt version which was used to build QtCreator.
                    Which Qt version did you install?
                    You can check this in your Kit configurations.

                    G Offline
                    G Offline
                    GingerMoon
                    wrote on last edited by
                    #9

                    @jsulm
                    Thank you for the notice.
                    It's Qt 5.10.0 MSVC2015 32bit.

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved