Trying to make ruby-install on ubuntu 16.04 - ruby

I downloaded ruby-install version 0.6.1 and for some reason I get this make error:
*** No rule to make target 'install'. Stop.
What can I do to fix this?
deploy#blah:~$ sudo ls /root/
ruby-install-0.6.1 ruby-install.tar.gz
deploy#blah:~$ sudo make /root/ruby-install-0.6.1/ install
make: Nothing to be done for '/root/ruby-install-0.6.1/'.
make: *** No rule to make target 'install'. Stop.
Update
I went into the directory now:
root#blah:~/ruby-install-0.6.1# sudo make install
for dir in `find bin share -type d`; do mkdir -p /usr/local/$dir; done
for file in `find bin share -type f`; do cp $file /usr/local/$file; done
mkdir -p /usr/local/share/doc/ruby-install-0.6.1
cp -r *.md *.txt /usr/local/share/doc/ruby-install-0.6.1/
Did this work?

You need to cd into the directory, not pass the directory as an argument to make. E.g.
cd ruby-install-0.6.1
sudo make install

Related

CMAKE suppress error output for custom command?

I have a cmake command that looks like the following:
add_custom_command(
TARGET "uninstall"
POST_BUILD
COMMENT "Uninstall files within install_manifest.txt"
COMMAND sudo xargs rm -vf < install_manifest.txt || echo Nothing in install_manifest.txt to be uninstalled!
COMMAND cat install_manifest.txt | xargs -L1 dirname | sudo xargs rmdir --ignore-fail-on-non-empty -p
COMMAND echo
)
which has the goal of uninstalling files that were installed as part of the package.
The line
COMMAND sudo xargs rm -vf < install_manifest.txt || echo Nothing in install_manifest.txt to be uninstalled! is to remove the individual files that were installed, and COMMAND cat install_manifest.txt | xargs -L1 dirname | sudo xargs rmdir --ignore-fail-on-non-empty -p was to clear up the empty directories left behind.
Unfortunately, when I run the make uninstall I see the following near the end:
rmdir: failed to remove '/usr/local/include/palisade/pke': No such file or directory
rmdir: failed to remove '/usr/local/include/palisade/binfhe': No such file or directory
rmdir: failed to remove '/usr/local/include/palisade/binfhe': No such file or directory
rmdir: failed to remove '/usr/local/include/palisade/binfhe': No such file or directory
rmdir: failed to remove '/usr/local/include/palisade/binfhe': No such file or directory
rmdir: failed to remove '/usr/local/include/palisade/binfhe': No such file or directory
rmdir: failed to remove '/usr/local/include/palisade/binfhe': No such file or directory
make[3]: *** [CMakeFiles/uninstall.dir/build.make:72: uninstall] Error 123
make[2]: *** [CMakeFiles/Makefile2:334: CMakeFiles/uninstall.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:341: CMakeFiles/uninstall.dir/rule] Error 2
make: *** [Makefile:183: uninstall] Error 2
which I want to avoid. If I had to guess, the issue comes about because as rmdir is deleting folders, it is deleting their parents which means that for some other files which are along the same branch, it cannot access the empty folders there which is causing the errors. Does anyone know how I might address this? I don't want to propagate those errors to the user because for all intents and purposes it shouldn't matter to them
It will happen because the CMake command "add_custom_command" will halt execution if any of its COMMAND gives error (non-zero error code).
One workaround is to make sure that the command always succeeds by using "echo"
(some_shell_command || echo "")
For your example code :
add_custom_command(
TARGET "uninstall"
POST_BUILD
COMMENT "Uninstall files within install_manifest.txt"
COMMAND sudo xargs rm -vf < install_manifest.txt || echo Nothing in install_manifest.txt to be uninstalled!
COMMAND cat install_manifest.txt | xargs -L1 dirname | sudo xargs rmdir --ignore-fail-on-non-empty -p || echo ""
COMMAND echo
)
might work

Which module do I need when I got error info "Can't locate getopts.pl in #INC..."

