SOLVED: Compilation on cygwin - Problems with missing symbols in vmime



  • Hi! Based on this post: https://forum.kopano.io/topic/2526/kopano-core-python-libraries-on-windows I am trying since a few days now to compile kopano-core on cygwin. Cygwin provides nearly all of the dependencies. I just had to compile and package libHX, gSOAP and, well, vmime.

    Vmime has been taken from the kopano git in Version 0.9.2. The kopano-core version to compile is 8.7.1.

    So far everything is ok, vmime is found by configure. But when it comes to linking libkcinetmapi.a, the Script bails out:

    CXX      inetmapi/ECMapiUtils.lo
    CXX      inetmapi/ECVMIMEUtils.lo
    CXX      inetmapi/MAPISMTPTransport.lo
    CXX      inetmapi/MAPIToVMIME.lo
    CXX      inetmapi/SMIMEMessage.lo
    CXX      inetmapi/VMIMEToMAPI.lo
    CXX      inetmapi/inetmapi.lo
    CXX      inetmapi/inputStreamMAPIAdapter.lo
    CXX      inetmapi/mapiAttachment.lo
    CXX      inetmapi/mapiTextPart.lo
    CXXLD    libkcinetmapi.la
    inetmapi/.libs/MAPISMTPTransport.o: In function `vmime::net::smtp::MAPISMTPTransport::helo()':
    /usr/src/debug/kopano-core/inetmapi/MAPISMTPTransport.cpp:223: undefined reference to `vmime::net::smtp::SMTPResponse::responseLine::getText() const'
    /usr/src/debug/kopano-core/inetmapi/MAPISMTPTransport.cpp:223:(.text+0x3302): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `vmime::net::smtp::SMTPResponse::responseLine::getText() const'
    /usr/src/debug/kopano-core/inetmapi/MAPISMTPTransport.cpp:208: undefined reference to `vmime::net::smtp::SMTPResponse::responseLine::getText() const'
    /usr/src/debug/kopano-core/inetmapi/MAPISMTPTransport.cpp:208:(.text+0x3e62): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `vmime::net::smtp::SMTPResponse::responseLine::getText() const'
    collect2: error: ld returned 1 exit status
    

    Acloser look shows: make V=1

    /bin/sh ./libtool  --tag=CXX   --mode=link g++ -Wall -Wmissing-declarations -std=gnu++17 -Wno-variadic-macros -O2 -fno-strict-aliasing -fvisibility=hidden -fvisibility-inlines-hidden -W
    no-sign-compare -ggdb -O2 -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 --param=ssp-buffer-size=4 -fdebug-prefix-map=/home/eger/kopano/kopano-core.x86_64/build=/usr/src/debug/kopano-core -fdebug-prefix-map=/home/eger/kopan
    o/kopano-core.x86_64/src/kopanocore=/usr/src/debug/kopano-core  -version-info 0:0:0 -Wl,--version-script=./default.sym -no-undefined  -o libkcinetmapi.la -rpath /usr/lib inetmapi/ECMapiUtils.lo inetmapi/ECVMIMEUtils.lo inetmapi/MAPISMTP
    Transport.lo inetmapi/MAPIToVMIME.lo inetmapi/SMIMEMessage.lo inetmapi/VMIMEToMAPI.lo inetmapi/inetmapi.lo inetmapi/inputStreamMAPIAdapter.lo inetmapi/mapiAttachment.lo inetmapi/mapiTextPart.lo inetmapi/tnef.lo libmapi.la libkcutil.la l
    ibkcicalmapi.la  -liconv -L/usr/lib64 -lvmime  -lxml2
    libtool: link: rm -fr  .libs/libkcinetmapi.dll.a
    libtool: link: g++ -shared -nostdlib /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/crtbeginS.o  inetmapi/.libs/ECMapiUtils.o inetmapi/.libs/ECVMIMEUtils.o inetmapi/.libs/MAPISMTPTransport.o inetmapi/.libs/MAPIToVMIME.o inetmapi/.libs/SMIMEMessage.o inetmapi/.libs/VMIMEToMAPI.o inetmapi/.libs/inetmapi.o inetmapi/.libs/inputStreamMAPIAdapter.o inetmapi/.libs/mapiAttachment.o inetmapi/.libs/mapiTextPart.o inetmapi/.libs/tnef.o   -L/home/eger/kopano/kopano-core.x86_64/build/.libs ./.libs/libmapi.dll.a ./.libs/libkcutil.dll.a ./.libs/libkcicalmapi.dll.a /home/eger/kopano/kopano-core.x86_64/build/.libs/libkcfreebusy.dll.a /home/eger/kopano/kopano-core.x86_64/build/.libs/libmapi.dll.a /home/eger/kopano/kopano-core.x86_64/build/.libs/libkcutil.dll.a -lpthread -lcrypto -lcurl -lz -licui18n -licuuc -licudata -ljsoncpp -lHX -lssl -luuid -lintl -lical -licalss -licalvcal -liconv -L/usr/lib64 -lvmime -lxml2 -L/bin/../lib -L/usr/lib/gcc/x86_64-pc-cygwin/7.4.0 -L/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/../../../../x86_64-pc-cygwin/lib/../lib -L/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/bin -L/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/../../../../x86_64-pc-cygwin/lib -L/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/../../.. -lstdc++ -lgcc_s -lgcc -lcygwin -ladvapi32 -lshell32 -luser32 -lkernel32 -lgcc_s -lgcc /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/crtend.o  -O2 -ggdb -O2 -Wl,--version-script=./default.sym   -o .libs/cygkcinetmapi-0.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libkcinetmapi.dll.a
    inetmapi/.libs/MAPISMTPTransport.o: In function `vmime::net::smtp::MAPISMTPTransport::helo()':
    /usr/src/debug/kopano-core/inetmapi/MAPISMTPTransport.cpp:223: undefined reference to `vmime::net::smtp::SMTPResponse::responseLine::getText() const'
    /usr/src/debug/kopano-core/inetmapi/MAPISMTPTransport.cpp:223:(.text+0x3302): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `vmime::net::smtp::SMTPResponse::responseLine::getText() const'
    /usr/src/debug/kopano-core/inetmapi/MAPISMTPTransport.cpp:208: undefined reference to `vmime::net::smtp::SMTPResponse::responseLine::getText() const'
    /usr/src/debug/kopano-core/inetmapi/MAPISMTPTransport.cpp:208:(.text+0x3e62): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `vmime::net::smtp::SMTPResponse::responseLine::getText() const'
    

    It should be noted that Makefile.am notes the following for libkcinetmapi:

    # Add '-z now' -> -Wl,-z, -Wl,now to LD flags so that we do early binding of
    # symbols. This fixes a problem in which libvmime attempts to resolve a symbol
    # in libinetmapi.so during the unload of vmime, initiated by the unload of
    # libinetmapi. On some systems, this fails to resolve the symbol during unload,
    # resulting in a crash in __cxa_finalize during unload of mapi.so
    libkcinetmapi_la_LIBADD = \
            libmapi.la libkcutil.la libkcicalmapi.la \
            ${COND_libkcrosie_la} ${ICONV_LIBS} ${VMIME_LIBS} ${XML2_LIBS}
    libkcinetmapi_la_LDFLAGS = ${AM_LDFLAGS} \
            -version-info 0:0:0 ${default_SYFLAGS${NO_VSYM}} -no-undefined
    EXTRA_libkcinetmapi_la_DEPENDENCIES = ${default_sym}
    

    As you can see, I have modified this passage (took away Wl,-z Wl,now; not supported by Cygwin; added --no-undefined for static linking). This might be the culprit, however, this worked with all the foregoing libraries very well.

    When looking at the missing symbol: vmime::net::smtp::SMTPResponse::responseLine:getText() I tried to find it in /usr/lib64/libvmime.dll.a, but it is not there:

    objdump -x /usr/lib64/libvmime.dll.a | grep SMTPResponse
    [  5](sec  3)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 __imp__ZTVN5vmime3net4smtp12SMTPResponseE
    [  6](sec  5)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 __nm__ZTVN5vmime3net4smtp12SMTPResponseE
    [  5](sec  3)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 __imp__ZTIN5vmime3net4smtp12SMTPResponseE
    [  6](sec  5)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 __nm__ZTIN5vmime3net4smtp12SMTPResponseE
    [  5](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 _ZNK5vmime3net4smtp12SMTPResponse9getLineAtEm
    [  6](sec  3)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 __imp__ZNK5vmime3net4smtp12SMTPResponse9getLineAtEm
    [  5](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 _ZNK5vmime3net4smtp12SMTPResponse7getTextEv
    [  6](sec  3)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 __imp__ZNK5vmime3net4smtp12SMTPResponse7getTextEv
    [  5](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 _ZNK5vmime3net4smtp12SMTPResponse7getCodeEv
    [  6](sec  3)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 __imp__ZNK5vmime3net4smtp12SMTPResponse7getCodeEv
    [  5](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 _ZNK5vmime3net4smtp12SMTPResponse15getEnhancedCodeEv
    [  6](sec  3)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 __imp__ZNK5vmime3net4smtp12SMTPResponse15getEnhancedCodeEv
    [  5](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 _ZNK5vmime3net4smtp12SMTPResponse15getCurrentStateEv
    [  6](sec  3)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 __imp__ZNK5vmime3net4smtp12SMTPResponse15getCurrentStateEv
    [  5](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 _ZNK5vmime3net4smtp12SMTPResponse12getLineCountEv
    [  6](sec  3)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 __imp__ZNK5vmime3net4smtp12SMTPResponse12getLineCountEv
    [  5](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 _ZNK5vmime3net4smtp12SMTPResponse11getLastLineEv
    [  6](sec  3)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 __imp__ZNK5vmime3net4smtp12SMTPResponse11getLastLineEv
    [  5](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 _ZN5vmime3net4smtplsERSoRKNS1_12SMTPResponse18enhancedStatusCodeE
    [  6](sec  3)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 __imp__ZN5vmime3net4smtplsERSoRKNS1_12SMTPResponse18enhancedStatusCodeE
    [  5](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 _ZN5vmime3net4smtp16SMTPCommandErrorC2ERKSsS4_iRKNS1_12SMTPResponse18enhancedStatusCodeERKNS_9exceptionE
    [  6](sec  3)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 __imp__ZN5vmime3net4smtp16SMTPCommandErrorC2ERKSsS4_iRKNS1_12SMTPResponse18enhancedStatusCodeERKNS_9exceptionE
    [  5](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 _ZN5vmime3net4smtp16SMTPCommandErrorC2ERKSsS4_S4_iRKNS1_12SMTPResponse18enhancedStatusCodeERKNS_9exceptionE
    [  6](sec  3)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 __imp__ZN5vmime3net4smtp16SMTPCommandErrorC2ERKSsS4_S4_iRKNS1_12SMTPResponse18enhancedStatusCodeERKNS_9exceptionE
    [  5](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 _ZN5vmime3net4smtp16SMTPCommandErrorC1ERKSsS4_iRKNS1_12SMTPResponse18enhancedStatusCodeERKNS_9exceptionE
    [  6](sec  3)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 __imp__ZN5vmime3net4smtp16SMTPCommandErrorC1ERKSsS4_iRKNS1_12SMTPResponse18enhancedStatusCodeERKNS_9exceptionE
    [  5](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 _ZN5vmime3net4smtp16SMTPCommandErrorC1ERKSsS4_S4_iRKNS1_12SMTPResponse18enhancedStatusCodeERKNS_9exceptionE
    [  6](sec  3)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 __imp__ZN5vmime3net4smtp16SMTPCommandErrorC1ERKSsS4_S4_iRKNS1_12SMTPResponse18enhancedStatusCodeERKNS_9exceptionE
    [  5](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 _ZN5vmime3net4smtp12SMTPResponseC2ESt10shared_ptrINS0_6tracerEES3_INS0_6socketEES3_INS0_14timeoutHandlerEERKNS2_5stateE
    [  6](sec  3)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 __imp__ZN5vmime3net4smtp12SMTPResponseC2ESt10shared_ptrINS0_6tracerEES3_INS0_6socketEES3_INS0_14timeoutHandlerEERKNS2_5stateE
    [  5](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 _ZN5vmime3net4smtp12SMTPResponseC2ERKS2_
    [  6](sec  3)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 __imp__ZN5vmime3net4smtp12SMTPResponseC2ERKS2_
    [  5](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 _ZN5vmime3net4smtp12SMTPResponseC1ESt10shared_ptrINS0_6tracerEES3_INS0_6socketEES3_INS0_14timeoutHandlerEERKNS2_5stateE
    [  6](sec  3)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 __imp__ZN5vmime3net4smtp12SMTPResponseC1ESt10shared_ptrINS0_6tracerEES3_INS0_6socketEES3_INS0_14timeoutHandlerEERKNS2_5stateE
    [  5](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 _ZN5vmime3net4smtp12SMTPResponseC1ERKS2_
    [  6](sec  3)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 __imp__ZN5vmime3net4smtp12SMTPResponseC1ERKS2_
    [  5](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 _ZN5vmime3net4smtp12SMTPResponse19extractResponseCodeERKSs
    [  6](sec  3)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 __imp__ZN5vmime3net4smtp12SMTPResponse19extractResponseCodeERKSs
    [  5](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 _ZN5vmime3net4smtp12SMTPResponse19extractEnhancedCodeERKSs
    [  6](sec  3)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 __imp__ZN5vmime3net4smtp12SMTPResponse19extractEnhancedCodeERKSs
    [  5](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 _ZN5vmime3net4smtp12SMTPResponse16readResponseLineEv
    [  6](sec  3)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 __imp__ZN5vmime3net4smtp12SMTPResponse16readResponseLineEv
    [  5](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 _ZN5vmime3net4smtp12SMTPResponse15getNextResponseEv
    [  6](sec  3)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 __imp__ZN5vmime3net4smtp12SMTPResponse15getNextResponseEv
    [  5](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 _ZN5vmime3net4smtp12SMTPResponse12readResponseEv
    [  6](sec  3)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 __imp__ZN5vmime3net4smtp12SMTPResponse12readResponseEv
    [  5](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 _ZN5vmime3net4smtp12SMTPResponse12readResponseESt10shared_ptrINS0_6tracerEES3_INS0_6socketEES3_INS0_14timeoutHandlerEERKNS2_5stateE
    [  6](sec  3)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x0000000000000000 __imp__ZN5vmime3net4smtp12SMTPResponse12readResponseESt10shared_ptrINS0_6tracerEES3_INS0_6socketEES3_INS0_14timeoutHandlerEERKNS2_5stateE
    

    In the static library it is there:

    objdump -x /usr/lib64/libvmime.a | grep responseLine | grep getText
    [551](sec  0)(fl 0x00)(ty  20)(scl   2) (nx 0) 0x0000000000000000 _ZNK5vmime3net4smtp12SMTPResponse12responseLine7getTextEv
    0000000000003cb0 R_X86_64_PC32     _ZNK5vmime3net4smtp12SMTPResponse12responseLine7getTextEv
    0000000000004b3b R_X86_64_PC32     _ZNK5vmime3net4smtp12SMTPResponse12responseLine7getTextEv
    [ 65](sec  1)(fl 0x00)(ty  20)(scl   2) (nx 0) 0x0000000000000f70 _ZNK5vmime3net4smtp12SMTPResponse12responseLine7getTextEv
    

    However, linking to the static library does not lead to success.

    Can anybody help me why this symbol is missing from the dll library?



  • A little patch can help:

    --- src/vmime/net/smtp/SMTPResponse.hpp 2019-06-28 08:43:39.835498700 +0200
    +++ src/vmime/net/smtp/SMTPResponse.hpp 2019-06-28 08:43:52.770477200 +0200
    @@ -71,7 +71,7 @@
            };
    
            /** An element of a SMTP response. */
    -       class responseLine
    +       class VMIME_EXPORT responseLine
            {
            public:
    
    



Log in to reply