Home Help Center

ICE3.3.1:Cond.cpp:311: error: `CLOCK_MONOTONIC'

zeronumberzeronumber Member jack zhangOrganization: DawningProject: Beijing police station
Hi,guys!

I am trying to intall ICE3.3.1 on Turbo8 32bit。
I had built all the third party libraries required by Ice 3.3.1 without any problems, and I alst updated GCC to 3.4.6。
When i build the ICE, I got some errors。

[PHP]c++ -c -I../../include -DICE_UTIL_API_EXPORTS -I.. -ftemplate-depth-128 -Wall -D_REENTRANT -I/usr/include/nptl -fPIC -g Cond.cpp
Cond.cpp: In constructor `IceUtil::Cond::Cond()':
Cond.cpp:311: error: `CLOCK_MONOTONIC' was not declared in this scope
Cond.cpp:311: error: `pthread_condattr_setclock' was not declared in this scope
Cond.cpp:311: warning: unused variable 'CLOCK_MONOTONIC'
Cond.cpp:311: warning: unused variable 'pthread_condattr_setclock'
make[2]: *** [Cond.o] Error 1[/PHP]


I found this thread which got the same problem. He did some fixes in the source code and solved the problem, but I donot know how to fix it particularly.

What can I do if I want to use the new version ICE on turbo8.

Thanks!

