Skip to content

linux desktop: make install prefix configurable #73881

Closed

Description

@mx1up

when building a linux desktop app, it fails with:

  file INSTALL cannot copy file
  "/home/me/programming/fdupes_gui/build/linux/debug/intermediates_do_not_run/fdupes_gui"

  to "/usr/local/fdupes_gui": Permission denied.

/usr/local is not user writable and should not be. running the produced binary in the intermediates_do_not_run folder fails, as the directory name helpfully hints at ;)

fixing the install prefix manually in the CMakeLists.txt like this

IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
  SET(CMAKE_INSTALL_PREFIX "/home/me/bin" CACHE PATH "install prefix in home bin" FORCE)
ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 

fixes the build and I am able to run without problems.

Obviously this is a workaround, so i guess a build param would be handy? like, for example:
flutter build linux --install-prefix /home/me/bin

Activity

  1. TahaTesser commented on Jan 14, 2021

    @TahaTesser
    Contributor

    Hi @mx1up

    /usr/local is not user writable and should not be.

    I agree but I've never seen this error when building a Linux app.
    Are you using snap or git clone Flutter?
    Can you please provide your flutter doctor -v your flutter build linux --verbose
    Thank you

  2. added
    in triage
    waiting for response
    on Jan 14, 2021
  3. mx1up commented on Jan 14, 2021

    @mx1up
    ContributorAuthor

    small disclaimer: I have to admit I am using Opensuse Tumbleweed for the first time, normally I use Opensuse Leap. I am not using the snap, but simply cloned and followed the instructions. I am using fvm to keep the dev channel separate from my regular projects' flutter installs.

    flutter doctor -v :

    [✓] Flutter (Channel dev, 1.26.0-8.0.pre, on Linux, locale en_US.UTF-8)
        • Flutter version 1.26.0-8.0.pre at /home/matthias/fvm/versions/dev
        • Framework revision b9d06fffb2 (6 days ago), 2021-01-07 18:36:48 -0800
        • Engine revision 42a8d4c681
        • Dart version 2.12.0 (build 2.12.0-179.0.dev)
    
    [!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
        • Android SDK at /home/matthias/programs/android-sdk
        • Platform android-30, build-tools 30.0.3
        • ANDROID_SDK_ROOT = /home/matthias/programs/android-sdk
        • Java binary at: /usr/lib64/jvm/jre-openjdk/bin/java
        • Java version OpenJDK Runtime Environment (build 11.0.9.1+1-suse-1.1-x8664)
        ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses
    
    [✓] Linux toolchain - develop for Linux desktop
        • clang version 11.0.0
        • cmake version 3.19.2
        • ninja version 1.10.2
        • pkg-config version 1.7.3
    
    [!] Android Studio (not installed)
        • Android Studio not found; download from https://developer.android.com/studio/index.html
          (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).
    
    [✓] IntelliJ IDEA Community Edition (version 2020.3)
        • IntelliJ at /home/matthias/programs/idea-IC-203.6682.168
        • Flutter plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/9212-flutter
        • Dart plugin can be installed from:
          🔨 https://plugins.jetbrains.com/plugin/6351-dart
    
    [✓] Connected device (1 available)
        • Linux (desktop) • linux • linux-x64 • Linux
    
    ! Doctor found issues in 2 categories.
    

    I note the Android Studio is not found although I have it installed. Apparently, the AS config dir is located at /home/matthias/.cache/Google/AndroidStudio4.1/ instead of the usual /home/matthias/.AndroidStudio4.1/

    To have a fresh build env I first ran flutter clean and deleted the linux folder. After that I recreated the linux folder using flutter create . Okay..
    So I was writing these comments on the go, and now it seems to build correctly!

    The only reason I can think of as to why it didn't work yesterday, is that I have rebooted by now. Yesterday while installing some dependencies like cmake, etc, I noticed the package manager saying some processes needed to be restarted. At that time I ignored the message as I could not see why installing a compiler for example would need a restart of some process in order to correctly compile the flutter program.. :) i guess i was wrong.. sorry, for not trying a reboot first.

    I post the list of installed packages, in case I install on my desktop too so I can validate this hypothesis:
    cmake
    clang
    ninja
    libblkid-devel
    gtk3-devel
    gcc-c++
    xz-devel

    Yesterday, I had some warning in the console when running the program, these are gone now too.

  4. removed
    waiting for response
    on Jan 14, 2021
  5. stuartmorgan-g commented on Jan 14, 2021

    @stuartmorgan-g
    Contributor

    This is a duplicate of #59890. I've seen a few different reports of this over time, but we've never been able to figure out how CMake gets into this state.

    fixing the install prefix manually in the CMakeLists.txt like this

    IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
      SET(CMAKE_INSTALL_PREFIX "/home/me/bin" CACHE PATH "install prefix in home bin" FORCE)
    ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 
    

    fixes the build and I am able to run without problems.

    But the CMakeLists.txt file already has code like that:

    # By default, "installing" just makes a relocatable bundle in the build
    # directory.
    set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
    if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
    set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
    endif()

    What's not clear is why, rarely, that's being ignored when people build. In every case I've seen, a flutter clean fixes it (i.e., when CMake regenerates its cache, it does so correctly the second time). The fact that it can't be reproduced so far makes it impossible to tell what's happening in the first place, unfortunately.

    i guess a build param would be handy?

    Install in this build isn't intended to actually install; it's been repurposed to create the relocatable bundle.

  6. github-actions commented on Aug 7, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  7. locked as resolved and limited conversation to collaborators on Aug 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions