PDA

View Full Version : Deploy a Qt application and get error of "The file could not be read" on Ubuntu.



henryjoye
16th June 2011, 08:39
Hi all,

I have a qt based application (named as qtapp) on Ubuntu. The application uses Cg and OpenGL graphics libraries. I compiled the application using shared libraries.

I followed instructions from web on deploying qt applications step by step:
1. copy the executable file qtapp,
2. copy the dependent libs (got lib info using "ldd qtapp"),
3. create a sh file (named as vis.sh) to let qtapp find dependent libs.

The function of my application is to read a gzip raw 3d image data file and then render this data in a qt window.

When I copy the executable file qtapp with dependent libs together to another Ubuntu PC and run the vis.sh file, the application says that "The file could not be read". The qt window is also blank. It means that the qtapp did not read the 3d image data file and get it to render.

I think my problem is similar to this link:
http://www.qtcentre.org/threads/17545-Problem-how-use-an-application-qt-on-other-pc

But I did not use any plugins, I only use zlib for gziped raw data. Would you please help me how to solve this problem?

Thank you very much!

mvuori
16th June 2011, 09:39
Since it is your application that says the error message you should be able to instrument it and make it tell more about the problem: where in the code does the error occur, does the app even find the file or does the error mean that it for some reason cannot open the file for reading, or that it thinks that the file is of a wrong format, etc.

henryjoye
16th June 2011, 10:56
Since it is your application that says the error message you should be able to instrument it and make it tell more about the problem: where in the code does the error occur, does the app even find the file or does the error mean that it for some reason cannot open the file for reading, or that it thinks that the file is of a wrong format, etc.

Thank you!

Q:where in the code does the error occur,
A:When the program load the 3d image data file, it says that the file could not be read.

Q:does the app even find the file or does the error mean that it for some reason cannot open the file for reading, or that it thinks that the file is of a wrong format,
A: I think the error means that it for some reason cannot open the file for reading. I use gzip file and so use zlib lib.

By the way, the application works fine inside the building folder on my own computer.
When I copy the executable file and sh file to another new folder that is not in building folder, the application also does not work correctly same as on another computer.

wysota
16th June 2011, 11:19
Where does the message come from? Your own code or some external library? Show us the code that triggers the message.

henryjoye
16th June 2011, 11:59
Where does the message come from? Your own code or some external library? Show us the code that triggers the message.

The message is displayed inside my console text window. It is not from my code, I think it is from some external library.

wysota
16th June 2011, 12:15
What is the code triggering the message?

henryjoye
16th June 2011, 13:20
What is the code triggering the message?

hi, I just solved the problem following your questions for me! Although you did not directly provide me the answer, your questions step by step guided me to find what the problem is.
It is because that I did not copy the Cg shader files used in the application. The application cannot find shader files, so it said "The file could not be read". Thank you all very much for your kind help! It is really a silly ignorance.