0

I have a code:

struct hostent *hp = gethostbyname(dns.c_str());

in my app. I compile it on Ubuntu server linking all statically. All ok, but when i try to start this app on CentOS i have a error in this gethostbyname calling:

Floating point exception

Can you help me how to fix that? Thanks!

Breakdown
  • 1,035
  • 4
  • 16
  • 26
  • 1
    Have you tried recompiling it on CentOS? Usually you don't pass Linux-applications as binary... – bash.d Feb 19 '13 at 12:17
  • @bash.d, i can recompile it, this is my client machine – Breakdown Feb 19 '13 at 12:19
  • So I assume that there are differences in the header files, so you might not be able to distribute your program as a binary... – bash.d Feb 19 '13 at 12:22
  • Whenever I try statically linking the libc, I get a warning that certain functions (among which is gethostbyname) still require the .so files of exactly the same version of the glibc that they were statically linked against.... – PlasmaHH Feb 19 '13 at 12:26
  • Apart from this, it seems that **gethostbyname**-function has been declared [deprecated](http://beej.us/guide/bgnet/output/html/multipage/gethostbynameman.html)! So you should not be using it – bash.d Feb 19 '13 at 12:45

1 Answers1

1

static linking considered harmful http://www.akkadia.org/drepper/no_static_linking.html

"all kinds of features in the libc (locale (through iconv), NSS, IDN, ...) require dynamic linking to load the appropriate external code."

pal
  • 618
  • 4
  • 9