Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binary needs to be started from 'appdir' directory... #50

Closed
HaleTom opened this issue Oct 19, 2018 · 11 comments
Closed

Binary needs to be started from 'appdir' directory... #50

HaleTom opened this issue Oct 19, 2018 · 11 comments
Labels
packaging Packaging and related user-feedback Waiting for feedback from user

Comments

@HaleTom
Copy link

HaleTom commented Oct 19, 2018

Good news: I've worked around the hunspell library naming issue with LD_LIBRARY_PATH=.

Now I'm working around qt.conf:

The doco says that qt.conf must be in the same directory as the executable, meaning I can't put it in /usr/bin due to conflicts with other packages.

So I plan to put qt.conf and the executable in /usr/bin/nixnote2, and have /usr/bin/nixnote2 be a wrapper script to run /usr/bin/nixnote2/nixnote2.

I've updated the qt.conf to have Prefix = ../../ due to the extra directory created.

The issue I'm hitting is:

% /home/ravi/code/aur/nixnote2-bin/squashfs-root/usr/bin/nixnote2/nixnote2 --logLevel=0
INFO  2018-10-19 18:59:45.152 src/settings/startupconfig.cpp:315 Changed logLevel via command line option to 0
DEBUG 2018-10-19 18:59:45.153 src/settings/startupconfig.cpp:733 Setting command: #0 to value=true
DEBUG 2018-10-19 18:59:45.153 src/main.cpp:131 Startup config ret=0, guiAvailable=true
DEBUG 2018-10-19 18:59:45.207 src/settings/filemanager.cpp:95 Setting up file paths:  startupConfigDirPath="", startupUserDataDir="", startupProgramDirPath=""
DEBUG 2018-10-19 18:59:45.207 src/settings/filemanager.cpp:110 Checking whenever legacy config dir exists: "/home/ravi/.nixnote"
DEBUG 2018-10-19 18:59:45.207 src/settings/filemanager.cpp:114 Legacy config/data dir found. falling back to that: "/home/ravi/.nixnote/"
DEBUG 2018-10-19 18:59:45.207 src/settings/filemanager.cpp:312 Checking write access for directory "/home/ravi/.nixnote"
DEBUG 2018-10-19 18:59:45.207 src/settings/filemanager.cpp:312 Checking write access for directory "/home/ravi/.nixnote"
DEBUG 2018-10-19 18:59:45.208 src/settings/filemanager.cpp:50 Default program dir path: applicationDirPath="/home/ravi/code/aur/nixnote2-bin/squashfs-root/usr/bin/nixnote2"
ERROR 2018-10-19 18:59:45.208 src/settings/filemanager.cpp:58 Binary needs to be started from 'appdir' directory...
ERROR 2018-10-19 18:59:45.208 src/settings/filemanager.cpp:59 E.g. use something like: cd $$PROJECT_DIR; ./appdir/usr/bin/nixnote2
%

Is there a way to disable or workaround this check? Perhaps if an environment variable (eg $NIXNOTE2_SKIP_APPDIR_CHECK) is set?

@HaleTom
Copy link
Author

HaleTom commented Oct 22, 2018

As background for the desire for a binary package:

  • I want to save user's time in compiling
  • Provide access to the skeleton config file
  • Provide access to the documentation

Both of the last two are difficult using the AppImage format, and the AppImage also contains many non-needed libraries (newer versions of which Arch already has)

@robert7
Copy link
Owner

robert7 commented Oct 24, 2018

Hi,
I understand what you want to do, but I think it is not the "correct" way. Therefore you'll get various unnecessary problems..

The Idea of AppImage is:

  • the application in AppImage packaging is "self contained" - it contains all the dependencies in a coherent set - which plays together well
  • yes its bigger then native package, but I think the people today don't care so much whenever the app is 50MB or 3MB. They care more whenever it works out of the box.
  • yes it may be, that some libraries included in the AppImage are older then on your system, but the someway guaranteed to work
  • the AppImage should work on ~all distributions and it should be really "plug&play" - download/mark as executable - run - it should work

As you start replacing libraries by LD_LIBRARY_PATH and removing parts of the AppImage this all may break..
I think correct way would be to build a binary package for your distribution. I have no idea how this work on Arch - and have no time to study it now. But the idea would be to do something like the pre-built binary "deb" packages, which are build in the PPA for Ubuntu - one package per Ubuntu version.

