1

I have a C++ program that I compile on a variety of Linux architectures and platforms. Strangely, once compiled the binary is approx 5MB on Ubuntu (32 bit and 64 bit), while its 20MB on Red Hat (32 bit and 64 bit).

This is a C++ Qt5 program in case that matters. Can someone explain why the large size discrepancy? Does Ubuntu ship with Qt libraries that perhaps have to be compiled in with Red Hat?

TSG
  • 4,242
  • 9
  • 61
  • 121

1 Answers1

2

Sounds to me like on Red Hat you're probably linking QT statically and on Ubuntu you're linking dynamically. It's not unbelievable that the library type(s) available on a specific platform would differ.

Mark B
  • 95,107
  • 10
  • 109
  • 188
  • I use the exact same .pro file so I think they should be built the same. Does qmake detect the Linux distro and decide that Qt libraries are included by default in Ubuntu? – TSG Apr 08 '15 at 12:50
  • @GenerationDSystems No, it depends on what type of library file (a dynamic `.so` or a static `.a`) is found and/or preferred when linking. – unwind Apr 08 '15 at 13:53
  • I'm still new at this so forgive me if this is stupid, but...if I'm using the same .pro file should the make file use the same .so or .a option when linking? Or does qmake make a decision based on the distribution? – TSG Apr 08 '15 at 18:34