Community Forum
ANVEL Licensing Options

Apache Thrift Install for C++ to create executables



  • I've run through the install instructions on Linux a few times but whenever I try to compile the HelloAPI it fails with the error below. I have not been able to find a specific solution for this on the the Thrift forums. Has the ANVEL team run into this issue? Or know what step in the install I missed or need to complete?

    HelloAPI.cpp:5:34: fatal error: thrift/cxxfunctional.h: No such file or directory
    #include <thrift/cxxfunctional.h>
    ^
    compilation terminated.
    In file included from AnvelControlService.h:12:0,
    from AnvelControlService.cpp:7:
    AnvelIf_types.h:17:34: fatal error: thrift/cxxfunctional.h: No such file or directory
    #include <thrift/cxxfunctional.h>
    ^
    compilation terminated.
    In file included from AnvelIf_types.cpp:7:0:
    AnvelIf_types.h:17:34: fatal error: thrift/cxxfunctional.h: No such file or directory
    #include <thrift/cxxfunctional.h>
    ^
    compilation terminated.
    In file included from ApiExtras.cpp:1:0:
    AnvelIf_types.h:17:34: fatal error: thrift/cxxfunctional.h: No such file or directory
    #include <thrift/cxxfunctional.h>
    ^



  • The issue with cxxfunctional.h was due to the newer thrift versions not having cxxfunctional.h. However, whenever I compile using the recommended commands on the External API page it does not create a Windows compatible .exe. I've tried using several 32bit and 64bit mingw commands(which have worked on simple programs) ,but every time I use it it creates what seems to be path issues for thrift header files even though they exist on my machine. Is there a recommended command for creating a Windows ready executable? Or is there a certain way I need to run it on Windows?



  • @CollinDavenport said in Apache Thrift Install for C++ to create executables:

    The issue with cxxfunctional.h was due to the newer thrift versions not having cxxfunctional.h. However, whenever I compile using the recommended commands on the External API page it does not create a Windows compatible .exe. I've tried using several 32bit and 64bit mingw commands(which have worked on simple programs) ,but every time I use it it creates what seems to be path issues for thrift header files even though they exist on my machine. Is there a recommended command for creating a Windows ready executable? Or is there a certain way I need to run it on Windows?

    @CollinDavenport,

    We'll take a look into this issue. Just to confirm - you're using thrift 0.10?

    Thanks,
    ANVEL Support



  • Yes I am using 0.10 now.



  • @CollinDavenport said in Apache Thrift Install for C++ to create executables:

    Yes I am using 0.10 now.

    @CollinDavenport,

    Our developers haven't run into this issue while working with C++. Can you send us the exact error messages that you're receiving when trying to compile? Have you double checked that you have the API directory included in your compiler's path? For example (on Windows): "C:\Program Files\Quantum Signal, LLC\ANVEL 2.5 Academic\API\cpp\src"

    Regards,
    ANVEL Support



  • I can compile if I use the command without "i686-w64-mingw32-" (or its equivalents) as long as I use g++ instead of gcc, but it does not create an executable that is usable in Windows. When I try to compile it to the correct bit format it gives the error below. I am compiling in the API\cpp\src directory.

    /THRIFT/Anvel/API/cpp/src$ i686-w64-mingw32-gcc HelloAPI.cpp AnvelControlService.cpp AnvelIf_types.cpp ApiExtras.cpp -o HelloAPI.exe -lthrift
    In file included from HelloAPI.cpp:2:0:
    Thrift.h:23:45: fatal error: thrift/transport/PlatformSocket.h: No such file or directory
    #include <thrift/transport/PlatformSocket.h>
    ^
    compilation terminated.
    In file included from AnvelControlService.cpp:7:0:
    AnvelControlService.h:10:39: fatal error: thrift/TDispatchProcessor.h: No such file or directory
    #include <thrift/TDispatchProcessor.h>
    ^
    compilation terminated.
    In file included from AnvelIf_types.cpp:7:0:
    AnvelIf_types.h:12:27: fatal error: thrift/Thrift.h: No such file or directory
    #include <thrift/Thrift.h>
    ^
    compilation terminated.
    In file included from ApiExtras.cpp:1:0:
    AnvelIf_types.h:12:27: fatal error: thrift/Thrift.h: No such file or directory
    #include <thrift/Thrift.h>
    ^
    compilation terminated.



  • @CollinDavenport said in Apache Thrift Install for C++ to create executables:

    I can compile if I use the command without "i686-w64-mingw32-" (or its equivalents) as long as I use g++ instead of gcc, but it does not create an executable that is usable in Windows. When I try to compile it to the correct bit format it gives the error below. I am compiling in the API\cpp\src directory.

    /THRIFT/Anvel/API/cpp/src$ i686-w64-mingw32-gcc HelloAPI.cpp AnvelControlService.cpp AnvelIf_types.cpp ApiExtras.cpp -o HelloAPI.exe -lthrift
    In file included from HelloAPI.cpp:2:0:
    Thrift.h:23:45: fatal error: thrift/transport/PlatformSocket.h: No such file or directory
    #include <thrift/transport/PlatformSocket.h>
    ^
    compilation terminated.
    In file included from AnvelControlService.cpp:7:0:
    AnvelControlService.h:10:39: fatal error: thrift/TDispatchProcessor.h: No such file or directory
    #include <thrift/TDispatchProcessor.h>
    ^
    compilation terminated.
    In file included from AnvelIf_types.cpp:7:0:
    AnvelIf_types.h:12:27: fatal error: thrift/Thrift.h: No such file or directory
    #include <thrift/Thrift.h>
    ^
    compilation terminated.
    In file included from ApiExtras.cpp:1:0:
    AnvelIf_types.h:12:27: fatal error: thrift/Thrift.h: No such file or directory
    #include <thrift/Thrift.h>
    ^
    compilation terminated.

    @CollinDavenport,

    Our developers have been looking into this issue further, and are experiencing some of the hardships that you're talking about getting this compiling on Windows. Part of the solution will be improving our documentation, which will have to wait for the 3.0 release in May. However, in the meantime, we'd recommend trying to compile your code in Visual Studio 2015 (a free community edition is offered), which should work.

    Regards,
    ANVEL Support



  • @CollinDavenport,

    Although we still recommend using Visual Studio, you may also have some success if you include the path to the thrift headers when trying to build your executable, like this:

    gcc HelloAPI.cpp AnvelControlService.cpp AnvelIf_types.cpp ApiExtras.cpp -o HelloAPI -lthrift -I/path/to/thrift/headers

    (that's capital i)

    Regards,
    ANVEL Support



  • Were your developers able to compile once you added the path? It did not work for me, if they did how deep did the ~path/to/thrift~ go?

    Also I've had trouble building Apache Thrift from source for Visual Studio. Terminal based Linux has a much easier set up process with better documentation.



  • For all those who are interested we were able to find an alternative to thrift in creating executables. This is a relatively new development for python to convert a .py to a .exe. It has worked on creating scripted simulations as executables relatively painless. I have included the links to the pages below.

    http://nitratine.pythonanywhere.com/projects/auto-py-to-exe
    https://github.com/brentvollebregt/auto-py-to-exe



  • @CollinDavenport Thanks for sharing. I'm currently having similar issues compiling the test code in Linux - cxxfunctional.h not found.



  • @ANVEL-Team Has anyone found a solution to the fatal error: thrift/cxxfunctional.h: No such file or directory ?

    The solution proposed here, adding the additional compile option -I/path/to/thrift/headers, did not work for me.



  • @samxchandler I resolved this by removing line 18: #include <thrift/cxxfunction.h> in AnvelIf_types.h

    @ANVEL-Team What are the implications of this removal? I'm able to compile/link the HelloAPI.cpp tutorial without any issues.



  • @samxchandler,

    We're taking a look at this issue, and the bigger picture of improving our documentation in this area.

    Regards,
    ANVEL Support