Error when opening .tar.gz via Shell to install Apache Maven - shell

Machine:
Mac OSX 10.5.8 32-bit.
Goal:
To install apache maven per its websites instructions, in order to install the JUNG package according to its install instructions, so I can use the JUNG classes in various Java GUIs.
What I Did:
Downloaded a .tar.gz file, and using the shell, moved it to a directory (using mv) I created for it (using mkdir), usr/local/apache-maven per the website directions
I downloaded the file apache-maven-3.0.4-bin.tar.gz. Next I tried extracting the file using tar -zxvf apache-maven-3.0.4-bin.tar.gz.
Error:
I get an error message when I try to extract the apache-maven .gz (install?) file in shell.
tar: apache-maven-3.0.4/direcoryandfile: Cannot open: No such file or directory
...
apache-maven-3.0.4/lib/ext: Cannot mkdir: No such file or directory apache-maven-3.0.4/lib/ext/README.txt
tar: apache-maven-3.0.4/lib/ext/README.txt: Cannot open: No such file or directory tar:
Error exit delayed from previous errors
Instructions:
For the maven building
Extract the distribution archive, i.e. apache-maven-3.0.4-bin.tar.gz to the directory you wish to install Maven 3.0.4... The subdirectory apache-maven-3.0.4 will be created from the archive.
...
for the JUNG installation
Appendix: How to Build JUNG
Get Maven
Download and install maven2 from maven.apache.org: http://maven.apache.org/download.html. At time of writing (early June 2012), the latest version was maven-3.0.4. Install the downloaded maven2 (there are installation instructions on the Maven website).
Follow the installation instructions and confirm a successful installation by typing 'mvn --version' in a command terminal window.
Self-Rectification Attempts
From what I can tell the archive file is missing some directories or something. I tried deleting the file, redownloading the .tar.gz file from a different mirror and repeating the process. Same result. Thanks again for the help
Background:
I'm trying to install the JUNG package to my system's Java, so I can write object-oriented code using various GUIs (Ecliplse, Dr. Java) using the classes in JUNG. I don't understand how the building/installing process works, and how I can get what I build/install to work on various GUIs and the command line. I'm new to shell and the command line, and mostly have experience using a simple IDE (DrJava, Python IDLE, R GUI) to write and compile object-oriented code.

To unpack a tar.gz archive you need to do it either in two steps:
gunzip apache-maven-3.0.4.tar.gz
tar -xf apache-maven-3.0.4.tar
or you might try to do it in a single step:
tar -zxf apache-maven-3.0.4.tar.gz

Two Step Process:
1. Extract the .tar from the .tar.gz using gunzip, and -v for having gunzip print what its doing. gunzip -v apache-maven-3.0.4.tar.gz
2. Extract the .tar file using tar, -x for telling the program to do an extraction, -v for having tar print what its doing, and -f for tar to know that the following file is the archive and appending with sudo so tar has permission to create directories. sudo tar -xvf apache-maven-3.0.4.tar

Related

How to tell rpmbuild to use extracted folder instead of archive?

I installed a sources rpm for Linux kernel on Centos. And I need to make modifications to the kernel and build it. The kernel.spec file has the line that tells rpmbuild to get the sources to build from the archive file
Source0: linux-%{rpmversion}-%{pkgrelease}.tar.xz
The archive is in the typical location: ~/rpmbuild/SOURCES/linux-%{rpmversion}-%{pkgrelease}.tar.xz
I extracted the archive in the same directory, and that is ~/rpmbuild/SOURCES/linux-%{rpmversion}-%{pkgrelease}
How to tell rpmbuild to get the sources from the extracted version which has my changes and not from the archive?
I already tried the trivial solution to just remove ".tar.xz" extension, but that did not work:
error: File /root/rpmbuild/SOURCES/linux-3.10.0-957: Is a directory

Having trouble editing and executing .sh file in Cygwin

