DJGPP Cross Compiler 12.2.0 Fails to Recognize Parameters in FFmpeg Source Code
eltoneo opened this issue · 0 comments
RE: FFMPEG_VERSION="4.4"
DJGPP Cross Compiler 12.2.0
link
"DJGPP Cross Compiler 12.2.0 Fails to Recognize Parameters in FFmpeg Source Code"
Hi,
I am using the DJGPP cross compiler 12.2.0, to build the FFmpeg source code, and it's failing to recognize certain parameters and the script I used to download and build FFmpeg source code follows:
`
#!/usr/bin/env bash
Path to DJGPP cross compiler
export DJGPP_PREFIX="/Users/owner/djcc"
export DJGPP_PREFIX=${DJGPP_PREFIX-/Users/owner/djcc}
export DJGPP_PREFIX2=${DJGPP_PREFIX2-/Users/owner/ffcc}
export
DJGPP_PREFIX3=${DJGPP_PREFIX3-/Users/owner/Documents/DOSBox/NET/watt}
system path
export PATH="$DJGPP_PREFIX/bin:$PATH"
Your cross compilation target
TARGET_ARCH="$DJGPP_PREFIX/bin/i586-pc-msdosdjgpp"
set C_INCLUDE_PATH environment variable
export C_INCLUDE_PATH="#DJGPP_PREFIX/i586-pc-msdosdjgpp/sys-include"
Download FFmpeg source code
FFMPEG_VERSION="4.4"
FFMPEG_ARCHIVE="https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz"
FFMPEG_SOURCE_DIR="ffmpeg-${FFMPEG_VERSION}"
Download FFmpeg source
echo "Downloading FFmpeg source..."
wget -c "$FFMPEG_ARCHIVE" || exit 1
tar -xf "ffmpeg-${FFMPEG_VERSION}.tar.gz" || exit 1
cd "$FFMPEG_SOURCE_DIR" || exit 1
clean debri
gmake clean
Redirect both stdout and stderr to separate .err files
exec > >(tee -ia gcca.txt) 2> >(tee -ia gcc_err.err >&2)
Configure FFmpeg for cross-compilation
echo "Configuring FFmpeg for cross-compilation..."
./configure --enable-cross-compile
--prefix="$DJGPP_PREFIX2"
--target-os=ms-dos
--arch=i486
--cross-prefix="$TARGET_ARCH-"
--extra-cflags="-I$DJGPP_PREFIX/i586-pc-msdosdjgpp/sys-include -I$DJGPP_PREFIX/include -I$DJGPP_PREFIX3/inc2 -I$DJGPP_PREFIX3/inc3"
--extra-ldflags="-L$DJGPP_PREFIX/i586-pc-msdosdjgpp/lib -L$DJGPP_PREFIX/lib -L$DJGPP_PREFIX3/lib2 -L$DJGPP_PREFIX3/lib3"
--enable-debug
--disable-shared
--enable-static
--disable-doc
--disable-programs
|| exit 1
Compile a hello world program for testing
echo "Compiling hello world program for testing..."
cat > helloai.c <<EOF
#include <stdio.h>
int main() {
printf("Hello, world!\n");
return 0;
}
EOF
"$TARGET_ARCH-gcc" helloai.c -o helloai || exit 1
Compile FFmpeg
echo "Compiling FFmpeg..."
gmake CC="$DJGPP_PREFIX/bin/i586-pc-msdosdjgpp-gcc" || exit 1
gmake install || exit 1
echo "Compilation complete."
`
The following 36 issues surfaced compiling FFmpeg DJGPP 'make' cross compile, stating, "error: declaration for parameter 'XX_XXXX_XX_XXXX' but no such parameter:".
-
'ff_log_net_error'
-
'ff_socket'
-
'ff_http_match_no_proxy'
-
'ff_listen_connect'
-
'ff_accept'
-
'ff_listen'
-
'ff_listen_bind'
-
'ff_is_multicast_address'
-
'ff_gai_strerror'
10)'ff_getnameinfo'
-
'ff_freeaddrinfo'
-
'ff_getaddrinfo'
-
'sockaddr_union'
-
'ff_network_sleep_interruptible'
-
'ff_network_wait_fd_timeout'
-
'ff_network_wait_fd'
-
'ff_tls_deinit'
-
'ff_tls_init'
-
'ff_network_close'
-
'ff_network_init'
-
'ff_socket_nonblock'
-
'ff_connect_parallel'
-
'ff_log_net_error'
-
'ff_socket'
-
'ff_http_match_no_proxy'
-
'ff_listen_connect'
-
'ff_accept'
-
'ff_listen'
29)'ff_listen_bind'
-
'ff_is_multicast_address'
-
'ff_gai_strerror'
-
'ff_getnameinfo'
-
'ff_freeaddrinfo'
-
'ff_getaddrinfo'
-
'sockaddr_union'
-
'ff_network_sleep_interruptible'
The 'no such parameter', observed in 'libavformat/network.h', has now shown up in
'/libavformat/avio.c':
libavformat/avio.c:57:23: error: declaration for parameter 'options' but no such parameter
libavformat/avio.c:64:15: error: declaration for parameter 'ffurl_context_class' but no such parameter
Therefore, please explain the root cause, since it appears unique to DJGPP cross compiler . . .
`
// libavformat/avio.c
#include "libavutil/avstring.h"
#include "libavutil/dict.h"
#include "libavutil/opt.h"
#include "libavutil/time.h"
#include "libavutil/avassert.h"
#include "os_support.h"
#include "avformat.h"
#include "internal.h"
#if CONFIG_NETWORK
#include "network.h"
#endif
#include "url.h"
/** @name Logging context. /
/@{*/
static const char *urlcontext_to_name(void *ptr)
{
URLContext *h = (URLContext *)ptr;
if (h->prot)
return h->prot->name;
else
return "NULL";
}
static void *urlcontext_child_next(void *obj, void *prev)
{
URLContext *h = obj;
if (!prev && h->priv_data && h->prot->priv_data_class)
return h->priv_data;
return NULL;
}
#define OFFSET(x) offsetof(URLContext,x)
#define E AV_OPT_FLAG_ENCODING_PARAM
#define D AV_OPT_FLAG_DECODING_PARAM
static const AVOption options[] = { // L57:23
{"protocol_whitelist", "List of protocols that are allowed to be used", OFFSET(protocol_whitelist), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D },
{"protocol_blacklist", "List of protocols that are not allowed to be used", OFFSET(protocol_blacklist), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D },
{"rw_timeout", "Timeout for IO operations (in microseconds)", offsetof(URLContext, rw_timeout), AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, INT64_MAX, AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_DECODING_PARAM },
{ NULL }
};
const AVClass ffurl_context_class = { // L64:15
.class_name = "URLContext",
.item_name = urlcontext_to_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
.child_next = urlcontext_child_next,
#if FF_API_CHILD_CLASS_NEXT
.child_class_next = ff_urlcontext_child_class_next,
#endif
.child_class_iterate = ff_urlcontext_child_class_iterate,
};
/@}/
`
It seems like the declarations for the ffurl_context_class variable are consistent across multiple files in the libavformat library. The declarations specify that ffurl_context_class is defined externally in url.h, and then it's implemented in avio.c and referenced in aviobuf.c.
Given that the code compiles without issues using the macOS Monterey clang compiler, but encounters problems with the DJGPP cross compiler, giving credence to this post, THX!