Comments

  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    Check the source code in Ice-3.3.1/cpp/src/IceUtil/Cond.cpp line 310. If your Linux distribution doesn't support monotonic clocks, you can change the #ifdef to not use them on your platform. An alternative would be to check if there's a nptl-devel package with your distribution and install it, it might provide support for monotonic clocks.

    Cheers,
    Benoit.
  • zeronumberzeronumber Member jack zhangOrganization: DawningProject: Beijing police station
    Thanks for the advice.
    I just deleted the few lines in the file Cond.cpp and Time.cpp。
    It goes on, but I got the new problem:

    [PHP]In file included from ../Ice/ThreadPool.h:24,
    from ConnectRequestHandler.cpp:20:
    ../Ice/Selector.h:32:26: sys/epoll.h: No such file or directory
    In file included from ../Ice/ThreadPool.h:24,
    from ConnectRequestHandler.cpp:20:
    ../Ice/Selector.h: In constructor `IceInternal::Selector<T>::Selector(const IceInternal::InstancePtr&, int)':
    ../Ice/Selector.h:61: error: there are no arguments to `epoll_create' that depend on a template parameter, so a declaration of `epoll_create' must be available
    ../Ice/Selector.h:61: error: (if you use `-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
    ../Ice/Selector.h:70: error: `EPOLLIN' was not declared in this scope
    ../Ice/Selector.h:72: error: `EPOLL_CTL_ADD' was not declared in this scope
    ../Ice/Selector.h: In member function `void IceInternal::Selector<T>::add(T*, IceInternal::SocketStatus, bool)':
    ../Ice/Selector.h:151: error: `EPOLLIN' was not declared in this scope
    ../Ice/Selector.h:151: error: `EPOLLOUT' was not declared in this scope
    ../Ice/Selector.h:153: error: `EPOLL_CTL_ADD' was not declared in this scope
    ../Ice/Selector.h: In member function `void IceInternal::Selector<T>::update(T*, IceInternal::SocketStatus, IceInternal::SocketStatus)':
    ../Ice/Selector.h:193: error: `EPOLLIN' was not declared in this scope
    ../Ice/Selector.h:193: error: `EPOLLOUT' was not declared in this scope
    ../Ice/Selector.h:195: error: `EPOLL_CTL_MOD' was not declared in this scope
    ../Ice/Selector.h: In member function `void IceInternal::Selector<T>::remove(T*, IceInternal::SocketStatus, bool)':
    ../Ice/Selector.h:214: error: `EPOLL_CTL_DEL' was not declared in this scope
    make[2]: *** [ConnectRequestHandler.o] Error 1
    make[2]: Leaving directory `/tmp/test/Ice-3.3.1/cpp/src/Ice'
    make[1]: *** [all] Error 1
    make[1]: Leaving directory `/tmp/test/Ice-3.3.1/cpp/src'
    make: *** [all] Error 1[/PHP]

    I donot know what is funtion of the epoll.h, and there is not this file in my system.

    How to fix it?
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    You can try compiling Ice with "make CPPFLAGS=-DICE_NO_EPOLL=1", but the best would be to use a supported Linux distribution or recent one as we don't support such old distributions and we won't be able to help if you have any issues.

    See here for a list of supported Linux distributions.

    If you have to use this distribution and need commercial support for it, please contact us at [email protected].

    Cheers,
    Benoit.
  • zeronumberzeronumber Member jack zhangOrganization: DawningProject: Beijing police station
    Thanks,Benoit!

    I had used the DICE_NO_EPOLL option, and it goes on.
    I have got some new erros.

    [PHP]Network.cpp:44:23: ifaddrs.h: No such file or directory
    Network.cpp: In function `std::vector<sockaddr_storage, std::allocator<sockaddr_storage> > <unnamed>::getLocalAddresses(IceInternal::ProtocolSupport)':
    Network.cpp:142: error: `::getifaddrs' has not been declared
    Network.cpp:152: error: invalid use of undefined type `struct <unnamed>::ifaddrs'
    Network.cpp:141: error: forward declaration of `struct <unnamed>::ifaddrs'
    Network.cpp:152: error: invalid use of undefined type `struct <unnamed>::ifaddrs'
    Network.cpp:141: error: forward declaration of `struct <unnamed>::ifaddrs'
    Network.cpp:154: error: invalid use of undefined type `struct <unnamed>::ifaddrs'
    Network.cpp:141: error: forward declaration of `struct <unnamed>::ifaddrs'
    Network.cpp:157: error: invalid use of undefined type `struct <unnamed>::ifaddrs'
    Network.cpp:141: error: forward declaration of `struct <unnamed>::ifaddrs'
    Network.cpp:163: error: invalid use of undefined type `struct <unnamed>::ifaddrs'
    Network.cpp:141: error: forward declaration of `struct <unnamed>::ifaddrs'
    Network.cpp:166: error: invalid use of undefined type `struct <unnamed>::ifaddrs'
    Network.cpp:141: error: forward declaration of `struct <unnamed>::ifaddrs'
    Network.cpp:169: error: invalid use of undefined type `struct <unnamed>::ifaddrs'
    Network.cpp:141: error: forward declaration of `struct <unnamed>::ifaddrs'
    Network.cpp:174: error: invalid use of undefined type `struct <unnamed>::ifaddrs'
    Network.cpp:141: error: forward declaration of `struct <unnamed>::ifaddrs'
    Network.cpp:177: error: `::freeifaddrs' has not been declared
    make[2]: *** [Network.o] Error 1
    make[2]: Leaving directory `/tmp/test/Ice-3.3.1/cpp/src/Ice'
    make[1]: *** [all] Error 1
    make[1]: Leaving directory `/tmp/test/Ice-3.3.1/cpp/src'
    make: *** [all] Error 1[/PHP]

    I just found some advices from this thread and this one

    They also told us that there is an alternate implementation for this question, either ioctl or SIOCGIFCONF.But i donot know how to do for the ICE-3.3.1.

    Could you give me some ideas?
  • zeronumberzeronumber Member jack zhangOrganization: DawningProject: Beijing police station
    Update.

    I had made a few fixes in the source code and it complied well.


    one fix in the Network.cpp:
    [PHP]
    43 #if defined(__linux) || defined(__APPLE__) || defined(__FreeBSD__)
    44 /*# include <ifaddrs.h>*/
    45 # include <sys/ioctl.h>
    46 # include <net/if.h>
    47 #elif defined(__sun)
    48 # include <sys/sockio.h>
    49 #endif[/PHP]

    another one:

    [PHP]142 //#elif defined(__linux) || defined(__APPLE__) || defined(__FreeBSD__)
    143 #elif defined(__APPLE__) || defined(__FreeBSD__)[/PHP]

    then , i compiled it and get a new error:

    demo/Freeze/customEvictor/CurrentDatabase.cpp:thread-local storage not supported for this target

    I had fixed it by this way:
    in the file demo/Freeze/customEvictor/CurrentDatabase.cpp

    [PHP] 29 //#if defined(__HP_aCC) || defined(__APPLE__)
    30 #define USE_PTHREAD_KEY 1
    31 //#endif[/PHP]

    Then the ICE was compiled sucessfully.

    I try to run one demo ,but there is another error.
    Network.cpp:: Ice::DNSException:
    DNS error: Servname not supported for ai_socktype

    I fix it according to this thread.

    Now , the demo can run without errors.

    But i donot know whether the fixes i have done will bring some unpredictable consequence .
Sign In or Register to comment.