Cisco Anyconnect Client API compile Problem



  • Hallo,

    Ich versuche grade das vpnapi Beispiel des Cisco Anyconnect Clients 2.5 zu kompilieren.
    Ich benutze dazu ein Debian Lenny (Linux) aber das wird wohl eher zweitrangiig sein, denke ich mal.

    das hier ist die Dateistruktur aus dem Archiv:

    vpnapi/
    vpnapi/examples/
    vpnapi/examples/cli/
    vpnapi/examples/cli/CLIClientImpl.cpp
    vpnapi/examples/cli/CLIClientImpl.h
    vpnapi/examples/cli/CLIClientMain.cpp
    vpnapi/examples/cli/linux_x86.mak
    vpnapi/include/
    vpnapi/include/api.h
    vpnapi/include/ClientIfc.h
    vpnapi/include/ClientIfcBase.h
    vpnapi/include/ConnectPromptInfo.h
    vpnapi/include/ConnectPromptInfoBase.h
    vpnapi/include/Preference.h
    vpnapi/include/PreferenceBase.h
    vpnapi/include/PreferenceInfo.h
    vpnapi/include/PreferenceInfoBase.h
    vpnapi/include/PreferenceUpdate.h
    vpnapi/include/PromptEntry.h
    vpnapi/include/PromptEntryBase.h
    vpnapi/include/ProtocolInfo.h
    vpnapi/include/RouteInfo.h
    vpnapi/include/VPNStats.h
    vpnapi/include/VPNStatsBase.h
    vpnapi/include/FirewallInfo.h
    vpnapi/include/GlobalEnums.h
    vpnapi/lib/
    vpnapi/lib/Linux/
    vpnapi/lib/Linux/Intel/
    vpnapi/lib/Linux/Intel/libcommon.a
    vpnapi/lib/Linux/Intel/libvpnapi.a
    vpnapi/lib/Linux/Intel/libcommoncrypt.a
    vpnapi/lib/Linux/Intel/libcurl.a
    vpnapi/lib/Linux/Intel/libssl.so.0.9.8
    vpnapi/lib/Linux/Intel/libcrypto.so.0.9.8
    

    ich habe die Datei linux_x86.mak in Makefile umbenannt.

    #*****************************************************************************
    #  This sample is supplied as is with no implied warranty.
    #  It is designed to assist you in using the Cisco AnyConnect VPN API.
    #  It is assumed that you will build a production application and
    #  refer to this sample as a reference only.
    #*****************************************************************************
    CXX = g++
    CXXFLAGS = -DHAVE_CONFIG_H -D_NOEXPORTDLL -g -O0 -Wfatal-errors ${INCLUDES}
    INCLUDES = -I. -I../../include -I/usr/include/libxml2
    VPNLIB_DIR = ../../lib/Linux/Intel
    LIBS = -lvpnapi -lxml2 -lz -lcommoncrypt -lcommon -lpthread ${VPNLIB_DIR}/libcurl.a  ${VPNLIB_DIR}/libcrypto.so.0.9.8 ${VPNLIB_DIR}/libssl.so.0.9.8
    LIBDIRS = -L${VPNLIB_DIR}
    LDFLAGS=-g
    
    all: client
    
    client: CLIClientMain.o CLIClientImpl.o
            @echo "compiling client"
            ${CXX} ${CXXFLAGS} ${LDFLAGS} ${INCLUDES} ${LIBDIRS} -o client CLIClientMain.o CLIClientImpl.o ${LIBS} -Wl,-rpath=$(CURDIR)/${VPNLIBDIR}
    
    clean:
            rm -f *.o client
    

    wenn ich dann ein make ausführe sagt der Compiler folgendes:

    # make
    g++ -DHAVE_CONFIG_H -D_NOEXPORTDLL -g -O0 -Wall -I. -I../../include -I/usr/include/libxml2   -c -o CLIClientMain.o CLIClientMain.cpp
    CLIClientMain.cpp: In function ‘int main(int, char**)’:
    CLIClientMain.cpp:43: error: ‘exit’ was not declared in this scope
    make: *** [CLIClientMain.o] Fehler 1
    

    hmmm - die 2.4 Version des Beispiels compilierte sauber in der Vergangenheit.

    ich habe ein #include <stdlib.h> in CLIClientMain.cpp eingefügt und versuche das compilieren nochmal...

    # make
    g++ -DHAVE_CONFIG_H -D_NOEXPORTDLL -g -O0 -Wall -I. -I../../include -I/usr/include/libxml2   -c -o CLIClientMain.o CLIClientMain.cpp
    g++ -DHAVE_CONFIG_H -D_NOEXPORTDLL -g -O0 -Wall -I. -I../../include -I/usr/include/libxml2   -c -o CLIClientImpl.o CLIClientImpl.cpp
    CLIClientImpl.cpp: In member function ‘std::wstring CLIClientImpl::convertMultiByteToWide(const std::string&)’:
    CLIClientImpl.cpp:356: error: ‘mbstowcs’ was not declared in this scope
    make: *** [CLIClientImpl.o] Fehler 1
    

    ich habe ein #include <stdlib.h> in CLIClientImpl.cpp eingefügt und versuche das compilieren nochmal...

    g++ -DHAVE_CONFIG_H -D_NOEXPORTDLL -g -O0 -Wfatal-errors -I. -I../../include -I/usr/include/libxml2   -c -o CLIClientMain.o CLIClientMain.cpp
    g++ -DHAVE_CONFIG_H -D_NOEXPORTDLL -g -O0 -Wfatal-errors -I. -I../../include -I/usr/include/libxml2   -c -o CLIClientImpl.o CLIClientImpl.cpp
    compiling client
    g++ -DHAVE_CONFIG_H -D_NOEXPORTDLL -g -O0 -Wfatal-errors -I. -I../../include -I/usr/include/libxml2 -g -I. -I../../include -I/usr/include/libxml2 -L../../lib/Linux/Intel
    ../../lib/Linux/Intel/libvpnapi.a(ConnectPromptInfo.o): In function `ConnectPromptInfo::ConnectPromptInfo(std::basic_string<char, std::char_traits<char>, std::allocator<c
    ConnectPromptInfo.cpp:(.text+0x6e): undefined reference to `std::__default_alloc_template<true, 0>::deallocate(void*, unsigned int)'
    ConnectPromptInfo.cpp:(.text+0xb6): undefined reference to `std::__default_alloc_template<true, 0>::deallocate(void*, unsigned int)'
    ../../lib/Linux/Intel/libvpnapi.a(ConnectPromptInfo.o): In function `ConnectPromptInfo::ConnectPromptInfo(std::basic_string<char, std::char_traits<char>, std::allocator<c
    ConnectPromptInfo.cpp:(.text+0x14e): undefined reference to `std::__default_alloc_template<true, 0>::deallocate(void*, unsigned int)'
    ConnectPromptInfo.cpp:(.text+0x196): undefined reference to `std::__default_alloc_template<true, 0>::deallocate(void*, unsigned int)'
    ../../lib/Linux/Intel/libvpnapi.a(ConnectPromptInfoBase.o): In function `ConnectPromptInfoBase::ConnectPromptInfoBase(std::basic_string<char, std::char_traits<char>, std:
    ConnectPromptInfoBase.cpp:(.text+0x13): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_empty_rep_storage'
    ConnectPromptInfoBase.cpp:(.text+0x25): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_empty_rep_storage'
    ConnectPromptInfoBase.cpp:(.text+0x2f): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_empty_rep_storage'
    ConnectPromptInfoBase.cpp:(.text+0x13c): undefined reference to `std::__default_alloc_template<true, 0>::deallocate(void*, unsigned int)'
    ConnectPromptInfoBase.cpp:(.text+0x154): undefined reference to `std::__default_alloc_template<true, 0>::deallocate(void*, unsigned int)'
    ConnectPromptInfoBase.cpp:(.text+0x182): undefined reference to `std::__default_alloc_template<true, 0>::deallocate(void*, unsigned int)'
    ConnectPromptInfoBase.cpp:(.text+0x1b2): undefined reference to `std::__default_alloc_template<true, 0>::deallocate(void*, unsigned int)'
    ConnectPromptInfoBase.cpp:(.text+0x1cf): undefined reference to `std::__default_alloc_template<true, 0>::deallocate(void*, unsigned int)'
    

    jetzt wirft mir der compiler ganz viele undefinierte Referenzen raus ...
    Kann mir da jemand einen Tipp geben?


  • Mod

    Das Makefile ist unvollständig oder falsch. Deine Ausgabe passt auch nicht zu dem Makefile. Das Problem ist, dass beim Befehl mit dem Fehler (welcher auch unvollständig ist), anscheinend die nötigen Bibliotheken nicht mitgelinkt werden.

    Der andere Fehler mit dem fehlenden stdlib.h ist ein echter Fehler in deinem Programm. Irgendein vorheriger Programmierer hat sich da fälschlicherweise auf eine indirekte Einbindung des Headers durch seinen Compiler verlassen.



  • Dieser Thread wurde von Moderator/in SeppJ aus dem Forum C++ (auch C++0x) in das Forum Compiler- und IDE-Forum verschoben.

    Im Zweifelsfall bitte auch folgende Hinweise beachten:
    C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?

    Dieses Posting wurde automatisch erzeugt.



  • Einfach mal ins blaue ratend..
    mal mit
    ./configure
    make
    make install
    probiert? 😃



  • Hallo SeppJ,

    Danke für Deine schnelle Antwort.
    Das Makefile ist komplett von mir gepostet - was ja nicht heisst dass es nicht unvollstaendig sein kann. Die einzige Modifikation, die ich gemacht habe ist beim Auftreten der vielen undef. references die Warnings mal auf -Wfatal-errors gestellt, was aber nicht wirklich Abhilfe gebracht hat gegen die Fehlerflut.
    Und ja ich habe die Ausgabe des Compilers ganz deutlich gekürzt dem letzten Codeabschnitt, da die Ausgabe trotz -Wfatal-errors ca. 650kb lang ist *g*

    Ich werde jetzt mal schauen welche libs da noch benötigt werden und werde sie mal dem Compiler bekanntgeben.

    Es verwundert mich halt, dass der alte Beispielclient von Cisco problemlos ohne weitere Modifikationen kompiliert hat (also auch alle includes vorhanden waren und auch das Makefile sauber war).

    @cooky451:
    es gibt leider keine configure script hier bei dem code. (wie man auch in der Darstellung des Paketinhaltes sehen kann.) Hilft also auch in diesem Fall nicht wirklich weiter. Hier bleibt wohl nur händisches einfügen der notwendigen Bezüge.



  • Oups stimmt die Antwort war natürlich Quark^^



  • ok - der Code lässt sich mit einem alten gcc compilieren.
    Da der aber nicht mehr im Debian Lenny Paketbaum enthalten ist habe ich mir den 'alten' gcc 3.3.6. als source besorgt und compiliert.

    Der 3.3.6 hat auch die (noch) passende Version der libstdc++ dabei, mit der dann der Cisco-Code fehlerfrei compiliert wird.


Anmelden zum Antworten