Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

make install error 1ignored



  • Hello,
    I have script that compile many QT project (in script I do qmake, make and make install).
    Now I find out, that command <make install> return always 0, even if error occured.

    
    pou@silent-killer:/tmp/autobuild/Core$ make install
    /home/pou/Qt5.10.1/5.10.1/gcc_64/bin/qmake -install qinstall -exe Core /Core
    Error copying Core to /Core: Cannot create /Core for output
    make: [Makefile:5222: install_target] Chyba 3 (ignorováno)
    strip /Core
    strip: '/Core': No such file
    make: [Makefile:5223: install_target] Chyba 1 (ignorováno)
    pou@silent-killer:/tmp/autobuild/Core$ echo $?
    0
    pou@silent-killer:/tmp/autobuild/Core$ 
    
    

    In Make file there is "-" in make install section - I think its meaning - ignore error:

    install_target: first FORCE
            @test -d $(INSTALL_ROOT)/ || mkdir -p $(INSTALL_ROOT)/
            -$(QINSTALL_PROGRAM) $(QMAKE_TARGET) $(INSTALL_ROOT)/$(QMAKE_TARGET)
            -$(STRIP) $(INSTALL_ROOT)/$(QMAKE_TARGET)
    
    uninstall_target: FORCE
            -$(DEL_FILE) $(INSTALL_ROOT)/$(QMAKE_TARGET)
            -$(DEL_DIR) $(INSTALL_ROOT)/ 
    

    So how to change this behavior?
    I need detect "make install" error in my bash script.
    Thank you.


  • Lifetime Qt Champion

    Hi,

    That is rather a bash question. IIRC, you should call set -e as first command of your script to propagate the error.

    See here for a discussion of an alternative.



  • Hello,
    thank you for your reply.

    so I added "set -e" but behavior is same...
    my code is:

    #!/bin/bash
    set -e
            if ! make install;then
                    echo "Make install return error!"
            fi
    

    And error never appear event if I install to "/" where I have not permission.

    I think it is because "-" at start line in make file:

    it is describe here

    - means ignore the exit status of the command that is executed (normally, a non-zero exit status would stop that part of the build).
    

    So I think - I need to tell qmake to generate Makefile without this behavior (without ignore error).
    When I deleted this "-" manualy in Makefile, error is detected.
    But manually editing Makefile is not what I want.


  • Lifetime Qt Champion

    You can use sed to modify the relevant lines.


Log in to reply