UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Clickable: CMake Error: Cannot open file for write

    Scheduled Pinned Locked Moved App Development
    11 Posts 3 Posters 1.7k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
      Reply
      • Reply as topic
      Log in to reply
      This topic has been deleted. Only users with topic management privileges can see it.
      • ezzeE Offline
        ezze
        last edited by ezze

        Ok, I tried to change permissions of my hello-world directory:

        $ cd ..
        $ sudo chmod -R 777 hello-world
        $ cd hello-world
        $ clickable
        
        Going to run all of "build", "install", "launch"
        Running command "build"
        Building app
        -- The C compiler identification is GNU 5.4.0
        -- The CXX compiler identification is GNU 5.4.0
        -- Detecting C compiler ABI info
        -- Detecting C compiler ABI info - done
        -- Check for working C compiler: /usr/bin/cc - skipped
        -- Detecting C compile features
        -- Detecting C compile features - done
        -- Detecting CXX compiler ABI info
        -- Detecting CXX compiler ABI info - done
        -- Check for working CXX compiler: /usr/bin/c++ - skipped
        -- Detecting CXX compile features
        -- Detecting CXX compile features - done
        -- Found Gettext: /usr/bin/msgmerge (found version "0.19.7") 
        -- Configuring done
        -- Generating done
        -- Build files have been written to: /home/ezze/Development/ubuntu-touch/hello-world/build/all/app
        [ 50%] Merging translations into hello-world.desktop...
        [100%] Built target hello-world_FILES
        [100%] Generating translation template
        Wrote hello-world.desktop.in.h
        Merging translations into hello-world.desktop.
        [100%] Built target hello-world.desktop
        [100%] Built target hello-world.ezze.pot
        [ 50%] Merging translations into hello-world.desktop...
        Merging translations into hello-world.desktop.
        [ 50%] Built target hello-world.desktop
        [ 50%] Built target hello-world_FILES
        [100%] Generating translation template
        Wrote hello-world.desktop.in.h
        [100%] Built target hello-world.ezze.pot
        Install the project...
        -- Install configuration: "Release"
        -- Installing: /home/ezze/Development/ubuntu-touch/hello-world/build/all/app/install/./manifest.json
        CMake Error at cmake_install.cmake:54 (file):
          file INSTALL cannot copy file
          "/home/ezze/Development/ubuntu-touch/hello-world/build/all/app/manifest.json"
          to
          "/home/ezze/Development/ubuntu-touch/hello-world/build/all/app/install/./manifest.json":
          Success.
        

        Now I have problems copying files to install subdirectory. The reason is that I have strange 100999 user and group for files generated in build/all/app directory.

        $ ls build/all/app
        
        total 64
        drwxrwxrwx 6 ezze   ezze    4096 дек  9 00:19 .
        drwxrwxrwx 3 ezze   ezze    4096 дек  9 00:18 ..
        drwxrwxrwx 3 ezze   ezze    4096 дек  9 00:18 .clickable
        -rw-r--r-- 1 100999 100999 14514 дек  9 00:19 CMakeCache.txt
        drwxr-xr-x 6 100999 100999  4096 дек  9 00:19 CMakeFiles
        -rw-r--r-- 1 100999 100999  4979 дек  9 00:19 cmake_install.cmake
        -rw-r--r-- 1 100999 100999   136 дек  9 00:19 hello-world.desktop
        drwxrwxr-x 2 ezze   ezze    4096 дек  9 00:19 install
        -rw-r--r-- 1 100999 100999  7826 дек  9 00:19 Makefile
        -rwxrwxrwx 1 100999 100999   392 дек  9 00:19 manifest.json
        drwxr-xr-x 3 100999 100999  4096 дек  9 00:19 po
        

        I am not a docker expert but is it somehow related to it?

        I saw in the installation guide that I also had to install docker.io in order to make clickable to work but I skipped this step because I already have Docker on my machine. My Docker instance is configured to start containers without root privileges. I don't remember exactly how it was done but I made it after Docker installation for sure.

        $ docker --version
        Docker version 20.10.21, build baeda1f
        $ clickable setup
        Docker is already set up
        Bash completion seems to be already set up.
        Run "source /home/ezze/.bashrc" or open a new terminal to apply changes.
        $ docker image ls
        REPOSITORY                    TAG                        IMAGE ID       CREATED         SIZE
        clickable/amd64-16.04-amd64   16.04.5                    ea27f5a0adbd   8 days ago      3.85GB
        postgres                      12                         4c69e29b9bc4   4 months ago    373MB
        debian                        buster                     d4729731066b   4 months ago    114MB
        maven                         3.8.5-openjdk-17-slim      126d58d17617   7 months ago    424MB
        openjdk                       17.0.2-jdk-slim-bullseye   37cb44321d04   7 months ago    408MB
        node                          16.5-alpine                4d2c046835fc   17 months ago   112MB
        

        So is it supposed to run clickable commands with root privileges?

        I reinstalled clickable from apt repository in order to be possible to run it under root, and do the following from my project's root directory:

        $ sudo clickable setup docker
        $ sudo clickable
        
        Going to run all of "build", "install", "launch"
        Running command "build"
        Building app
        -- Configuring done
        -- Generating done
        -- Build files have been written to: /home/ezze/Development/ubuntu-touch/hello-world/build/all/app
        [ 50%] Merging translations into hello-world.desktop...
        [ 50%] Built target hello-world_FILES
        [100%] Generating translation template
        Wrote hello-world.desktop.in.h
        Merging translations into hello-world.desktop.
        [100%] Built target hello-world.desktop
        [100%] Built target hello-world.ezze.pot
        [ 50%] Merging translations into hello-world.desktop...
        Merging translations into hello-world.desktop.
        [ 50%] Built target hello-world.desktop
        [ 50%] Built target hello-world_FILES
        [100%] Generating translation template
        Wrote hello-world.desktop.in.h
        [100%] Built target hello-world.ezze.pot
        Install the project...
        -- Install configuration: "Release"
        -- Installing: /home/ezze/Development/ubuntu-touch/hello-world/build/all/app/install/./manifest.json
        -- Installing: /home/ezze/Development/ubuntu-touch/hello-world/build/all/app/install//hello-world.apparmor
        -- Installing: /home/ezze/Development/ubuntu-touch/hello-world/build/all/app/install//assets
        -- Installing: /home/ezze/Development/ubuntu-touch/hello-world/build/all/app/install//assets/logo.svg
        -- Installing: /home/ezze/Development/ubuntu-touch/hello-world/build/all/app/install//qml
        -- Installing: /home/ezze/Development/ubuntu-touch/hello-world/build/all/app/install//qml/Main.qml
        -- Installing: /home/ezze/Development/ubuntu-touch/hello-world/build/all/app/install//hello-world.desktop
        Successfully built package in './hello-world.ezze_1.0.0_all.click'.
        Running review on /home/ezze/Development/ubuntu-touch/hello-world/build/all/app/hello-world.ezze_1.0.0_all.click
        /home/ezze/Development/ubuntu-touch/hello-world/build/all/app/hello-world.ezze_1.0.0_all.click: pass
        Running command "install"
        Cannot access device.
        ADB: No devices attached
        SSH: no IP address specified (--ssh)
        

        Now it seems that I have more progress on running my first app (still need to explore why my device is not visible though developer mode is enabled). But my question at the moment: how can I configure clickable to run without root privileges?

        jezekJ 1 Reply Last reply Reply Quote 0
        • jezekJ Offline
          jezek @ezze
          last edited by

          @ezze said in Clickable: CMake Error: Cannot open file for write:

          how can I configure clickable to run without root privileges?

          I think the error was because you were not in "docker" group. Check if you are in docker group and if not, add yourself. A restart (or logout/login) may be needed.

          Here some useful links:
          https://ubports.com/blog/ubports-news-1/post/introduction-to-clickable-147
          https://docs.ubports.com/en/latest/appdev/index.html
          https://clickable-ut.dev/en/latest/install.html

          jEzEk

          ezzeE 1 Reply Last reply Reply Quote 0
          • ezzeE Offline
            ezze @jezek
            last edited by

            @jezek First of all, thank you for your reply! Really appreciate it!

            I am pretty sure I had docker group because I was able to run docker without root privileges.

            My last experiments with running sudo clickable mentioned above ended with broken login screen after reboot (.Xauthority was not writeable for some reason, and removing it didn't help). So I had to remove both Docker and Clickable in recovery mode.

            Here is the second attempt, and now I've installed Docker in rootless mode. Clickable asked me to setup Docker on the first run:

            $ clickable 
            Going to run all of "build", "install", "launch"
            Running command "build"
            Building app
            Docker is not running or not properly set up.
            Please run "clickable setup docker" first.
            ezze@merisa:~/Development/ubuntu-touch/hello-world$ clickable setup docker
            Do you want Clickable to set up docker by adding you to the docker group?
            See https://docs.docker.com/engine/security/#docker-daemon-attack-surface for security implications. [Y/n]: y
            Setting up docker
            Asking for root to start docker
            [sudo] password for ezze: 
            Setup finished
            Docker is set up and ready.
            

            And I am in docker group:

            $ groups ezze
            ezze : ezze adm cdrom sudo dip plugdev lpadmin lxd sambashare docker
            

            Anyway I'm still getting the same error like described in the first post of the topic when running clickable from the root directory of the project without root privileges.

            W 1 Reply Last reply Reply Quote 0
            • W Offline
              wizardi3 @ezze
              last edited by

              @ezze If you installed clickable as root you have to run it as root.

              ezzeE 1 Reply Last reply Reply Quote 0
              • ezzeE Offline
                ezze @wizardi3
                last edited by

                @wizardi3 First time I installed it with this command:

                pip3 install --user clickable-ut --upgrade
                

                So I didn't use sudo. Should pip3 install it locally?

                W 1 Reply Last reply Reply Quote 0
                • W Offline
                  wizardi3 @ezze
                  last edited by

                  @ezze Are you running Ubuntu? If so this is recommended

                  Install Via PPA (Ubuntu)
                  Add the PPA to your system:
                  sudo add-apt-repository ppa:bhdouglass/clickable
                  Update your package list: sudo apt-get update
                  Install clickable: sudo apt-get install clickable

                  If you use this you will be running in the /home directory of the user you logged in as and will probably have to preface your commands with sudo to avoid permission errors.
                  I installed as root
                  add-apt-repository ppa:bhdouglass/clickable
                  apt-get update
                  apt-get install clickable

                  Then ran as root the directoy you create will be under /root.
                  If you are running clickable in a terminal as root and using a GUI to move and edit files as a non root user you will have problems

                  ezzeE 1 Reply Last reply Reply Quote 0
                  • ezzeE Offline
                    ezze @wizardi3
                    last edited by

                    @wizardi3 Yes, I am on Ubuntu 20.04. I've already done these steps (tried installing from both pip3 and apt, see above), and yes, Clickable works under the root.

                    But this is not what I want. My questions is whether it's possible to install and run it without root privileges. I guess that Docker is the culprit. I don't want to run Docker with root privileges for security reasons, and it was configured this way to run other image containers. But seems that Clickable doesn't respect this way of Docker installation, no matter whether it's installed with pip3 or apt.

                    W 1 Reply Last reply Reply Quote 0
                    • W Offline
                      wizardi3 @ezze
                      last edited by

                      @ezze https://ubuntu.com/security/notices/USN-5134-1

                      1 Reply Last reply Reply Quote 0
                      • ezzeE Offline
                        ezze
                        last edited by

                        I'm still struggling with the issue, so decided to report it here.

                        W 1 Reply Last reply Reply Quote 0
                        • W Offline
                          wizardi3 @ezze
                          last edited by

                          @ezze You could disable docker when not in use.

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post