I am relatively new to the Cygwin program, and I have a .sh file that I need to edit and execute. I am currently running on Windows 10. I have installed Cygwin64 terminal on my machine.
The full list of steps required are as follows:
Be sure to have libtool installed.
Download protobuf from https://github.com/google/protobuf/ (download ZIP and unZIP at desired location, or clone the repo) The protocol buffer is used for communication between the CuraEngine and the GUI.
Before installing protobuf, change autogen.sh : comment line 18 to line 38 using #s. This removes the dependency on gtest-1.7.0.
Run autogen.sh from the protobuf directory: $ ./autogen.sh
$ ./configure
$ make
$ make install # Requires superused priviliges.
(In case the shared library cannot be loaded, you can try "sudo ldconfig" on Linux systems)
Once I get to 3.:
Before installing protobuf, change autogen.sh : comment line 18 to line 38 using #s. This removes the dependency on gtest-1.7.0.
I am having issues opening up to .sh file in Cygwin to make the appropriate edit.
When I try this command to even execute the .sh file:
$ '/cygdrive/c/Users/Thomas/Desktop/3D Printing/protobuf-master/autogen.sh'
I receive the error:
Could not find source code. Make sure you are running this script
from the root of the distribution tree.
If anyone has some insight as to a solution for this problem it would be greatly appreciated.
You are getting the error from this test in autogen.sh :
# Check that we're being run from the right directory.
if test ! -f src/google/protobuf/stubs/common.h; then
cat >&2 << __EOF__
Could not find source code. Make sure you are running this script from the
root of the distribution tree.
__EOF__
In this test, common.h path is relative to the protbuf install directory, just cd to it before executing the script.

Trying to get #include <gmpxx.h> to run in my program

In my code I'm getting a fatal error of :
fatal error: gmpxx.h: No such file or directory|
I'm trying to use the The GNU Multiple Precision Arithmetic Library, but I'm having trouble trying to get the library downloaded an working in the right place.
I download the file gmp=6.1.0.tar.lz but I have no idea how to open it, use it, or even where it needs to be placed.
I'm using Codeblocks, and a Windows 10 computer.
First, install some basic GNU utilities via MinGW. We need tar. Then, download a stable lzip release. Choose tarball not lzip archive, because we want to build lzip. Now, open your MSYS shell, go to directory made after extracting lzip tarball (this directory should be available as /c/<PATH ON C DRIVE WITH BACKSLASHES REPLACED WITH SLASHES>) and run:
./configure --prefix=/
make
make install
Then go up (cd ..) and run:
tar xvf gmp-6.1.0.tar.lz
It should extract this file. Now, build GMP by going to directory gmp-6.1.0 and running:
PATH="/c/Program Files/CodeBlocks/MinGW:$PATH" ./configure --prefix='/c/Program Files/CodeBlocks/MinGW'
on 32-bit system, or:
PATH="/c/Program Files (x86)/CodeBlocks/MinGW:$PATH" ./configure --prefix='/c/Program Files (x86)/CodeBlocks/MinGW' --enable-cxx
on 64-bit. Run these commands:
make
make install
You should have GMP installed.

How to unzip files in a Heroku Buildpack

I'm writing a custom Heroku buildpack (heroku-buildpack-fantom) for Fantom, and as part of the compile script I've downloaded a .zip file (from a language vendor), but how do I unzip it?
unzip is not a recognised command.
gunzip exists but I can't use it to unzip .zip files.
What am I missing?
Even though (by default) Linux does not come pre-installed with unzip, the Heroku dyno does have a jar command. So the following works okay:
> jar xf wotever.zip
Be sure to run the 'file' command on it. I got a .zip file from SourceForge that was actually bzip2 encoded and Heroku has both the bunzip2 decoder and the -j (--bzip2) option on tar to handle it.

What does /usr/sbin/install really do?

I'm trying to install discount on my VPS which is based on Solaris and compiling works great after setting some environment variables but the install fails.
So I thought I'd do the install manually, but what does install really do? Is it simply a mv followed by a chmod? Is it magic? That error seems to show that it attempts to do a lot of searching for files all over?
Can I just copy the binary, library and header files as usual?
Googling "install" doesn't give me much relevant information so I appreciate any clarification I can get!
According to man install:
install [OPTION]... [-T] SOURCE DEST`
install [OPTION]... SOURCE... DIRECTORY
install [OPTION]... -t DIRECTORY SOURCE...
install [OPTION]... -d DIRECTORY...
In the first three forms, copy SOURCE to DEST or multiple SOURCE(s) to
the existing DIRECTORY, while setting permission modes and owner/group.
In the 4th form, create all components of the given DIRECTORY(ies).
As for the difference to using cp, according to install vs. cp; and mmap, install unlinks the existing file, creating a new one linked to the same spot.
This has the advantage that, if the file you're trying to overwrite is a currently running program, it can continue running, as the file being written is in fact in a new location, and the existing program code is still in the old one.
A cp simply tries to overwrite the existing file, which will fail if the file is locked due to being in use.
Further information
install Command

Resources