Setting LD_LIBRARY_PATH in Cygwin - path

I am following the tutorial : http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jniexamp.html
when I reach the part where I am supposed to set the library path :
Unix or Linux:
LD_LIBRARY_PATH=`pwd`
export LD_LIBRARY_PATH
Windows NT/2000/95:
set PATH=%path%;
Neither of these work in cygwin. I keep getting an error when trying to run my program.

Cygwin doesn't use LD_LIBRARY_PATH, it looks for shared libraries in PATH, so try:
export PATH=`pwd`:$PATH
That will add the current directory to the front of the PATH.

Is that
LD_LIBRARY_PATH=$(pwd)
and you just messed up the html, or are you really running:
LD_LIBRARY_PATH=pwd
If the latter, try adding the $() to get the current working directory into the path. Also, you can
echo $LD_LIBRARY_PATH
to ensure it contains what you want. You might consider doing
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)
to avoid discarding previous contents of the path.

Related

I install a python package with "pip install opencv-python" and it gives me a warning in Ubuntu

The warning it gives me is this:
WARNING: The scripts f2py, f2py3 and f2py3.10 are installed in '/home/minombre/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
How do I fix this?
Or can I just leave it like that?
even though I would like to fix it.
I am using for the first time linux ubuntu.
The warning message you are seeing is telling you that the scripts 'f2py', 'f2py3', and 'f2py3.10' are installed in the directory '/home/minombre/.local/bin', but this directory is not on your system's PATH. The PATH is a list of directories that your system looks in when you run a command. When you run a command, your system looks in the directories listed in the PATH for a file with that name.
You have a few options to solve this:
Add the directory '/home/minombre/.local/bin' to your system's PATH. This will allow your system to find the scripts when you run them. You can do this by editing the '.bashrc' file in your home directory and adding the following line at the end of the file:
export PATH=$PATH:/home/minombre/.local/bin
Use the full path to the script when you run it. Instead of just
running f2py, for example, you would run
'/home/minombre/.local/bin/f2py'
Use the '--no-warn-script-location' flag when you install the package.
This will suppress the warning message but it will not add the
directory to your PATH.
pip install opencv-python --no-warn-script-location
It's important to note that if you are not going to use the scripts that are giving the warning, you can safely ignore the warning.
It is also important to mention that you can also check your PATH by running in the terminal:
echo $PATH
and it will show you the list of directories.

Changing homebrew-cask installation directories

I recently installed homebrew-cask and one of the things that I see is that it installs applications by default into the following directories:
Versioned package downloads => /opt/homebrew-cask/Caskroom/
Example : /opt/homebrew-cask/Caskroom/pdftk/2.02
Application binaries/libraries => /opt/
Example : /opt/pdftk/bin/
Instead of using the /opt directory, I would really like to use a directory located in /usr/local which is where my homebrew installation resides.
I can see from the docs that I can set an environment variable for #1, but I can't seem to figure out where to change #2.
I'd like to have the above two settings go to:
/usr/local/Caskroom/packages/pdftk/2.02
/usr/local/Caskroom/pdftk/bin
Any ideas on how I can change both settings or are there good ideas why I wouldn't want to do this?
Thanks.
From the Caskroom manual (specifically the Usage manual) you can change where the actual application will be installed by adding a line like this to your .bash_profile or .zshenv etc.
# Specify your defaults in this environment variable
export HOMEBREW_CASK_OPTS="--appdir=/Applications --caskroom=/usr/local/Caskroom"

Updated my path and now my program can't find my gems

