Electrob
Electrob

Reputation: 49

Building rpm - File not found by glob:

I want to generate an rpm package (Redhat) ,I get an error when i launched the command : rpmbuild -ba librabbitmq.spec

Processing files: librabbitmq1-0.10.0-0.x86_64 error: File not found by glob: /root/rpmbuild/BUILDROOT/librabbitmq-0.10.0-0.x86_64/usr/local/lib64/librabbitmq.so.1*

RPM build errors: File not found by glob: /root/rpmbuild/BUILDROOT/librabbitmq-0.10.0-0.x86_64/usr/local/lib64/librabbitmq.so.1*

How can correct the command install in the Makefile ? Any suggestions please .

MAKEFILE:

#Build a static library
NAME= librabbitmq.so
CC := gcc
CFLAGS := -Wall -g -DHAVE_POLL -DHAVE_SELECT -DHAVE_CONFIG_H
    
OBJDIR := obj
#definition des fichiers headers
INCLUDES := -I/usr/local/include/ -I/root/rpmbuild/SOURCES/librabbitmq-0.10.0 -I/root/rpmbuild/SOURCES/librabbitmq-0.10.0/unix
#definition des librairies
LFLAGS := -L/usr/local/lib64
LDFLAGS :=
LIBS := -L. -lpopt
SRCS_RAW := amqp_api.c amqp_connection.c amqp_consumer.c amqp_framing.c amqp_hostcheck.c amqp_mem.c amqp_openssl_bio.c amqp_openssl.c \
amqp_openssl_hostname_validation.c amqp_socket.c amqp_table.c amqp_tcp_socket.c amqp_time.c amqp_url.c 


OBJS := $(addprefix $(OBJDIR)/,$(SRCS_RAW:.c=.o))

.PHONY: all
all: $(NAME)
    @echo "$(MAKE) : Tout est genere"

$(NAME):$(OBJS)
    ar rcs $(NAME) $(OBJS) 
    ranlib $(NAME)

#règle pour créer un répertoire d'objets s'il n'existe pas
$(OBJDIR):
    mkdir $(OBJDIR)

#définir une règle implicite pour créer des objets dans leur propre répertoire
#(note - ordre uniquement la dépendance sur le répertoire d'objets)
# $<:premier_dependance $@:cible 
$(OBJS): $(OBJDIR)/%.o: %.c | $(OBJDIR)
    $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ 
    
prefix:=/usr/local
install: librabbitmq.so
    install -m 644 librabbitmq.so $(prefix)/lib64
.PHONY: install

.PHONY: clean
clean:
    $(RM) *~  $(NAME)
    $(RM) -r  $(OBJDIR)

SPEC FILE:

#
# spec file for package librabbitmq
#

%global sover   1
%global libname %{name}%{sover}
Name:           librabbitmq
Version:        0.10.0
Release:        0
Summary:        Amqp library in C
Source:         librabbitmq-0.10.0.tar.xz
# Some internal tests are licenced as GPL-3.0+ - they are only used in
# check phase and not shipped further
License:        LGPL-2.1-or-later
Group:          Development/Libraries/C and C++
Url:            https://github.com/alanxz/rabbitmq-c

%description
This is a C-language AMQP client library for use with v2.0+ of the RabbitMQ broker.


%package -n %{libname}
Summary:        Amqp library written in C
License:        LGPL-2.1-or-later
Group:          System/Libraries

%define _prefix   /usr/local
#%define _unpackaged_files_terminate_build 0

%description -n %{libname}
Shared library for %{name} (%{summary}).

%package devel
Summary:        Amqp library written in C
License:        LGPL-2.1-or-later
Group:          Development/Libraries/C and C++
Requires:       %{libname} = %{version}
Requires:       pkgconfig

%description devel
Headers, pkg-config files, so link and other development files for %{name}
(%{summary}).

%prep
%setup -q

%build
make 

%install
%make_install

%check

%post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig

%files -n %{libname}
%{_libdir}/%{name}.so.%{sover}*

%files devel
%doc CHANGELOG.md
%{_includedir}/rabbitmq.h
%{_libdir}/%{name}.so


%changelog

Upvotes: 2

Views: 1544

Answers (1)

Aaron D. Marasco
Aaron D. Marasco

Reputation: 6748

DON'T BUILD RPMS AS ROOT.

That said, your Makefile is bad, and you've now overwritten files all over your computer. Which is why you shouldn't build RPMs as root.

The Makefile needs to support the GNU-standard DESTDIR variable when calling make install. It likely has other problems, I didn't look much further than a search for the most common mistake.

Upvotes: 2

Related Questions