How to tell rpmbuild to use extracted folder instead of archive? - linux-kernel

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

Related

Differences between RPM created with rpmbuild and Os-nebula-rpm plugin

I am trying to use the Nebula rpm plugin for Gradle to build RPMs. I am finding the following discrepancy between RPMs built this way and RPMs built the traditional way, with spec files and rpmbuild.
In a spec file, you might have something like this:
%dir /usr/local/myapp/logs
This would create the directory /usr/local/myapp/logs when the rpm is installed. Once myapp starts to run it would write logs to this directory. When the app is uninstalled, rpm would understand that the files under /usr/local/myapp/logs were not created by the rpm installation process and therefore not delete this directory or the files within it. If the directory were empty at the time of uninstallation, then the directory would be removed.
There is a similar directive with the Gradle plugin. If you include
directory('/usr/local/myapp/logs')
in the build script, this directory will be created similar to the rpm process. However, in this instance, when the rpm is uninstalled, the directory and any files that have been added within it since installation will be removed.
I am trying to account for this difference. The RPM plugin is based on the redline-rpm java package, and from looking at the source, and the usual RedHat rpm documentation, I cannot find any setting that governs this behavior.
Can anyone hazard a guess what might be going on here to create this difference in behavior?
Update: this post has some pretty good information on how this works, but I still don't know the name of any directive that alters this behavior.
Update 2 Now this starts to get very interesting. If I run rpm -evv myapp on the rpm built with the Gradle plugin, after installation, and after having added a file to /usr/local/myapp/logs, I see the following:
D: fini 040755 2 (7007, 500) 4096 /usr/local/myapp/logs
D: erase rmdir of /usr/local/myapp/logs failed: Directory not empty
and yet and still, after the operation is complete, the directory is gone!
How can this be? Could there be some configuration of the rpm executable itself that allows the deletion to take place?

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

Create tar archive with Cmake

I have used the *_OUTPUT_PATH variables in my CMakeLists.txt file to specify specific locations for my binaries and library files, and that seems to be working "automatically"
I would like as part of a "build" for one final step to happen, which is to create a tarball of the binaries that output directory.
What do I need to add to create a tar?
You can use a CMake custom target to invoke CMake in command mode and have it produce a tarball from the binaries in the output directory. Here is a CMakeLists.txt that sketches the necessary steps:
project(TarExample)
set (EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}/executables")
add_executable(foo foo.cpp)
add_custom_target(create_tar ALL COMMAND
${CMAKE_COMMAND} -E tar "cfvz" "executables.tgz" "${EXECUTABLE_OUTPUT_PATH}")
add_dependencies(create_tar foo)
The custom target generates a gzipped tarball from the files in the directory EXECUTABLE_OUTPUT_PATH. The add_dependencies call ensures that the tarball is created as a final step.
To produce an uncompressed tarball, use the option cfv instead of cfvz.

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

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

Resources