I was having some trouble installing the gem libv8. Apparently I need to have python installed. I installed Python and was attempting to update my path with command from another forum:
SET PATH=C:[Ruby Directory]\bin;C:[Python Directory]
or in my case:
SET PATH=C:\Ruby192\bin;C:\Python27
I am not strong with paths and I can't figure out what I did. Now my environment can't find my Ruby directory.
Can someone explain what I did and how I might fix it?
That is most likely because your PATH variable already had a bunch of stuff that you simply throwed away with that line:
echo %PATH%
# a bunch of stuff
SET PATH=C:\Ruby192\bin;C:\Python27
echo %PATH%
# C:\Ruby192\bin;C:\Python27
You can try to append to it instead instead:
set PATH=%PATH%;C:\Ruby192\bin;C:\Python27
echo %PATH%
# a bunch of stuff plus C:\Ruby192\bin;C:\Python27
This change will be avalid for your terminal session only. Closing it and open again should restore the default path. If you need to make it permanent, you need to change your path throught the windows (for example, following this instructions)

Setting $PATH and $JAVA_HOME from IzPack install.xml

I see that $JAVA_HOME is a built-in variable in IzPack. Can I assign to it in a pre-install script and have the installer use that? Currently I am stuck on a machine that defaults to an open-source JRE that runs horribly and I need to reassign it to the Sun JRE so that the installer will run properly.
In the pre-install script, can I append to the $PATH with:
${ENV[PATH]} = ${ENV[PATH]}:/usr/local/java/bin
Let me know what I can do, I cannot get access to write to the .cshrc or .cshrc.login and I cannot tell my users to set the environment variables themselves.
The answer to this for me was that I had to write a python script that set the environment variables and then called a subprocess to launch the installer. This is far from ideal, but it seems like if your machine is stuck by default with an open source JRE, then you can't fix that any other way.

Including ~/opt/lib libraries in a Passenger Rails App

I'm having trouble getting a rails app on Dreamhost's Passenger to see compiled libraries in my ~/opt/lib directory. I have to put them here because I don't have root access.
I can boot up my app in ./script/console and it sees them libraries just fine because I updated my .bash_profile's LD_LIBRARY_PATH environment variable to include ~/opt/lib.
I've tried putting ENV['LD_LIBRARY_PATH'] = '~/opt/lib' in my environment.rb file but it doesn't seem too help. I get the following error from Passenger when I navigate to my site:
libodbcinst.so.1: cannot open shared object file: No such file or directory - /home/username/opt/lib/odbc.so
Anyone have experience with this?
Thanks
I had similar issue with Passenger that I described in http://blog.rayapps.com/2008/05/21/using-mod_rails-with-rails-applications-on-oracle/
But in your case this migth not work as you will not be able to change Dreamhost's httpd.conf file.
Other thing that you can try is to set LD_LIBRARY_PATH in .bashrc - according to http://www.wavethenavel.com/jonathanpenn/2008/09/08/bootstrapping-a-dreamhost-account-for-rails-and-git/ this has worked in Dreamhost's case. Have not verified that Passenger will execute .bashrc before launching ruby.
Using .bashrc won't work, as the library path that Passenger uses is the one that Apache loads on boot. There is no way it would look at a user's directory as that would be a major security issue.
The environment.rb way sounds like the way to go, though you might want to append to LD_LIBRARY_PATH instead. Also I'd make sure to use the full path to that directory just in case.
Alternatively you might be able to use .htaccess directives, similar to what is described # http://wiki.rubyonrails.org/rails/pages/HowToUseOracleWithFastCGI
This is an old thread, but for completeness this is how to achieve your goal:
Do not set the LD_LIBRARY_PATH if possible - it's horrendous.
As you do not have control over the environment that the Apache
user's environment, attempting to set a LD_LIBRARY_PATH env var per
the methods above will not work anyway.
Set the LDFLAGS environment variable with link and record path flags set prior to compiling the library files to set the correct search paths - e.g.:
export LDFLAGS="-L$HOME/opt/lib -R$HOME/opt/lib"
Once compiled, the files will have the correct links set to the relevant libraries. You can check this using the ldd command line tool - e.g.:
ldd /$HOME/your/custom/complied/library/file.so

Resources