Appimage make package issue - ruby

I need to release my program which wrote in ruby. first of all I would like to make ruby to appimage package to client linux.
now I make the "ruby-img" folder and put the desktop file down looks like:
[Desktop Entry]
Categories=Development;
Icon=ruby
Name=ruby
Type=Application
Exec=ruby
the ruby what I use was compiled --prefix to "/app" folder, the folder is "/app/ruby" that contains "/app/ruby/bin, /app/ruby/lib ..." and then I copied /app/ruby entire folder to "ruby-img" folder, it looks like "ruby-img/app/ruby, ruby-img/usr ..." then I make the symbol link as "ln -r -s app/ruby/bin/ruby usr/bin/." in "ruby-img" folder.
and using appimagetools to create ruby-x86-64.AppImage. but can not run. some ruby lib can not found, (it looks like running ruby.AppImage, ruby lib path still find in /app/ruby/lib, but not in "ruby-img/app/ruby/lib", if i renamed /app/ruby it will occurs error)
i have tried recompile ruby --prefix to /usr/local/ruby or /tmp/ruby ... then copy to "ruby-img" and make some relative things, fix desktop file, but still can't run ruby.AppImage what appimagetool created.
any idea can help me ? thanks

I think you ran into the same problem as I did. Check https://github.com/AppImage/AppImageKit/issues/1004#issuecomment-1018423834

Related

Appimage problems

I would like to release my program that wrote in ruby language, I need to pack ruby to appimage file and send it to my client ubuntu PC first.
so I create the folder "ruby-img", then copy my compiled ruby which in "/app/ruby" folder to "ruby-img/app/ruby" and then made a link as "ln -r -s app/ruby/bin/ruby usr/bin/." in "ruby-img" folder.
then I create the desktop file and put png file to "ruby-img", using appimagetool to create ruby-x86_64.AppImage. sadly it can not run, AFAIK that ruby.AppImage still using /app/ruby/lib folder to find some library of ruby but not in "ruby-img/app/ruby/lib" related folder.
so I tried re-compile ruby as --prefix=/tmp/ruby or --prefix=/usr/local/ruby, then copy them to "ruby-img/usr/local/ruby" or "ruby-img/tmp/ruby" then maka some link as above, and repack to AppImage but ruby.AppImage still not working...
any idea can help me ?
AppImages contain of a filesystem with all the content you provide plus a small executable stub that will mount the AppImage filesystem, then run the AppRun executable to be found inside.
With that knowledge it is utmost important that you provide an executable in the root directory along with the .desktop and icon files. I suggest you do not create AppRun yourself. Use the precompiled one from https://github.com/AppImage/AppImageKit/releases/tag/continuous (do not forget to rename it to exactly 'AppRun').
Now when this AppRun gets invoked, it will perform a few checks, cd into the /usr directory and try to start the executable specified in the .desktop file. Check it's source code and you can see that it also sets a few environment variables.
Therefore it is best you provide your entrypoint as /usr/bin/ruby.sh and register that in the desktop file. Remember if /usr/bin/ruby.sh gets called, the current work directory is /usr. So ruby.sh can set further environment variables such as LD_LIBRARY_PATH so that the libraries you configured for /usr/lib will actually be loaded.
With that I hope you have at least as much success as I had.

Installing without package manager, why does executable binary fail with "command not found" unless I make the commands start with "./"?

I'm learning to use GNU/Linux and I want to know how to install programs that cannot be installed with the package manager.
I downloaded the tarball with the Linux 64-bit Binaries (including one called "haxelib"), extracted it, changed directory in the terminal to their location (~/Downloads/things/haxe_20201231082044_5e33a78aa/), and used chmod to make them executable.
If I try a command such as haxelib list, then the terminal returns
haxelib: command not found
If I try ./haxelib list (the same command but with ./ at the start) instead, then the command works as expected.
Why can't I use it without the ./? Programs installed with the package manager can be used without the ./.
Edit: I should probably also ask: where should I put the files from the tarball? Should they all go together in the same place? I have a feeling that a folder named "things" in my Downloads folder is not the best place for them.

How to Recreate Brew Aliasing, Without Brew?

