Search code examples
c++qtubuntudebug-buildqt5.15

After running a project in Qt Debug build, the binary (exe) disappears and object files are shrunk. How to fix that?


My Qt Creator is 4.11 which is based on Qt 5.14 in Ubuntu 17.04. Due to ongoing development, I have not updated Qt Creator and Ubuntu to avoid disturbing the working setup.

Whenever I run it in Debug build mode, it compiles fine and runs the executable. But then if I check the "build--*" directory, the binary file (viz. .exe) disappears and all the .o file created from .cpp files shrink to 18 bytes from few MBs!!

Have searched online, but couldn't find such unique problem. Currently the workaround is to clean-build every time, with painful long wait.

Kindly suggest which configuration will fix this issue?

Update:

With some help from the comment section, another distinguishing detail has surfaced. When I visit the build-* folder for a good project & this project and check file main.o in terminal then following output comes

good project: _main.o: ELF 64-bit LSB relocatable, x86-64, version 1 (GNU/Linux), not stripped

bad (this) project:_main.o: gzip compressed data, from NTFS filesystem (NT)


Solution

  • This issue is not related to Qt, but related to our own code. We have a module which Gzips all files in a given directory recursively.

    However, if the directory path is empty, then original binary's path is taken as a zipping directory. Hence all the object files were zipped and somehow the binary file itself was disappearing.

    I have put a necessary check and now this will be avoided.


    Thanks to user @G.M. who asked me in the comments section to run command file <filename>. From that I got the hint that instead of below output:

    ELF 64-bit LSB relocatable, x86-64, version 1

    it was giving gzip output:

    gzip compressed data, from NTFS filesystem (NT)

    This led me to believe that there has to be something with our recently added Gzip mechanism.