Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Static link of cryptopp lib to Qt-app
Forum Updated to NodeBB v4.3 + New Features

Static link of cryptopp lib to Qt-app

Scheduled Pinned Locked Moved Unsolved 3rd Party Software
3 Posts 3 Posters 1.8k 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.
  • T Offline
    T Offline
    themts
    wrote on last edited by A Former User
    #1

    Hi guys,

    I want to use cryptopp in one of my projects. As I don't want to use a dll for security reasons, I have to compile cryptopp into my application.
    I thought to compile a lib from visual studio and add it as a static lib to my Qt-project.
    Unfortunately Qt gives me linker errors

    cryptlib.lib(cryptlib.obj):-1: error: LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in main.obj
    

    I'm using the windows binaries of Qt so it's probably built with /MD
    Is it even possible to statically add a lib in my Qt-version without recompiling Qt with /MT ?

    CU
    mts

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

      Hi,

      AFAIK, no, however you can build cryptopp statically while still linking to the dynamic runtime, then you'll be able to link it to your Qt application.

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

      1 Reply Last reply
      2
      • M Offline
        M Offline
        MTNPEAK
        wrote on last edited by
        #3

        I was able to compile 64 bit MSVC 2017 cryptopp v700 using the following pro file.
        Note: static library using MDd & MD cxx flags which will solve your original issue, LNK2038 mismatch.

        TEMPLATE = lib
        TARGET = cryptopp
        INCLUDEPATH += .
        CONFIG -= qt
        CONFIG += staticlib
        CONFIG -= debug_and_release debug_and_release_target
        LIBS += -lws2_32
        
        QMAKE_CXXFLAGS_DEBUG += /MDd
        QMAKE_CXXFLAGS_RELEASE += /MD
        
        
        win32: DESTDIR = ./
        
        OBJECTS_DIR = ./.obj
        MOC_DIR = ./.moc
        RCC_DIR = ./.qrc
        UI_DIR = ./.ui
        
        # Input
        HEADERS += 3way.h \
                   adler32.h \
                   adv-simd.h \
                   aes.h \
                   algebra.h \
                   algparam.h \
                   arc4.h \
                   argnames.h \
                   aria.h \
                   asn.h \
                   authenc.h \
                   base32.h \
                   base64.h \
                   basecode.h \
                   blake2.h \
                   blowfish.h \
                   blumshub.h \
                   camellia.h \
                   cast.h \
                   cbcmac.h \
                   ccm.h \
                   chacha.h \
                   channels.h \
                   cmac.h \
                   config.h \
                   cpu.h \
                   crc.h \
                   cryptlib.h \
                   default.h \
                   des.h \
                   dh.h \
                   dh2.h \
                   dll.h \
                   dmac.h \
                   drbg.h \
                   dsa.h \
                   eax.h \
                   ec2n.h \
                   eccrypto.h \
                   ecp.h \
                   ecpoint.h \
                   elgamal.h \
                   emsa2.h \
                   eprecomp.h \
                   esign.h \
                   factory.h \
                   fhmqv.h \
                   files.h \
                   filters.h \
                   fips140.h \
                   fltrimpl.h \
                   gcm.h \
                   gf256.h \
                   gf2_32.h \
                   gf2n.h \
                   gfpcrypt.h \
                   gost.h \
                   gzip.h \
                   hashfwd.h \
                   hex.h \
                   hkdf.h \
                   hmac.h \
                   hmqv.h \
                   hrtimer.h \
                   ida.h \
                   idea.h \
                   integer.h \
                   iterhash.h \
                   kalyna.h \
                   keccak.h \
                   lubyrack.h \
                   luc.h \
                   mars.h \
                   md2.h \
                   md4.h \
                   md5.h \
                   mdc.h \
                   mersenne.h \
                   misc.h \
                   modarith.h \
                   modes.h \
                   modexppc.h \
                   mqueue.h \
                   mqv.h \
                   naclite.h \
                   nbtheory.h \
                   network.h \
                   nr.h \
                   oaep.h \
                   oids.h \
                   osrng.h \
                   ossig.h \
                   padlkrng.h \
                   panama.h \
                   pch.h \
                   pkcspad.h \
                   poly1305.h \
                   polynomi.h \
                   ppc-simd.h \
                   pssr.h \
                   pubkey.h \
                   pwdbased.h \
                   queue.h \
                   rabin.h \
                   randpool.h \
                   rc2.h \
                   rc5.h \
                   rc6.h \
                   rdrand.h \
                   resource.h \
                   rijndael.h \
                   ripemd.h \
                   rng.h \
                   rsa.h \
                   rw.h \
                   safer.h \
                   salsa.h \
                   scrypt.h \
                   seal.h \
                   secblock.h \
                   seckey.h \
                   seed.h \
                   serpent.h \
                   serpentp.h \
                   sha.h \
                   sha3.h \
                   shacal2.h \
                   shark.h \
                   simon.h \
                   simple.h \
                   siphash.h \
                   skipjack.h \
                   sm3.h \
                   sm4.h \
                   smartptr.h \
                   socketft.h \
                   sosemanuk.h \
                   speck.h \
                   square.h \
                   stdcpp.h \
                   strciphr.h \
                   tea.h \
                   threefish.h \
                   tiger.h \
                   trap.h \
                   trdlocal.h \
                   trunhash.h \
                   ttmac.h \
                   tweetnacl.h \
                   twofish.h \
                   vmac.h \
                   wait.h \
                   wake.h \
                   whrlpool.h \
                   winpipes.h \
                   words.h \
                   xtr.h \
                   xtrcrypt.h \
                   zdeflate.h \
                   zinflate.h \
                   zlib.h
        
        SOURCES += 3way.cpp \
                   adler32.cpp \
                   algebra.cpp \
                   algparam.cpp \
                   arc4.cpp \
                   aria-simd.cpp \
                   aria.cpp \
                   ariatab.cpp \
                   asn.cpp \
                   authenc.cpp \
                   base32.cpp \
                   base64.cpp \
                   basecode.cpp \
                   bfinit.cpp \
                   blake2-simd.cpp \
                   blake2.cpp \
                   blowfish.cpp \
                   blumshub.cpp \
                   camellia.cpp \
                   cast.cpp \
                   casts.cpp \
                   cbcmac.cpp \
                   ccm.cpp \
                   chacha.cpp \
                   channels.cpp \
                   cmac.cpp \
                   cpu.cpp \
                   crc-simd.cpp \
                   crc.cpp \
                   cryptlib.cpp \
                   default.cpp \
                   des.cpp \
                   dessp.cpp \
                   dh.cpp \
                   dh2.cpp \
                   dll.cpp \
                   dsa.cpp \
                   eax.cpp \
                   ec2n.cpp \
                   eccrypto.cpp \
                   ecp.cpp \
                   elgamal.cpp \
                   emsa2.cpp \
                   eprecomp.cpp \
                   esign.cpp \
                   files.cpp \
                   filters.cpp \
                   fips140.cpp \
                   gcm-simd.cpp \
                   gcm.cpp \
                   gf256.cpp \
                   gf2_32.cpp \
                   gf2n.cpp \
                   gfpcrypt.cpp \
                   gost.cpp \
                   gzip.cpp \
                   hex.cpp \
                   hmac.cpp \
                   hrtimer.cpp \
                   ida.cpp \
                   idea.cpp \
                   integer.cpp \
                   iterhash.cpp \
                   kalyna.cpp \
                   kalynatab.cpp \
                   keccak.cpp \
                   luc.cpp \
                   mars.cpp \
                   marss.cpp \
                   md2.cpp \
                   md4.cpp \
                   md5.cpp \
                   misc.cpp \
                   modes.cpp \
                   mqueue.cpp \
                   mqv.cpp \
                   nbtheory.cpp \
                   neon-simd.cpp \
                   network.cpp \
                   oaep.cpp \
                   osrng.cpp \
                   padlkrng.cpp \
                   panama.cpp \
                   pch.cpp \
                   pkcspad.cpp \
                   poly1305.cpp \
                   polynomi.cpp \
                   ppc-simd.cpp \
                   pssr.cpp \
                   pubkey.cpp \
                   queue.cpp \
                   rabin.cpp \
                   randpool.cpp \
                   rc2.cpp \
                   rc5.cpp \
                   rc6.cpp \
                   rdrand.cpp \
                   rdtables.cpp \
                   rijndael-simd.cpp \
                   rijndael.cpp \
                   ripemd.cpp \
                   rng.cpp \
                   rsa.cpp \
                   rw.cpp \
                   safer.cpp \
                   salsa.cpp \
                   scrypt.cpp \
                   seal.cpp \
                   seed.cpp \
                   serpent.cpp \
                   sha-simd.cpp \
                   sha.cpp \
                   sha3.cpp \
                   shacal2-simd.cpp \
                   shacal2.cpp \
                   shark.cpp \
                   sharkbox.cpp \
                   simon-simd.cpp \
                   simon.cpp \
                   simple.cpp \
                   skipjack.cpp \
                   sm3.cpp \
                   sm4.cpp \
                   socketft.cpp \
                   sosemanuk.cpp \
                   speck-simd.cpp \
                   speck.cpp \
                   square.cpp \
                   squaretb.cpp \
                   sse-simd.cpp \
                   strciphr.cpp \
                   tea.cpp \
                   tftables.cpp \
                   threefish.cpp \
                   tiger.cpp \
                   tigertab.cpp \
                   trdlocal.cpp \
                   ttmac.cpp \
                   tweetnacl.cpp \
                   twofish.cpp \
                   vmac.cpp \
                   wait.cpp \
                   wake.cpp \
                   whrlpool.cpp \
                   winpipes.cpp \
                   xtr.cpp \
                   xtrcrypt.cpp \
                   zdeflate.cpp \
                   zinflate.cpp \
                   zlib.cpp
        
        
        ml64.name = ML64 ${QMAKE_FILE_IN}
        ml64.input = ASM_FILES
        ml64.variable_out = OBJECTS
        ml64.commands = ML64 /c ${QMAKE_FILE_NAME} /Fo ${QMAKE_FILE_OUT}
        ml64.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_IN_BASE}$${first(QMAKE_EXT_OBJ)}
        ml64.CONFIG += target_predeps
        
        
        QMAKE_EXTRA_COMPILERS  += ml64
        
        
        ASM_FILES += \
              x64dll.asm \
              x64masm.asm
        
        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