I run this command in my macOS
$ perl ~/Desktop/blif2cnf.pl
and got this error info:
Can't locate getopts.pl in #INC (#INC contains: /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.2 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level /System/Library/Perl/Extras/5.18 .) at /Users/Frank/Desktop/blif2cnf.pl line 10.
In my linux 16.04, such problem can be solved by following this answer
Is there a module like libperl4-corelibs-perl in macOS?
I know CPAN, but I don't know which module should I install.
It's Perl4::CoreLibs. In general the Debian package libthis-that-perl corresponds to a module named This::That, although it's up to you to figure out the capitalization :)
I'm not sure how the package manager works with macOS, but a platform-independent way of installing the getopts package.
To answer the question you put as a comment to the answer from #hobbs, the way I searche for a module I need is either through the site that #hobbs linked, https://metacpan.org, or, alternatively, http://search.cpan.org. It was at the second that I found what I needed.
Searching for getopts.pl gave a link to "Perl4::CoreLibs". In the upper-right-hand corner, there was a link that said Perl4-CoreLibs-0.003.tar.gz (though it looks like there is a 0.004 now). I right-clicked and selected "copy link address", which gave me
http://search.cpan.org/CPAN/authors/id/Z/ZE/ZEFRAM/Perl4-CoreLibs-0.004.tar.gz
Whatever your link is, you'll need to untar it and find all the *.pl files in the lib directory into a directory, and either
1) Link to them from the command line, e.g.
perl -I /path/to/where/you/untarred/lib ~/Desktop/blif2cnf.pl
or
2) Add them to your PERLLIB environment variable.
I think that more details will be helpful.
Detailed Instructions
Figure out a directory where you want to download your *.pl files. I used $HOME/new_perl_stuff
cd ~
mkdir new_perl_stuff
cd new_perl_stuff
Now, get the tarball
wget http://search.cpan.org/CPAN/authors/id/Z/ZE/ZEFRAM/Perl4-CoreLibs-0.004.tar.gz
untar it, go into the directory, and make sure lib is there
$ tar -xzf Perl4-CoreLibs-0.004.tar.gz
$ cd Perl4-CoreLibs-0.004
$ ls
You should see lib in the list.
It's possible to add your newly downloaded lib directory (in my case, $HOME/new_perl_stuff/Perl4-CoreLibs-0.004/lib) to the perl search path, but this just makes me worry about another directory that I might delete at some time. I made a new folder in the /usr/lib directory. I decided to name the new directory libperl4-corelibs-perl, since that seemed standard. First, I checked to make sure that there wasn't already a directory with that name.
$ stat /usr/lib/libperl4-corelibs-perl
stat: cannot stat '/usr/lib/libperl4-corelibs-perl': No such file or directory
Then I made the directory.
mkdir /usr/lib/libperl4-corelibs-perl
The next step was copying all the *.pl files into this directory. I hope to explain this next command later. I ran it this way to make sure all of the files I needed were there. From my $HOME/new_perl_stuff/Perl4-CoreLibs-0.004 directory, I ran the following command, which I plan to come back and explain.
find ./lib -type f -name "*.pl" -print0 | xargs -I'{}' -0 \
bash -c 'new_dir=/usr/lib/libperl4-corelibs-perl/; chmod +x {}; \
echo "Moving {}"; mv {} ${new_dir} && echo -e "success\n" || \
echo -e "failure\n"' | tee moving_day.log
Run that one if you want to see that everything got copied successfully. A shorter command that does everything necessary is:
find ./lib -type f -name "*.pl" -print0 | xargs -I'{}' -0 \
bash -c 'new_dir=/usr/lib/libperl4-corelibs-perl/; chmod +x {}; \
mv {} ${new_dir}'
It's not a bad idea to run
ls -lah /usr/lib/libperl4-corelibs-perl
to check that the *.pl files are there.
You can now run
perl -I /usr/lib/libperl4-corelibs-perl ~/Desktop/blif2cnf.pl
but there's an easier way.
Finally, I made it so that this directory will become part of the perl search path every time I use a terminal by adding the following line to my ~/.bashrc
This command adds the path to the PERLLIB environment variable. Different flavors of Linux have different syntax for adding to environment variables, make sure to find out what yours is!
export PERLLIB="/usr/bin/libperl4-corelibs-perl:$PERLLIB"
The commands I ran for this were
$ echo -e "\n\n## allow Perl to use the files in Perl4::CoreLibs" >> $HOME/.bashrc
$ echo -e "export PERLLIB=\"/usr/lib/libperl4_corelibs_perl:$PERLLIB\"" >> $HOME/.bashrc
$ source .bashrc
Now, you can simply run
perl ~/Desktop/blif2cnf.pl
Note: It's probably a good idea to go back and remove unwanted extras:
rm -rf $HOME/new_perl_stuff