Due to a security update in my organisation, I can no longer use brew to tap into my organisation's repo to install a package. I can, however, manually download the .jar files that brew was installing.
So previously I did:
brew tap <repo>
brew install <package>
<package> # Run the package from anywhere
And I could run the package from anywhere, just by typing in terminal. Easy peasy.
Normally Brew installs in usr/local/Cellar/<package>/some/internal/structure/<package.exe>. But somewhere along the way it does something with aliases and symlinks and $PATH [which I am confused by] so that I can run the given package from /usr/local/bin, which is in my $PATH, by just typing <package> anywhere in terminal.
I am trying to recreate this behaviour. I was able to manually download the jar files and put them in a folder /usr/local/bin/<package>. And if I run java -jar /usr/local/bin/<package>/<package.exe> then everything runs fine.
How do I get it so that I can run <package> from anywhere in terminal, like with Brew? Also, just to be 100% clear, I want to choose the alias; I want to be able to type "abc" to run the jar files.
/usr/local/bin/ is likely in your PATH variable already. If you want to check, print it to the terminal with echo "$PATH". If it isn't, you can pick one of the other directories in there or add it to. If you want to add that directory to your PATH variable, you want to add this to the relevant dot file (likely ~/.bashrc):
export PATH="/usr/local/bin:$PATH"
PATH is a colon separated list of directories where your system will look for executables.
Now, you can just write a short script to run java for you. For example, if we have a jar file called foo.jar, you could make a short script that runs java with the full path of foo.jar like this:
/usr/local/bin/foo:
#!/bin/bash
java -jar '/path/to/foo.jar' "$#"
sneaky edit: Make sure you give this file executable permissions:
chmod +x /usr/local/bin/foo
Now, on the terminal, if I run foo without a full path, it will run this script.
The "$#" is just going to pass any arguments you sent to this script along into the java program.
This isn't the only option to achieve this. You mentioned aliases as well. You could write an alias to your .bashrc that does the same thing:
alias foo='java -jar "path/to/foo.jar"'
A symlink wouldn't really be the best option here. This would be okay if your jar file was not in the PATH and you wanted it there. BUT, the PATH variable is really only for files that can be executed directly. As you already know, jar files cannot.

zeroMQ: cannot open libzmq.so.4

I am trying to install the zeroMQ for my server(redhat 7). Here is what I did:
1) download the zeroMQ and unpack it.
2) navigate to the file where I put the zeroMQ and run the commands below:
./configure
make
make install
Now I can find two head files in /usr/local/include: zmq.h and zmq_utils.h and five files in /usr/local/lib: libzmq.a libzmq.la libzmq.so libzmq.so.4 libzmq.so.4.0.0.
Then I try to code like this:
#include <zmq.h>
...
void * context = zmq_init(1);
But I get this error message: undefined reference to `zmq_init'
I find that the include works well but it cant find 'zmq_init', so maybe it's the problem of lib files. But all of the lib files have been in /usr/local/lib, right?
What should I do?
Problem solved:
I got that error message because the lib files are in the directory: /usr/local/lib
What we need to do is to create a file named local-lib.conf under the directory /etc/ld.so.conf.d/ and write /usr/local/lib in it. The name of the file is not important but its extension must be .conf.
Then, we must navigate to /etc/ld.so.conf.d/ and type this command: sudo ldconfig
I tried the fix provided by #Yves above, but that didn't work out for me so here's another way for Debian/Git installations.
Alternative fix:
I have faced this issue on a Docker container which was occuring due to the libzmq/czmq which was installed by cloning the git repo.
The problem is that the shared libraries when installed using git are located in the /usr/local/lib folder instead of /usr/lib/ where usually, in my case a C/C++ program looks for shared library files.
I fixed it by copying all files from /usr/local/lib folder to/usr/lib/ using the command
$ sudo cp -R /usr/local/lib/* /usr/lib
This was for a RPi/ Ubuntu-16.04 docker, the command or location of the files may vary depending on your OS.

configure command not found cygwin

This question has been asked many time but I am not able to resolve the problem from them so I am asking
I had installed Cygwin a few days ago.I tried using ./configure command but it says
-bash: ./configure: No such file or directory
I tried using
where configure
but I got the output
INFO: Could not find files for the given pattern(s).
then I tried grep configureand I got this output
/etc/bash_completion.d/configure
/usr/i686-pc-cygwin/sys-root/usr/share/libtool/libltdl/configure
/usr/share/ELFIO/configure
/usr/share/libtool/libltdl/configure
I tried to export the path and then run the ./configure but it also didn't worked.
I find no executable file named as configure in my cygwin bin directory.
Does it mean that I have to add configure file manually?How can I correct it?
NOTE :- I had also tried sh configure but it also didn't worked
If a software project is set up to be built using autoconf, that tool generates a script canonically called configure. It queries the system for various parameters that are subsequently used in the build, and is specific to the software package to be built. Different software projects have different configure scripts. They are all called configure, but their contents are not the same.
So, to actually build such a software project once that script was set up (usually done by the maintainers when packaging the source tarball for distribution), you call:
tar xzf <tarball>.gz # or xjf <tarball>.bz2 or whatever
cd <sourcedir> # the one you just untarred
./configure
make
make install
Note the prefix ./, which means "located in this directory" (i.e. the top directory of that project's source tree).
Actually, the better procedure is the so-called "out-of-tree build", when you set up a different directory for the binaries to be built in, so the source tree remains unmodified:
tar xzf <tarball>.gz # or xjf <tarball>.bz2 or whatever
mkdir builddir
cd builddir
../<sourcedir>/configure
make
make install
So, there is supposed to be no configure executable in your PATH, you are supposed to call the script of that name from the source tree you are trying to build from.
If I correctly understood...
Configure is not an application that should be installed on your system, but script that should be delivered with source code to prepare for make command. File named configure should be in the main directory of source code.
I understand that this is an old question. However many might find this solution helpful.
Normally we use the make command to compile a downloaded source in cygwin. In many cases it contains a autogen.sh file. Running that file with
bash autogen.sh
will in many case solve the problem. At least it solved my issue and i could then use the make command

Resources