『STAOI』G - Round 3 总结

本文讲述了在一场编程竞赛中的解题过程,涉及T1中寻找特定性质快速通过,T2使用深度优先搜索解决简单问题,T3利用Fibonacci数列和模运算求解复杂规律,最后提到T4的难度。

注:同步发表于洛谷

概述:120pts,rk348,发挥一般,未达到理想成绩。

T1 找性质,找完就过了(8 min AC)

#include<bits/stdc++.h>
using namespace std;
int m,x=1;
signed main()
{
	cin>>m;
	for(int i=1;i<=m;i++)
	{
		if(i%3==0)cout<<x<<' ',x++;
        else cout<<0<<' ';
	}
	return 0;
}

T2 一眼不会,没写

(可没想到数据那么水,一个DFS就过了)

T3 找规律,过了 $p \leqslant 5$ 和 $p=2$ 的部分分,20pts

#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,t,p,b[]={0,2,0,2,0,0},a[]={0,2,4,3,0,0,1,2,3,0,0,0,0,4,0,0,2,4,0,0};
inline int fib(int m)
{
	if(m<=2)return 1;
	int x=1,y=1;
	for(int i=3;i<=m;++i)swap(x,y),y+=x,x%=p,y%=p;
	return y%p;
}
inline int F(int n)
{
	int ans=0;
	for(int i=1;i<=n;++i)ans+=(fib(i)*fib(i))%p,ans%=p;
	return ans%p;
}
inline int sum(int n)
{
	int ans=0;
	for(int i=1;i<=n;++i)ans+=fib(i)*((F(i-2)+(fib(i)*fib(i))%p+fib(i))%p)%p,ans%=p;
	return ans%p;
}
signed main()
{
	scanf("%lld",&t);
	while(t--)
	{
		scanf("%lld%lld",&n,&p);
		if(p<3)
		{
			int x=0;
			printf("%lld\n",x);
		}
		else if(p==3)
		{
			int x=n%8;
			if(x==1)puts("2");
			else if(x==2)puts("1");
			else puts("0");
		}
		else if(p==4)
		{
			int x=n%6;
			printf("%lld\n",x[tai]);
		}
		else if(p==5)
		{
			int x=n%20;
			printf("%lld\n",x[mei]);
		}
		else printf("%lld\n",sum(n)%p);
	}
	return 0;
}

T4也不会,0pts

比赛分应该能上1200吧...... 