Locate libclang.so on OSX10.10?

I'm trying to make my YouCompleteMe work which is a vim auto-completion plugin.
I use
sudo find / -name "libclang.so" -print
to locate my libclang.so. I got result
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory
I'm wondering that does that mean there is no libclang.so on my mac?
After that I installed llvm-clang under my ~ directory following these commands:
cd ~/llvm-clang
svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
cd llvm/tools
svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
cd ../..
cd llvm/tools/clang/tools
svn co http://llvm.org/svn/llvm-project/clang-tools-extra/trunk extra
cd ../../../..
cd llvm/projects
svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
cd ../..
mkdir llvm-build
cd llvm-build/
cmake -G "Unix Makefiles" ../llvm
make
Everything worked fine so far.
However, I ran
sudo find / -name "libclang.so" -print
I got the same result.
Anyway, I don't know if this helps to make the question more clear:
$ sudo find / -name "llvm" -print
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory
/Library/Frameworks/Mono.framework/Versions/4.2.1/docs/llvm
/Library/Frameworks/Mono.framework/Versions/4.2.1/include/llvm
/Library/Frameworks/Mono.framework/Versions/4.2.1/share/llvm
/Users/yangyy/.vim/bundle/syntastic/syntax_checkers/llvm
/Users/yangyy/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/llvm
/Users/yangyy/llvm-clang/llvm
/Users/yangyy/llvm-clang/llvm/bindings/go/llvm
/Users/yangyy/llvm-clang/llvm/bindings/ocaml/llvm
/Users/yangyy/llvm-clang/llvm/bindings/python/llvm
/Users/yangyy/llvm-clang/llvm/include/llvm
/Users/yangyy/llvm-clang/llvm/tools/clang/tools/extra/clang-tidy/llvm
/Users/yangyy/llvm-clang/llvm/tools/clang/tools/extra/test/clang-tidy/Inputs/Headers/llvm
/Users/yangyy/llvm-clang/llvm-build/cmake/modules/CMakeFiles/Export/lib/cmake/llvm
/Users/yangyy/llvm-clang/llvm-build/include/llvm
/Users/yangyy/llvm-clang/llvm-build/lib/cmake/llvm
/Users/yangyy/llvm-clang/llvm-build/tools/clang/tools/extra/clang-tidy/llvm
/usr/share/file/magic/llvm
Where is the libclang.so?
Why there is no libclang.so after installing clang?
OSX uses .dylib for shared libraries, not .so.
With Xcode installed, I can find it with:
$ find /Applications/Xcode.app -name libclang.dylib
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib
Given it's in Xcode's default library directory, you should be able to link it in simply using -lclang if you use the Xcode command line tools.

./xsum: Permission denied make: *** [xsum.out] Error 126

