Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DJGPP Cross Compiler 12.2.0 Fails to Recognize Parameters in FFmpeg Source Code #51

Open
eltoneo opened this issue Feb 25, 2024 · 0 comments

Comments

@eltoneo
Copy link

eltoneo commented Feb 25, 2024

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:".

  1. 'ff_log_net_error'

  2. 'ff_socket'

  3. 'ff_http_match_no_proxy'

  4. 'ff_listen_connect'

  5. 'ff_accept'

  6. 'ff_listen'

  7. 'ff_listen_bind'

  8. 'ff_is_multicast_address'

  9. 'ff_gai_strerror'

10)'ff_getnameinfo'

  1. 'ff_freeaddrinfo'

  2. 'ff_getaddrinfo'

  3. 'sockaddr_union'

  4. 'ff_network_sleep_interruptible'

  5. 'ff_network_wait_fd_timeout'

  6. 'ff_network_wait_fd'

  7. 'ff_tls_deinit'

  8. 'ff_tls_init'

  9. 'ff_network_close'

  10. 'ff_network_init'

  11. 'ff_socket_nonblock'

  12. 'ff_connect_parallel'

  13. 'ff_log_net_error'

  14. 'ff_socket'

  15. 'ff_http_match_no_proxy'

  16. 'ff_listen_connect'

  17. 'ff_accept'

  18. 'ff_listen'

29)'ff_listen_bind'

  1. 'ff_is_multicast_address'

  2. 'ff_gai_strerror'

  3. 'ff_getnameinfo'

  4. 'ff_freeaddrinfo'

  5. 'ff_getaddrinfo'

  6. 'sockaddr_union'

  7. '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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant