Archived

This forum has been archived. Please start a new discussion on GitHub.

getifaddrs() does not supported by glibc, IceE fails to make app in /IceE/test

Hi all,

Due to some unknown reason, ifaddrs.h is not ported to the glibc package in my embedded system. Thus, getifaddrs() and freeifaddrs() required in Network.cpp vector<string>IceInternal::getLocalHosts() function causes error during compilation. As a trial and error, I have replaced ifaddrs.h got from the development host linux /usr/include, into /$(EMBEDDED_LINUX)/usr/include directory. The compilation then compiled network.cpp without any problem. However later on during compilation of application in /IceE/test, mn10300-linux-g++ returns undefined reference to
`getifaddrs' and `freeifaddrs'.

Does any alternative exists to cope with glibc package that do not support ifaddrs.h and getifaddrs(), freeifaddrs()?

I searched through web and found that app like libpcap etc. does this kind of checking. Also, ACE has flag on ACE_HAS_GETIFADDRS to do sth, though I have not gone through this yet...

Comments

  • dwayne
    dwayne St. John's, Newfoundland
    Hi,

    If your linux system does not include the ifaddrs method, there is an alternate implementation in place that uses ioctl calls instead. We do not currently have a configuration variable you can set to select this alternative implementation though. Instead you will have to manually edit src/IceE/Network.cpp. Assuming you are using Ice-E 1.1.0 you should just have to removed "defined(__linux)" from the ifdef's at lines 17 (header includes) and 1037 (getLocalHosts method).

    Regards,
    Dwayne
  • Hi Dwayne,

    Thank you! Now, in Network.cpp getLocalHost(), #else part --> SOCKET fd = createSocket(false); <-- createSocket() is defined to take no parameter in the code above, and this function call passes in 'false'. I have tried to remove 'false' away. Compilation success.