I am trying to insall f2c/f77 compiler on mac osx using the instructions given http://www.webmo.net/support/fortran_osx.html and I get the following error :
./xsum: Permission denied
make: *** [xsum.out] Error 126
please help , as in installation it misses to create : /usr/local/bin/f2c
I followed the folowing :
chmod +x install_f2c_osx.csh
sudo ./install_f2c_osx.csh
PS : the install_f2c_osx.csh contains the following code :
`#! /bin/csh
setenv INSTALL /usr/local
curl "http://netlib.sandia.gov/cgi-bin/netlib/netlibfiles.tar?filename=netlib/f2c" -o "f2c.tar"
tar -xvf f2c.tar
gunzip -rf f2c/*
cd f2c
mkdir libf2c
mv libf2c.zip libf2c
cd libf2c
unzip libf2c.zip
cp makefile.u Makefile
make
cp f2c.h $INSTALL/include
cp libf2c.a $INSTALL/lib
cd ../src
cp makefile.u Makefile
make
cp f2c $INSTALL/bin
cd ..
mkdir -p $INSTALL/share/man/man1
cp f2c.1t $INSTALL/share/man/man1
cp fc $INSTALL/bin/f77
chmod +x $INSTALL/bin/f77
cd ..
rm -rf f2c
echo "==================SUMMARY=================="
echo $0 " has built and installed:"
find $INSTALL -name '*f2c*' -mmin -5
find $INSTALL -name '*f77*' -mmin -5
For me, #Steele's solution didn't work. Just to document this here: the second solution posted on Superuser actually worked for me, i.e. my xsum binary was not useable by the system, for some reason. In that case, delete the xsum binary that came with f2c and build your own using the xsum.c source. That is, edit the initial code to be:
#! /bin/csh
setenv INSTALL /usr/local
curl "http://netlib.sandia.gov/cgi-bin/netlib/netlibfiles.tar?filename=netlib/f2c" -o "f2c.tar"
tar -xvf f2c.tar
gunzip -rf f2c/*
cd f2c
mkdir libf2c
mv libf2c.zip libf2c
cd libf2c
unzip libf2c.zip
cp makefile.u Makefile
make
cp f2c.h $INSTALL/include
cp libf2c.a $INSTALL/lib
cd ../src
cp makefile.u Makefile
rm xsum #Added
cc -O xsum.c -o xsum #Added
chmod +x xsum #Added
make
cp f2c $INSTALL/bin
cd ..
mkdir -p $INSTALL/share/man/man1
cp f2c.1t $INSTALL/share/man/man1
cp fc $INSTALL/bin/f77
chmod +x $INSTALL/bin/f77
cd ..
rm -rf f2c
echo "==================SUMMARY=================="
echo $0 " has built and installed:"
find $INSTALL -name '*f2c*' -mmin -5
find $INSTALL -name '*f77*' -mmin -5

Prevent parent directories from being tarred

Basically I just want to tar all the files in a directory, but not get all the parent directories in the archive.
I've tried -C, but I guess I'm not using it right.
tar -cjf archive.tar.bz2 -C /var/some/log/path ./*
This results in tar trying to add all the files in the CWD. Using the full path as last argument doesn't prevent the dirs from being added.
Seems simple enough, but can't figure it out. Somehow tar does not tar ./* as being relative to -C, although it should change to that dir.
Help appreciated.
The parent directory (/var/some/log) is included, since /var/some/log/path/.. is included when you do ./*. Try just doing
tar -cjf archive.tar.bz2 -C /var/some/log/path .
Test run:
$ find tmp/some_files
tmp/some_files
tmp/some_files/dir1
tmp/some_files/dir1/dir1file
tmp/some_files/hello
tmp/some_files/world
tmp/some_files/dir2
tmp/some_files/dir2/dir2file
$ tar -cvjf archive.tar.bz2 -C tmp/some_files/ .
./
./dir1/
./dir1/dir1file
./hello
./world
./dir2/
./dir2/dir2file
$ cd tmp/unpacked
/tmp/unpacked$ mv /home/aioobe/archive.tar.bz2 .
/tmp/unpacked$ tar -xvjf archive.tar.bz2
./
./dir1/
./dir1/dir1file
./hello
./world
./dir2/
./dir2/dir2file
/tmp/unpacked$ ls
archive.tar.bz2 dir1 dir2 hello world
/tmp/unpacked$
There's a much easier way to do this:
cd down to the directory you wish to be top level, i.e...
cd /var/lib/mysql
Remove parent directories from your tar command
/var/lib/mysql/DATABASE_NAME becomes just DATABASE_NAME
More details can be found in this blog writeup.

Resources