Important: Please read the Qt Code of Conduct -

[Cross compile] [Windows&Linux][PuTTY] Error: Access denied.

  • Hi All,

    I am tring to realize cross compile on Windows and Linux by using PuTTY. I use VirtualBox and CentOS6.5 for Linux. My Ot version on Windows is Qt Creator 4.7.0 (Based on Qt 5.11.1, MSVC 2015, 32 bit), and my Qt version on Linux is Qt Creator 4.0.2( Based on Qt 5.7.0, GCC 4.9.1 20140922(Red Hat 4.9.1-10), 64 bit). My MSVC version is 2015, 64 bit.

    The IP of client(Windows) is, and the IP of server(Linux) is The client and server can ping to each other. And I can also login the server by using PuTTY.

    Now I have established a new GUI application on Windows. My method is to create the following files and put them in my GUI application folder.



    The following are the details of these files.




    I created a folder called 'projects' on Linux and this folder has a subfolder called 'QtGuiApplication1'.

    In Qt VS Tools, I created basic pro. file, and deleted the 'WIN 32' from line 10 'DEFINES += _UNICODE WIN 32 QT_DLL QT_WIDGETS_LIB'.

    In the property of my application, I set Build Events->Post-Build Event->Command Line as 'cross_compile.bat', then built my application.

    But I had the following error. After I input the password, this window closed automatically, and I couldn't find my application on Linux.


    So, anyone can help me? Thanks!

  • Moderators

    @EricLiii Honestly you'd be better off using putty to ssh and build on your linux box after pulling from your source control. But on to answer the question ...

    1. It looks to me like the password is not being accepted. I don't know putty well enough to know the command line switches, but you can test that command by running it outside the build process and see what happens.

    2. You can check on your linux server to see if the cross_compile_putty_commands.txt file is there and works, again manually by running ./cross_compile_putty_commands.txt on the command line.

    3. Finally, don't forget that you need to set a text file you want to "run" as executable in linux. If you run ls -lh and the permissions look like -rw-rw-r-- or something like that then that is your problem. You need to chmod 755 cross_compile_putty_commands.txt before you try to run it. You need -rwxr-xr-x or something like that. Oops, I realized using 755 may be confusing to a non posix guy, that is equivalent to u+rwx g+rx o+rx or just chmod +x cross_compile*.

    That should help out let me know if things still aren't working and give me some more info and I can help guide you more.

    Also consider setting up jenkins and using something like git to do your cross compile builds automatically, or do each platform manually. Using that post build step is asking for trouble, especially since you can't build that on a new machine or another developer's machine because it has build stuff specific to your machine, your linux machine, and your network. Not to mention it contains your password.

    On the password from that's what public/private ssh keys are for. See ssh-keygen. I'm sure there's a putty equivalent (but I don't really use putty). Then as long as your private key is available on your system you can ssh without typing your password, or including it in scripts. ;)

  • @ambershark
    Thanks for your reply!

    I have solved this problem by compressing my Qt project and sending it from Windows to Linux through PuTTY. Then open it on Linux. I gave up using post-build event. I think you're right, this is not a good way.

    Thanks again!

  • Moderators

    @EricLiii No problem! Happy to help.

    Glad you got it working too. :)

Log in to reply