RPM build errors: ./configure: No such file or directory

osc build --local-package openSUSE_Tumbleweed x86_64 *.spec
报错
[ 1s] [174/175] keeping gcc-PIE-12-2.4
[ 1s] [175/175] keeping rpm-build-4.17.1-1.3
[ 1s] now finalizing build dir…
[ 1s] … running 01-add_abuild_user_to_trusted_group
[ 1s] … running 02-set_timezone_to_utc
[ 1s] … running 03-set-permissions-secure
[ 1s] … running 11-hack_uname_version_to_kernel_version
[ 2s] -----------------------------------------------------------------
[ 2s] I have the following modifications for mysql-connector-java.spec:
[ 2s] -----------------------------------------------------------------
[ 2s] ----- building mysql-connector-java.spec (user abuild)
[ 2s] -----------------------------------------------------------------
[ 2s] -----------------------------------------------------------------
[ 2s] + exec rpmbuild -ba --define ‘_srcdefattr (-,root,root)’ --nosignature --undefine _enable_debug_packages /home/abuild/rpmbuild/SOURCES/mysql-connector-java.spec
[ 2s] setting SOURCE_DATE_EPOCH=1663286400
[ 2s] Executing(%prep): /usr/bin/bash -e /var/tmp/rpm-tmp.VpLckP
[ 2s] + umask 022
[ 2s] + cd /home/abuild/rpmbuild/BUILD
[ 2s] + cd /home/abuild/rpmbuild/BUILD
[ 2s] + rm -rf mysql-connector-java-2.0.14
[ 2s] + /usr/bin/gzip -dc /home/abuild/rpmbuild/SOURCES/mysql-connector-java-2.0.14.tar.gz
[ 2s] + /usr/bin/tar -xof -
[ 2s] + STATUS=0
[ 2s] + ‘[’ 0 -ne 0 ‘]’
[ 2s] + cd mysql-connector-java-2.0.14
[ 2s] + /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
[ 2s] + RPM_EC=0
[ 2s] ++ jobs -p
[ 2s] + exit 0
[ 2s] Executing(%build): /usr/bin/bash -e /var/tmp/rpm-tmp.Chbmz1
[ 2s] + umask 022
[ 2s] + cd /home/abuild/rpmbuild/BUILD
[ 2s] + /usr/bin/rm -rf /home/abuild/rpmbuild/BUILDROOT/mysql-connector-java-2.0.14-1.x86_64
[ 2s] ++ dirname /home/abuild/rpmbuild/BUILDROOT/mysql-connector-java-2.0.14-1.x86_64
[ 2s] + /usr/bin/mkdir -p /home/abuild/rpmbuild/BUILDROOT
[ 2s] + /usr/bin/mkdir /home/abuild/rpmbuild/BUILDROOT/mysql-connector-java-2.0.14-1.x86_64
[ 2s] + cd mysql-connector-java-2.0.14
[ 2s] + ./configure
[ 2s] /var/tmp/rpm-tmp.Chbmz1: line 33: ./configure: No such file or directory
[ 2s] error: Bad exit status from /var/tmp/rpm-tmp.Chbmz1 (%build)
[ 2s]
[ 2s] RPM build errors:
[ 2s] Bad exit status from /var/tmp/rpm-tmp.Chbmz1 (%build)
[ 2s]
[ 2s] localhost.localdomain failed “build mysql-connector-java.spec” at Fri Sep 16 07:37:17 UTC 2022.

我的配置文件.spec
Name: MySQL-connector-java
Version: 2.0.14
Release: 1%{?dist}
Summary: A example about MySQL
License: GPL-3.0
Group: Development/Languages/Python
Url: mysql-Connector-J安装包下载_开源镜像站-阿里云
Source: mysql-connector-java-%{version}.tar.gz
BuildRequires: gcc
BuildRequires: cmake
BuildRoot: %{_tmppath}/%{name}-%{version}-build

%description
This tool serve for mysql

%prep
%setup -q -n %{name}-%{version}

%build
./configure

%install
make install DESTDIR="$RPM_BUILD_ROOT"

%files
%defattr(-,root,root)
%doc ChangeLog README COPYING

%changelog

@mst 你的 Source 指定的压缩包里没有 configure 这个文件。使用 autotools 编译的程序有时候不会提供这个,而是提供一个 autogen.sh 的脚本用于生成这些东西,所以你需要修改你的 spec,在 %configure 这行前面加上 ./autogen.sh(一般这步不写在 %build 里而是写在 %prep 的倒数几行里面。)%prep 这一阶段的作用是解压 Source,%build 这一阶段就是进入解压的文件夹里等候你 spec 里的进一步指令。

1赞

好的,我试试,谢谢你