下载完后samba软件包怎么编译 openssl support zlib make[1]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt&#39; make[2]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt&#39; make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt&#39; make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt&#39; make[2]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt&#39; make[2]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/ibase/lua&#39; WARNING: skipping lua-examples -- package not selected make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/ibase/lua&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/package/gettext&#39; WARNING: skipping libintl -- package not selected make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/package/gettext&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/package/libiconv&#39; WARNING: skipping libiconv -- package not selected make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/package/libiconv&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/package/libtool&#39; WARNING: skipping libltdl -- package not selected make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/package/libtool&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/packages/opensource/libjson-c&#39; make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/packages/opensource/libjson-c&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/ibase/libubox&#39; make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/ibase/libubox&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/ibase/ubus&#39; make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/ibase/ubus&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/packages/private/usb_sync&#39; make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/packages/private/usb_sync&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/package/ncurses&#39; make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/package/ncurses&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/package/ncurses&#39; WARNING: skipping libncurses-dev -- package not selected make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/package/ncurses&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/package/ncurses&#39; WARNING: skipping libncurses-dev -- package not selected make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/package/ncurses&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/packages/opensource/util-linux&#39; make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/packages/opensource/util-linux&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/package/libreadline&#39; WARNING: skipping libreadline -- package not selected make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/package/libreadline&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/packages/opensource/samba&#39; make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/packages/opensource/samba&#39; make[2]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt&#39; make[1]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt&#39; zhihonghe@14b254839176:/data/red-round3/red-round3/Iplatform/build$ make PRODUCT_NAME=be220v1 iplatform_package/samba/clean V=s openssl support zlib make[1]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt&#39; make[2]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt&#39; make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt&#39; make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt&#39; make[2]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt&#39; make[2]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/packages/opensource/samba&#39; rm -f /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/stamp/.samba_installed rm -f /data/red-round3/red-round3/Iplatform/openwrt/bin/model_brcm_bcm490x-be220v1/packages/samba36-libs_* rm -f /data/red-round3/red-round3/Iplatform/openwrt/bin/model_brcm_bcm490x-be220v1/packages/samba36-server_* rm -f /data/red-round3/red-round3/Iplatform/openwrt/bin/model_brcm_bcm490x-be220v1/packages/samba36-client_* rm -f /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/packages/samba.list /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/host/packages/samba.list rm -rf /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25 make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/packages/opensource/samba&#39; make[2]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt&#39; make[1]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt&#39; zhihonghe@14b254839176:/data/red-round3/red-round3/Iplatform/build$ make PRODUCT_NAME=be220v1 iplatform_package/samba/compile V=s openssl support zlib make[1]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt&#39; make[2]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt&#39; make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt&#39; make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt&#39; make[2]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt&#39; make[2]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/ibase/lua&#39; WARNING: skipping lua-examples -- package not selected make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/ibase/lua&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/package/gettext&#39; WARNING: skipping libintl -- package not selected make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/package/gettext&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/package/libiconv&#39; WARNING: skipping libiconv -- package not selected make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/package/libiconv&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/package/libtool&#39; WARNING: skipping libltdl -- package not selected make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/package/libtool&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/packages/opensource/libjson-c&#39; make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/packages/opensource/libjson-c&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/ibase/libubox&#39; make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/ibase/libubox&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/ibase/ubus&#39; make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/ibase/ubus&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/packages/private/usb_sync&#39; make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/packages/private/usb_sync&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/package/ncurses&#39; make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/package/ncurses&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/package/ncurses&#39; WARNING: skipping libncurses-dev -- package not selected make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/package/ncurses&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/package/ncurses&#39; WARNING: skipping libncurses-dev -- package not selected make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/package/ncurses&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/packages/opensource/util-linux&#39; make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/packages/opensource/util-linux&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/package/libreadline&#39; WARNING: skipping libreadline -- package not selected make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/package/libreadline&#39; make[3]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/packages/opensource/samba&#39; mkdir -p /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25 cp -fpR ./src/* /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25 touch /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/.prepared_b01c3156afc1b74183de4ac69cbb7e54 (cd /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/source3/; if [ -x ./configure ]; then /usr/bin/find /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/ -name config.guess | xargs -r chmod u+w; /usr/bin/find /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/ -name config.guess | xargs -r -n1 cp /data/red-round3/red-round3/Iplatform/openwrt/scripts/config.guess; /usr/bin/find /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/ -name config.sub | xargs -r chmod u+w; /usr/bin/find /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/ -name config.sub | xargs -r -n1 cp /data/red-round3/red-round3/Iplatform/openwrt/scripts/config.sub; AR=arm-buildroot-linux-gnueabi-ar AS="arm-buildroot-linux-gnueabi-gcc -c -DMAX_DEBUG_LEVEL=-1 -D__location__=\\\"\\\" -ffunction-sections -fdata-sections" LD=arm-buildroot-linux-gnueabi-ld NM=arm-buildroot-linux-gnueabi-nm CC="arm-buildroot-linux-gnueabi-gcc" GCC="arm-buildroot-linux-gnueabi-gcc" CXX="arm-buildroot-linux-gnueabi-g++" RANLIB=arm-buildroot-linux-gnueabi-ranlib STRIP=arm-buildroot-linux-gnueabi-strip OBJCOPY=arm-buildroot-linux-gnueabi-objcopy OBJDUMP=arm-buildroot-linux-gnueabi-objdump SIZE=arm-buildroot-linux-gnueabi-size CFLAGS=" -DMAX_DEBUG_LEVEL=-1 -D__location__=\\\"\\\" -ffunction-sections -fdata-sections " CXXFLAGS=" -DMAX_DEBUG_LEVEL=-1 -D__location__=\\\"\\\" -ffunction-sections -fdata-sections " CPPFLAGS="-I/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/usr/include -I/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/include -I/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/usr-be220v1/include -I/data/red-round3/red-round3/Iplatform/openwrt/../../bcm504L04/toolchain/opt/toolchains/crosstools-arm_softfp-gcc-10.3-linux-4.19-glibc-2.32-binutils-2.36.1/usr/include " LDFLAGS="-L/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/usr/lib -L/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/lib -Wl,-rpath-link,/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/usr/lib -L/data/red-round3/red-round3/Iplatform/openwrt/../../bcm504L04/toolchain/opt/toolchains/crosstools-arm_softfp-gcc-10.3-linux-4.19-glibc-2.32-binutils-2.36.1/usr/lib -L/data/red-round3/red-round3/Iplatform/openwrt/../../bcm504L04/toolchain/opt/toolchains/crosstools-arm_softfp-gcc-10.3-linux-4.19-glibc-2.32-binutils-2.36.1/lib -Wl,--gc-sections -lubox -lubus -lifaddrs " ac_cv_lib_attr_getxattr=no ac_cv_search_getxattr=no ac_cv_file__proc_sys_kernel_core_pattern=yes libreplace_cv_HAVE_C99_VSNPRINTF=yes libreplace_cv_HAVE_IFACE_IFCONF=yes libreplace_cv_HAVE_GETADDRINFO=yes LINUX_LFS_SUPPORT=yes samba_cv_CC_NEGATIVE_ENUM_VALUES=yes samba_cv_HAVE_GETTIMEOFDAY_TZ=yes samba_cv_HAVE_IFACE_IFCONF=yes samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes samba_cv_HAVE_SECURE_MKSTEMP=yes samba_cv_HAVE_WRFILE_KEYTAB=no samba_cv_USE_SETREUID=yes samba_cv_USE_SETRESUID=yes samba_cv_have_setreuid=yes samba_cv_have_setresuid=yes ac_cv_header_zlib_h=no samba_cv_zlib_1_2_3=no ./configure --target=arm-openwrt-linux-uclibc --host=arm-openwrt-linux-uclibc --build=x86_64-linux-gnu --program-prefix="" --program-suffix="" --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --sysconfdir=/etc --datadir=/usr/share --localstatedir=/var --mandir=/usr/man --infodir=/usr/info --disable-nls --exec-prefix=/usr --prefix=/ --disable-avahi --disable-cups --disable-pie --disable-relro --disable-static --disable-swat --enable-shared-libs --with-codepagedir=/etc/samba --with-configdir=/etc/samba --with-included-iniparser --with-included-popt --with-lockdir=/var/lock --with-logfilebase=/var/log --with-nmbdsocketdir=/var/nmbd --with-piddir=/var/run --with-privatedir=/etc/samba --with-sendfile-support --without-acl-support --without-cluster-support --without-ads --without-krb5 --without-ldap --without-pam --without-winbind --without-libtdb --without-libtalloc --without-libnetapi --without-libsmbsharemodes --without-libtevent --without-libaddns --with-shared-modules=pdb_tdbsam,pdb_wbc_sam,idmap_nss,nss_info_template,auth_winbind,auth_wbc,auth_domain ; fi; ) rm -f /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/.configured_* touch /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/.configured_ CFLAGS=" -DMAX_DEBUG_LEVEL=-1 -D__location__=\\\"\\\" -ffunction-sections -fdata-sections -I/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/usr/include -I/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/include -I/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/usr-be220v1/include -I/data/red-round3/red-round3/Iplatform/openwrt/../../bcm504L04/toolchain/opt/toolchains/crosstools-arm_softfp-gcc-10.3-linux-4.19-glibc-2.32-binutils-2.36.1/usr/include " CXXFLAGS=" -DMAX_DEBUG_LEVEL=-1 -D__location__=\\\"\\\" -ffunction-sections -fdata-sections -I/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/usr/include -I/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/include -I/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/usr-be220v1/include -I/data/red-round3/red-round3/Iplatform/openwrt/../../bcm504L04/toolchain/opt/toolchains/crosstools-arm_softfp-gcc-10.3-linux-4.19-glibc-2.32-binutils-2.36.1/usr/include " LDFLAGS="-L/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/usr/lib -L/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/lib -Wl,-rpath-link,/data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/usr/lib -L/data/red-round3/red-round3/Iplatform/openwrt/../../bcm504L04/toolchain/opt/toolchains/crosstools-arm_softfp-gcc-10.3-linux-4.19-glibc-2.32-binutils-2.36.1/usr/lib -L/data/red-round3/red-round3/Iplatform/openwrt/../../bcm504L04/toolchain/opt/toolchains/crosstools-arm_softfp-gcc-10.3-linux-4.19-glibc-2.32-binutils-2.36.1/lib -Wl,--gc-sections -lubox -lubus -lifaddrs " make -j1 -C /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/source3 AR=arm-buildroot-linux-gnueabi-ar AS="arm-buildroot-linux-gnueabi-gcc -c -DMAX_DEBUG_LEVEL=-1 -D__location__=\\\"\\\" -ffunction-sections -fdata-sections" LD=arm-buildroot-linux-gnueabi-ld NM=arm-buildroot-linux-gnueabi-nm CC="arm-buildroot-linux-gnueabi-gcc" GCC="arm-buildroot-linux-gnueabi-gcc" CXX="arm-buildroot-linux-gnueabi-g++" RANLIB=arm-buildroot-linux-gnueabi-ranlib STRIP=arm-buildroot-linux-gnueabi-strip OBJCOPY=arm-buildroot-linux-gnueabi-objcopy OBJDUMP=arm-buildroot-linux-gnueabi-objdump SIZE=arm-buildroot-linux-gnueabi-size CROSS="arm-buildroot-linux-gnueabi-" ARCH="arm" DYNEXP= PICFLAG= MODULES= ; make[4]: Entering directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/source3&#39; make[4]: *** No targets specified and no makefile found. Stop. make[4]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/source3&#39; Makefile:221: recipe for target &#39;/data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/.built&#39; failed make[3]: *** [/data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/samba-3.6.25/.built] Error 2 make[3]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/packages/opensource/samba&#39; package/Makefile:133: recipe for target &#39;package/feeds/iplatform/samba/compile&#39; failed make[2]: *** [package/feeds/iplatform/samba/compile] Error 2 make[2]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt&#39; /data/red-round3/red-round3/Iplatform/openwrt/include/toplevel.mk:184: recipe for target &#39;package/samba/compile&#39; failed make[1]: *** [package/samba/compile] Error 2 make[1]: Leaving directory &#39;/data/red-round3/red-round3/Iplatform/openwrt&#39; Makefile:234: recipe for target &#39;iplatform_package/samba/compile&#39; failed make: *** [iplatform_package/samba/compile] Error 2
11-02
<think>我们遇到了Samba编译失败的问题。从日志中可以看出,在进入source3目录后,make报错:*** No targets specified and no makefile found. Stop. 这表明在source3目录下没有找到Makefile文件,因此无法继续编译。 ### 失败原因分析 1. **配置阶段未成功生成Makefile**: 在`configure`步骤中可能因缺失依赖或配置参数错误,导致未生成Makefile。 - 关键线索:日志中`configure`命令包含`--without-libtdb`等参数,但Samba 3.6需要内建tdb/talloc支持 - 错误参数:`ac_cv_header_zlib_h=no`显示zlib头文件未被找到,但Samba需要zlib支持 2. **依赖缺失**: 从WARNING信息可见多个依赖包未选择(如libjson-c、libintl等),但最关键的是: - `ac_cv_header_zlib_h=no` → zlib开发包未安装 - `ac_cv_lib_attr_getxattr=no` → libattr未安装 3. **交叉编译环境问题**: 工具链路径可能未正确设置,导致无法找到交叉编译的zlib/openssl ### 解决方案 #### 步骤1:安装必需依赖 在编译主机上安装zlib和openssl的开发包: ```bash # Ubuntu/Debian sudo apt install zlib1g-dev libssl-dev ``` #### 步骤2:修正OpenWrt编译配置 进入OpenWrt配置菜单,确保启用: ```bash make menuconfig ``` 定位到: ``` Libraries ---> [*] zlib [*] libopenssl [*] libattr ``` #### 步骤3:修改Samba的编译参数 编辑`feeds/iplatform/samba/Makefile`,修正配置参数: ```makefile # 删除以下禁用参数: --without-libtdb \ --without-libtalloc \ --without-libtevent \ # 改为启用内置支持(Samba 3.6需要): --with-libtdb=internal \ --with-libtalloc=internal \ --with-libtevent=internal \ # 添加zlib和openssl支持: --with-zlib \ --with-openssl \ ``` #### 步骤4:清除并重新编译 ```bash make package/feeds/iplatform/samba/clean make package/feeds/iplatform/samba/compile V=s ``` ### 配置参数修正示例 原错误参数: ```bash ... --without-libtdb --without-libtalloc ... ac_cv_header_zlib_h=no ... ``` 修正后应包含: ```bash ... \ --with-libtdb=internal \ --with-libtalloc=internal \ --with-libtevent=internal \ ac_cv_header_zlib_h=yes \ ac_cv_lib_z_inflate=yes \ ... ``` > 💡 **注意**:Samba 3.6版本必须使用内置tdb/talloc,强制禁用会导致Makefile生成失败 §§相关问题§§ 1. 如何在OpenWrt的menuconfig中查找并启用zlib支持? 2. 交叉编译时如何确认工具链的zlib开发文件已正确安装? 3. Samba编译时出现"No targets specified and no makefile found"通常有哪些原因? 4. 如何为OpenWrt软件包添加缺失的依赖库声明? </think>根据编译失败日志,核心问题是 `make` 在 `source3` 目录中无法找到 Makefile 文件(`No targets specified and no makefile found`),这通常由配置步骤失败引起。以下是完整解决方案: ### 失败原因分析 1. **配置脚本未生成 Makfile** `configure` 脚本执行后应有 `Makefile` 生成,但日志中缺少成功提示 2. **关键依赖缺失** `ac_cv_header_zlib_h=no` 表明 zlib 头文件未被检测到 `samba_cv_zlib_1_2_3=no` 显示 zlib 版本不符要求 3. **OpenSSL 支持未启用** 编译参数中缺少 `--with-openssl` 选项 4. **交叉编译环境问题** `-I` 和 `-L` 路径可能未正确指向工具链的 zlib/openssl ### 完整解决步骤 #### 1. 验证依赖安装 ```bash # 检查 zlib 开发包 ls /data/red-round3/.../toolchain/usr/include/zlib.h # 检查 OpenSSL 开发包 ls /data/red-round3/.../toolchain/usr/include/openssl/ssl.h ``` #### 2. 修正配置参数 编辑 Samba 的 OpenWrt Makefile(`packages/opensource/samba/Makefile`),修改配置段: ```makefile # 启用 OpenSSL 支持 CONFIGURE_ARGS += \ --with-openssl \ --with-libssl-dir=$(STAGING_DIR)/usr \ ac_cv_header_zlib_h=yes \ samba_cv_zlib_1_2_3=yes \ LIBS="-lz -lssl -lcrypto" ``` #### 3. 添加头文件路径 在编译参数中显式指定路径: ```diff CFLAGS=" ... \ + -I$(STAGING_DIR)/usr/include/zlib \ + -I$(STAGING_DIR)/usr/include/openssl \ " ``` #### 4. 完整清理后重编译 ```bash # 彻底清理 make iplatform_package/samba/clean V=s rm -rf build_dir/target-*/samba-* # 重新下载源码 make iplatform_package/samba/download V=s # 带调试信息编译 make PRODUCT_NAME=be220v1 iplatform_package/samba/compile V=s 2>&1 | tee build.log ``` #### 5. 验证配置结果 编译前检查生成文件: ```bash ls -l build_dir/target-*/samba-*/source3/Makefile grep -r "HAVE_OPENSSL" build_dir/target-*/samba-*/config.h ``` ### 关键错误排查点 1. 查看 `config.log` 文件: ```bash nano build_dir/target-*/samba-*/config.log ``` - 搜索 `zlib.h` 和 `SSL_library_init` 的检测结果 2. 手动测试头文件: ```bash arm-buildroot-linux-gnueabi-gcc -E - \ -I$(STAGING_DIR)/usr/include \ - <<< &#39;#include <zlib.h>&#39; ``` 3. 检查工具链环境: ```bash echo $PATH arm-buildroot-linux-gnueabi-gcc -v ``` > 💡 **注意**:OpenWrt 编译需确保 `zlib` 和 `openssl` 已在 `menuconfig` 中选中: > ``` > Libraries ---> > [*] zlib > [*] openssl > ```
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值