FFmpeg-iOS-build-script icon indicating copy to clipboard operation
FFmpeg-iOS-build-script copied to clipboard

C compiler cannot create executables

Open Vetagiri-Hrushikesh opened this issue 4 years ago • 8 comments

Iam running with this problem in i386 when I build the given script. Can anyone help me.

building i386...

configure:3656: $? = 0
configure:3645: /usr/bin/gcc -V >&5
clang: error: argument to '-V' is missing (expected 1 value)
clang: error: no input files
configure:3656: $? = 1
configure:3645: /usr/bin/gcc -qversion >&5
clang: error: unknown argument '-qversion'; did you mean '--version'?
clang: error: no input files
configure:3656: $? = 1
configure:3676: checking whether the C compiler works
configure:3698: /usr/bin/gcc -arch i386 -mios-simulator-version-min=5.0 -fembed-bitcode  -arch i386 -mios-simulator-version-min=5.0 -fembed-bitcode conftest.c  >&5
clang: warning: using sysroot for 'MacOSX' but targeting 'iPhone' [-Wincompatible-sysroot]
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd, missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd (3 slices)
Undefined symbols for architecture i386:
  "start", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:3702: $? = 1
configure:3740: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "lame"
| #define PACKAGE_TARNAME "lame"
| #define PACKAGE_VERSION "3.100"
| #define PACKAGE_STRING "lame 3.100"
| #define PACKAGE_BUGREPORT "[email protected]"
| #define PACKAGE_URL ""
| #define PACKAGE "lame"
| #define VERSION "3.100"
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:3745: error: in `/Users/mac/Desktop/Organize/Personal/MaighaCom/TestingSources/maiSources/ffmpeg_build/platforms/ffmpeg_build_ios/scratch-lame/i386':
configure:3747: error: C compiler cannot create executables
See `config.log' for more details

Vetagiri-Hrushikesh avatar May 09 '21 17:05 Vetagiri-Hrushikesh

Do you really need i386? Are you building it for iOS?

kewlbear avatar May 09 '21 23:05 kewlbear

Do you really need i386? Are you building it for iOS?

Actually I used your lame script then I got this. I also added the flags mentioned here. Can you please help me with this. After compiling the lame script, It ends here while compiling ffmpeg-ios

building i386...
ERROR: libmp3lame >= 3.98.3 not found

Thank you

Here is the Lame Script


COMPILE="y"
LIPO="y"

if [ "$*" ]
then
	if [ "$*" = "lipo" ]
	then
		# skip compile
		COMPILE=
	else
		ARCHS="$*"
		if [ $# -eq 1 ]
		then
			# skip lipo
			LIPO=
		fi
	fi
fi

if [ "$COMPILE" ]
then
	CWD=`pwd`
	for ARCH in $ARCHS
	do
		echo "building $ARCH..."
		mkdir -p "$SCRATCH/$ARCH"
		cd "$SCRATCH/$ARCH"

		if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]
		then
		    PLATFORM="iPhoneSimulator"
		    if [ "$ARCH" = "x86_64" ]
		    then
		    	SIMULATOR="-mios-simulator-version-min=7.0"
                        HOST=x86_64-apple-darwin
		    else
		    	SIMULATOR="-mios-simulator-version-min=5.0"
                        HOST=i386-apple-darwin
		    fi
		else
		    PLATFORM="iPhoneOS"
		    SIMULATOR=
                    HOST=arm-apple-darwin
		fi

		XCRUN_SDK=`echo $PLATFORM | tr '[:upper:]' '[:lower:]'`
		CC="xcrun -sdk $XCRUN_SDK clang -arch $ARCH"
		#AS="$CWD/$SOURCE/extras/gas-preprocessor.pl $CC"
		CFLAGS="-arch $ARCH $SIMULATOR"
		if ! xcodebuild -version | grep "Xcode [1-6]\."
		then
			CFLAGS="$CFLAGS -fembed-bitcode"
		fi
		CXXFLAGS="$CFLAGS"
		LDFLAGS="$CFLAGS"

		CC=$CC $CWD/$SOURCE/configure \
		    $CONFIGURE_FLAGS \
                    --host=$HOST \
		    --prefix="$THIN/$ARCH" \
                    CC="$CC" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS"

		make -j3 install
		cd $CWD
	done
fi

if [ "$LIPO" ]
then
	echo "building fat binaries..."
	mkdir -p $FAT/lib
	set - $ARCHS
	CWD=`pwd`
	cd $THIN/$1/lib
	for LIB in *.a
	do
		cd $CWD
		lipo -create `find $THIN -name $LIB` -output $FAT/lib/$LIB
	done

	cd $CWD
	cp -rf $THIN/$1/include $FAT
fi

And here is the ffmpeg-ios script


CONFIGURE_FLAGS="--enable-cross-compile --disable-debug --disable-programs --disable-audiotoolbox \
                 --disable-doc --enable-pic"

if [ "$X264" ]
then
	CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-gpl --enable-libx264"
fi

if [ "$FDK_AAC" ]
then
	CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-libfdk-aac --enable-nonfree"
fi


# avresample
CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-avresample"
CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-libmp3lame"

ARCHS="arm64 armv7 x86_64 i386"

COMPILE="y"
LIPO="y"

DEPLOYMENT_TARGET="8.0"