With that being said, what you want to do, can be reached (but I think you'll get further problems along the way.. so the problems only start :) )..

The error message you get happens when Nixnote is searching for application data. It expects to be run as $SOMEDIR/bin/nixnote2 then it searches for the data in $SOMEDIR/share/nixnote2. Thats all. The algorithm can be overriden by --programDataDir command line option.

Example (2 executions one failed - then one with manual override):

 /d/dev/nixnote2/qmake-build-debug  ./nixnote2                                                                                           5.3s
ERROR 2018-10-23 08:42:32.449 src/settings/filemanager.cpp:58 Binary needs to be started from 'appdir' directory...
ERROR 2018-10-23 08:42:32.449 src/settings/filemanager.cpp:59 E.g. use something like: cd $$PROJECT_DIR; ./appdir/usr/bin/nixnote2
robert7@LP-RSPIEGEL:/d/dev/nixnote2/qmake-build-debug$ 


 /d/dev/nixnote2/qmake-build-debug  ./nixnote2 --programDataDir=/d/dev/nixnote2/appdir/usr/share/nixnote2 --logLevel=1                  110ms
INFO  2018-10-23 08:42:42.290 src/settings/startupconfig.cpp:342 "Set programDataDir via command line to /d/dev/nixnote2/appdir/usr/share/nixnote2"
INFO  2018-10-23 08:42:42.290 src/settings/startupconfig.cpp:315 Changed logLevel via command line option to 1
DEBUG 2018-10-23 08:42:42.290 src/settings/startupconfig.cpp:733 Setting command: #0 to value=true
DEBUG 2018-10-23 08:42:42.290 src/main.cpp:131 Startup config ret=0, guiAvailable=true
DEBUG 2018-10-23 08:42:42.358 src/settings/filemanager.cpp:95 Setting up file paths:  startupConfigDirPath="", startupUserDataDir="", startupProgramDirPath="/d/dev/nixnote2/appdir/usr/share/nixnote2/"
DEBUG 2018-10-23 08:42:42.358 src/settings/filemanager.cpp:110 Checking whenever legacy config dir exists: "/home/robert7/.nixnote"
DEBUG 2018-10-23 08:42:42.358 src/settings/filemanager.cpp:114 Legacy config/data dir found. falling back to that: "/home/robert7/.nixnote/"
DEBUG 2018-10-23 08:42:42.358 src/settings/filemanager.cpp:312 Checking write access for directory "/home/robert7/.nixnote"
DEBUG 2018-10-23 08:42:42.358 src/settings/filemanager.cpp:312 Checking write access for directory "/home/robert7/.nixnote"
DEBUG 2018-10-23 08:42:42.358 src/settings/filemanager.cpp:141 Resulting file paths: configDir="/home/robert7/.nixnote/", userDataDir="/home/robert7/.nixnote/", programDataDir="/d/dev/nixnote2/appdir/usr/share/nixnote2/"

@robert7 robert7 added packaging Packaging and related user-feedback Waiting for feedback from user labels Oct 24, 2018
@robert7
Copy link
Owner

robert7 commented Oct 24, 2018

I improved the error message. Now it says:

 /d/dev/nixnote2  ./qmake-build-debug/nixnote2                                                                                                 7.1s
ERROR 2018-10-24 10:43:23.465 src/settings/filemanager.cpp:58 Binary needs to be started from application directory...
ERROR 2018-10-24 10:43:23.466 src/settings/filemanager.cpp:59 Expected runtime pathname is $SOMEDIR/bin/nixnote2, then application data is expected in $SOMEDIR/share/nixnote2
ERROR 2018-10-24 10:43:23.466 src/settings/filemanager.cpp:62 E.g. use something like: cd $PROJECT_DIR/appdir; ./usr/bin/nixnote2. Or you may use --programDataDir command line option for manual override.

@robert7
Copy link
Owner

robert7 commented Oct 26, 2018

The updated message is available in 2.0.1-beta5a (but its just a clue/info ).
Let me know in case "--programDataDir" did not worked for you.

@robert7 robert7 closed this as completed Oct 26, 2018
@HaleTom
Copy link
Author

HaleTom commented Oct 28, 2018

Brilliant, thanks for the --programDataDir tip. I'll look into it over the next few days!

@HaleTom
Copy link
Author

HaleTom commented Oct 28, 2018

I downloaded today's AppImage and tried with a bunch of possible options to --programDataDir:

% pwd        
/home/ravi/code/aur/nixnote2-bin/pkg-root/usr/bin/nixnote
% ./nixnote2 
ERROR 2018-10-28 13:40:42.629 src/settings/filemanager.cpp:58 Binary needs to be started from application directory...
ERROR 2018-10-28 13:40:42.629 src/settings/filemanager.cpp:59 Expected runtime pathname is $SOMEDIR/bin/nixnote2, then application data is expected in $SOMEDIR/share/nixnote2
ERROR 2018-10-28 13:40:42.629 src/settings/filemanager.cpp:62 E.g. use something like: cd $PROJECT_DIR/appdir; ./usr/bin/nixnote2. Or you may use --programDataDir command line option for manual override.
% ./nixnote2 --programDataDir /home/ravi/code/aur/nixnote2-bin/squashfs-root/usr/bin/nixnote/
ERROR 2018-10-28 13:41:11.315 src/settings/filemanager.cpp:58 Binary needs to be started from application directory...
ERROR 2018-10-28 13:41:11.315 src/settings/filemanager.cpp:59 Expected runtime pathname is $SOMEDIR/bin/nixnote2, then application data is expected in $SOMEDIR/share/nixnote2
ERROR 2018-10-28 13:41:11.315 src/settings/filemanager.cpp:62 E.g. use something like: cd $PROJECT_DIR/appdir; ./usr/bin/nixnote2. Or you may use --programDataDir command line option for manual override.
% ./nixnote2 --programDataDir /home/ravi/code/aur/nixnote2-bin/squashfs-root/usr/bin/ 
ERROR 2018-10-28 13:41:21.241 src/settings/filemanager.cpp:58 Binary needs to be started from application directory...
ERROR 2018-10-28 13:41:21.241 src/settings/filemanager.cpp:59 Expected runtime pathname is $SOMEDIR/bin/nixnote2, then application data is expected in $SOMEDIR/share/nixnote2
ERROR 2018-10-28 13:41:21.241 src/settings/filemanager.cpp:62 E.g. use something like: cd $PROJECT_DIR/appdir; ./usr/bin/nixnote2. Or you may use --programDataDir command line option for manual override.
% ./nixnote2 --programDataDir /home/ravi/code/aur/nixnote2-bin/squashfs-root/usr/    
ERROR 2018-10-28 13:41:25.483 src/settings/filemanager.cpp:58 Binary needs to be started from application directory...
ERROR 2018-10-28 13:41:25.483 src/settings/filemanager.cpp:59 Expected runtime pathname is $SOMEDIR/bin/nixnote2, then application data is expected in $SOMEDIR/share/nixnote2
ERROR 2018-10-28 13:41:25.483 src/settings/filemanager.cpp:62 E.g. use something like: cd $PROJECT_DIR/appdir; ./usr/bin/nixnote2. Or you may use --programDataDir command line option for manual override.
% ./nixnote2 --programDataDir /home/ravi/code/aur/nixnote2-bin/squashfs-root/    
ERROR 2018-10-28 13:41:29.998 src/settings/filemanager.cpp:58 Binary needs to be started from application directory...
ERROR 2018-10-28 13:41:29.998 src/settings/filemanager.cpp:59 Expected runtime pathname is $SOMEDIR/bin/nixnote2, then application data is expected in $SOMEDIR/share/nixnote2
ERROR 2018-10-28 13:41:29.998 src/settings/filemanager.cpp:62 E.g. use something like: cd $PROJECT_DIR/appdir; ./usr/bin/nixnote2. Or you may use --programDataDir command line option for manual override.
% ./nixnote2 --programDataDir /home/ravi/code/aur/nixnote2-bin/squashfs-root/usr/lib
ERROR 2018-10-28 13:44:01.877 src/settings/filemanager.cpp:58 Binary needs to be started from application directory...
ERROR 2018-10-28 13:44:01.877 src/settings/filemanager.cpp:59 Expected runtime pathname is $SOMEDIR/bin/nixnote2, then application data is expected in $SOMEDIR/share/nixnote2
ERROR 2018-10-28 13:44:01.877 src/settings/filemanager.cpp:62 E.g. use something like: cd $PROJECT_DIR/appdir; ./usr/bin/nixnote2. Or you may use --programDataDir command line option for manual override.
% ./nixnote2 --programDataDir /home/ravi/code/aur/nixnote2-bin/squashfs-root/usr/share
ERROR 2018-10-28 13:44:17.970 src/settings/filemanager.cpp:58 Binary needs to be started from application directory...
ERROR 2018-10-28 13:44:17.970 src/settings/filemanager.cpp:59 Expected runtime pathname is $SOMEDIR/bin/nixnote2, then application data is expected in $SOMEDIR/share/nixnote2
ERROR 2018-10-28 13:44:17.970 src/settings/filemanager.cpp:62 E.g. use something like: cd $PROJECT_DIR/appdir; ./usr/bin/nixnote2. Or you may use --programDataDir command line option for manual override.
% ./nixnote2 --programDataDir /home/ravi/code/aur/nixnote2-bin/squashfs-root/usr/share/nixnote2
ERROR 2018-10-28 13:44:25.347 src/settings/filemanager.cpp:58 Binary needs to be started from application directory...
ERROR 2018-10-28 13:44:25.348 src/settings/filemanager.cpp:59 Expected runtime pathname is $SOMEDIR/bin/nixnote2, then application data is expected in $SOMEDIR/share/nixnote2
ERROR 2018-10-28 13:44:25.348 src/settings/filemanager.cpp:62 E.g. use something like: cd $PROJECT_DIR/appdir; ./usr/bin/nixnote2. Or you may use --programDataDir command line option for manual override.

Note, all of the above directories exist (they were entered by tab-expansion).

Perhaps it's the code that checks for the existence of the given directory?

% ./nixnote2 --programDataDir /root/DOESNOTEXIST
ERROR 2018-10-28 13:46:12.833 src/settings/filemanager.cpp:58 Binary needs to be started from application directory...
ERROR 2018-10-28 13:46:12.834 src/settings/filemanager.cpp:59 Expected runtime pathname is $SOMEDIR/bin/nixnote2, then application data is expected in $SOMEDIR/share/nixnote2
ERROR 2018-10-28 13:46:12.834 src/settings/filemanager.cpp:62 E.g. use something like: cd $PROJECT_DIR/appdir; ./usr/bin/nixnote2. Or you may use --programDataDir command line option for manual override.

@HaleTom
Copy link
Author

HaleTom commented Oct 28, 2018

In the message, is SOMEDIR the root of the place it's being run from?

What is PROJECT_DIR?

@robert7
Copy link
Owner

robert7 commented Oct 29, 2018

$SOMEDIR is the "install prefix". If you unpack the AppImage into /home/ravi/code/aur/nixnote2-bin/squashfs-root then it its /home/ravi/code/aur/nixnote2-bin/squashfs-root/usr.
Then if you run /home/ravi/code/aur/nixnote2-bin/squashfs-root/usr/bin/nixnote2 then it should find the data by itself as it should be in /home/ravi/code/aur/nixnote2-bin/squashfs-root/usr/share/nixnote2.

Or you can say nixnote2 --programDataDir /home/ravi/code/aur/nixnote2-bin/squashfs-root/usr/share/nixnote2.

$PROJECT_DIR is the "project directory" - where you checkout the project from git, then its get per default installed in $PROJECT_DIR/appdir and $SOMEDIR would be $PnixnROJECT_DIR/appdir/usr.

simple case with appimage
screen_20181029_01

here data is NOT relocated, but I point to data dir manually
screen_20181029_02

example where you compiled & installed to default location
screen_20181029_03

here finaly example where binary is in non standard path but I point manually to data
screen_20181029_04

@robert7
Copy link
Owner

robert7 commented Oct 29, 2018

--programDataDirneed to be a path with following files:
screen_20181029_05

@HaleTom
Copy link
Author

HaleTom commented Oct 29, 2018

Thanks for the examples!

I worked out it was a syntax thing...

--programDataDir /d/dev/nixnote2/appdir/usr/share/nixnote2 doesn't work

--programDataDir=/d/dev/nixnote2/appdir/usr/share/nixnote2 does work

The = is mandatory but no warning is printed if it is not given.

@robert7
Copy link
Owner

robert7 commented Oct 30, 2018

The = is mandatory but no warning is printed if it is not given.

yes. that's true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packaging Packaging and related user-feedback Waiting for feedback from user
Projects
None yet
Development

No branches or pull requests

2 participants