if [ "$*" ]
then
	if [ "$*" = "lipo" ]
	then
		# skip compile
		COMPILE=
	else
		ARCHS="$*"
		if [ $# -eq 1 ]
		then
			# skip lipo
			LIPO=
		fi
	fi
fi

if [ "$COMPILE" ]
then
	if [ ! `which yasm` ]
	then
		echo 'Yasm not found'
		if [ ! `which brew` ]
		then
			echo 'Homebrew not found. Trying to install...'
                        ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" \
				|| exit 1
		fi
		echo 'Trying to install Yasm...'
		brew install yasm || exit 1
	fi
	if [ ! `which gas-preprocessor.pl` ]
	then
		echo 'gas-preprocessor.pl not found. Trying to install...'
		(curl -L https://github.com/libav/gas-preprocessor/raw/master/gas-preprocessor.pl \
			-o /usr/local/bin/gas-preprocessor.pl \
			&& chmod +x /usr/local/bin/gas-preprocessor.pl) \
			|| exit 1
	fi

	CWD=`pwd`
	for ARCH in $ARCHS
	do
		echo "building $ARCH..."
		mkdir -p "$SCRATCH/$ARCH"
		cd "$SCRATCH/$ARCH"

		CFLAGS="-arch $ARCH"		
		# LDLAGS="-arch $ARCH"
		if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]
		then
		    PLATFORM="iPhoneSimulator"
		    CFLAGS="$CFLAGS -mios-simulator-version-min=$DEPLOYMENT_TARGET"
		else
		    PLATFORM="iPhoneOS"
		    CFLAGS="$CFLAGS -mios-version-min=$DEPLOYMENT_TARGET -fembed-bitcode"
		    if [ "$ARCH" = "arm64" ]
		    then
		        EXPORT="GASPP_FIX_XCODE5=1"
		    fi
		fi

		XCRUN_SDK=`echo $PLATFORM | tr '[:upper:]' '[:lower:]'`
		CC="xcrun -sdk $XCRUN_SDK clang"

		# force "configure" to use "gas-preprocessor.pl" (FFmpeg 3.3)
		if [ "$ARCH" = "arm64" ]
		then
		    AS="gas-preprocessor.pl -arch aarch64 -- $CC"
		else
		    AS="gas-preprocessor.pl -- $CC"
		fi

		CXXFLAGS="$CFLAGS"
		LDFLAGS="$CFLAGS"
		if [ "$X264" ]
		then
			CFLAGS="$CFLAGS -I$X264/include"
			LDFLAGS="$LDFLAGS -L$X264/lib"
		fi
		if [ "$FDK_AAC" ]
		then
			CFLAGS="$CFLAGS -I$FDK_AAC/include"
			LDFLAGS="$LDFLAGS -L$FDK_AAC/lib"
		fi

		TMPDIR=${TMPDIR/%\/} $SOURCE/configure \
		    --target-os=darwin \
		    --arch=$ARCH \
		    --cc="$CC" \
		    --as="$AS" \
		    $CONFIGURE_FLAGS \
		    --extra-cflags="$CFLAGS" \
			--extra-cflags="$CFLAGS -fembed-bitcode -I /Users/mac/Desktop/Organize/Personal/MaighaCom/TestingSources/maiSources/build_scripts/platforms/ios/fat-lame/include" \
		    --extra-ldflags="$LDFLAGS" \
			--extra-ldflags="$LDFLAGS -fembed-bitcode -L /Users/mac/Desktop/Organize/Personal/MaighaCom/TestingSources/maiSources/build_scripts/platforms/ios/fat-lame/lib" \
		    --prefix="$THIN/$ARCH" \
		|| exit 1

		make -j3 install $EXPORT || exit 1
		cd $CWD
	done
fi

if [ "$LIPO" ]
then
	echo "building fat binaries..."
	mkdir -p $FAT/lib
	set - $ARCHS
	CWD=`pwd`
	echo "================="
	echo $CWD
	echo "================="
	cd $THIN/$1/lib
	echo "================="
	echo `pwd`
	echo "================="
	for LIB in *.a
	do
		cd $CWD
		echo lipo -create `find $THIN -name $LIB` -output $FAT/lib/$LIB 1>&2
		lipo -create `find $THIN -name $LIB` -output $FAT/lib/$LIB || exit 1
	done

	cd $CWD
	cp -rf $THIN/$1/include $FAT
fi

echo Done

Vetagiri-Hrushikesh avatar May 10 '21 10:05 Vetagiri-Hrushikesh

  if [ "$X264" ]
  then
  	CFLAGS="$CFLAGS -I$X264/include"
  	LDFLAGS="$LDFLAGS -L$X264/lib"
  fi
  if [ "$FDK_AAC" ]
  then
  	CFLAGS="$CFLAGS -I$FDK_AAC/include"
  	LDFLAGS="$LDFLAGS -L$FDK_AAC/lib"
  fi

You have to add something like above for lame.

kewlbear avatar May 10 '21 23:05 kewlbear

I got it. But While building the lame script Iam unable to build for i386 architecture. Iam always ending with this. I guess ffmpeg-ios will build if this issue(while building i386 in lame) is resolved. Can you help me to build the lame properly.

Thank you

Vetagiri-Hrushikesh avatar May 11 '21 06:05 Vetagiri-Hrushikesh

Did you install command line tools? Can you share config.log?

kewlbear avatar May 12 '21 00:05 kewlbear

Did you install command line tools? Can you share config.log?

Yeah sure, This is my config.log while building i386 ( for lame script ), Others(arm64 armv7s x86_64 armv7) are running fine.

config.log

Vetagiri-Hrushikesh avatar May 12 '21 06:05 Vetagiri-Hrushikesh

I can reproduce it. Do you really need i386? If not, I think you'd better remove i386 from both lame and ffmpeg build scripts.

kewlbear avatar May 13 '21 07:05 kewlbear

I can reproduce it. Do you really need i386? If not, I think you'd better remove i386 from both lame and ffmpeg build scripts.

Yeah for now I did removed 1386 and compiled both the libraries and it is working fine. Thank you.

Vetagiri-Hrushikesh avatar May 13 '21 08:05 Vetagiri-Hrushikesh