GCC Fails to Recognize Parameters

RE: ffmpeg-4.4
Andrew Wu DJGPP CROSS COMPILER, GCC v12.2.0
Host Macbook Pro, macOS Monterey

Click Here

DJGPP Cross Compiler 12.2.0 Fails to Recognize "certain" Parameters in FFmpeg Source Code
Hi,
I am using the DJGPP cross compiler 12.2.0, developed by Andrew Wu, github, to build the FFmpeg source code, and it's failing to recognize certain parameters and the script I used to 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

  11. ff_freeaddrinfo

  12. ff_getaddrinfo

  13. sockaddr_union

  14. ff_network_sleep_interruptible

  15. ff_network_wait_fd_timeout

  16. ff_network_wait_fd

  17. ff_tls_deinit

  18. ff_tls_init

  19. ff_network_close

  20. ff_network_init

  21. ff_socket_nonblock

  22. ff_connect_parallel

  23. ff_log_net_error

  24. ff_socket

  25. ff_http_match_no_proxy

  26. ff_listen_connect

  27. ff_accept

  28. ff_listen

  29. ff_listen_bind

  30. ff_is_multicast_address

  31. ff_gai_strerror

  32. ff_getnameinfo

  33. ff_freeaddrinfo

  34. ff_getaddrinfo

  35. sockaddr_union

  36. ff_network_sleep_interruptible`

The "no such parameter", observed in "libavformat/network.h", has now shown up in
"/libavformat/avio.c", giving credence to starting this thread:

`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`

// 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,
};
/*@}*/

Therefore, since this source code compiled like a charm on macOS Monterey, please explain the root cause, thanks?

X86 Assembly Help_value265

Hi,
I'm transitioning to assembly, starting with processor 8086.
The attached code is Masm 5 compatible and is a step up from Hello World, which linked and ran okay.
An endless loop exists, giving credence to this note.
Any comments or suggestions to resolve it would be appreciated, thanks!

.model small
.stack 100h
.data

name_prompt         db 'Enter your first name: $'
user_input          db 11, 0 ; Buffer for user's name (up to 10 characters + 1 null terminator)
range_prompt        db 'Enter the range of numbers (e.g., 0 to 10): $'
range_input         db 5, 0 ; Buffer for user's range input (up to 4 characters + 1 null terminator)
lower_bound         dw 0 ; Lower bound of the range
upper_bound         dw 0 ; Upper bound of the range
operand1            dw 0 ; First operand for flash card
operand2            dw 0 ; Second operand for flash card
correct_answer      dw 0 ; Correct answer for flash card
user_answer         db 0 ; User's answer for flash card
correct_count       db 0 ; Counter for correct answers
flash_card_prompt   db 'Flash Card: $'
correct_msg         db 'Correct!', 0Dh, 0Ah, '$'
incorrect_msg       db 'Incorrect!', 0Dh, 0Ah, '$'
result_prompt       db 'Number of Correct Answers: $'
hello_msg           db 'Hello World',0Dh, 0Ah, '$'
debug_msg           db 'Debug: ', 0
debug_end_msg       db 'Debug: End of Execution', 0

.code

 print_number proc
    ; Set DS to point to the data segment
    mov ax, @data
    mov ds, ax
        ; Display a number
        mov bx, 10 ; Set divisor to 10

        print_digit:
            xor dx, dx ; Clear any previous remainder
            div bx ; Divide AX by 10, result in AX, remainder in DX
            push dx ; Push the remainder onto the stack
            inc dl ; Convert the remainder to ASCII
            add dl, '0'
            mov ah, 02h ; DOS print character function
            int 21h ; Call DOS interrupt

            pop dx ; Pop the remainder from the stack
            cmp ax, 0 ; Check if quotient is zero
            jnz print_digit ; If not, continue the loop
            ret
    print_number endp

    generate_random_number proc
        ; Seed the random number generator
        mov ah, 2Ch ; DOS get system time function
        int 21h ; Call DOS interrupt
        xor ah, ah ; Clear AH
        mov cx, dx ; Use CX as the seed for the random number generator

        ; Generate a random number in the range [lower_bound, upper_bound]
        mov ax, cx ; Use AX to store the random number
        sub ax, [lower_bound]
        inc ax

        ; Move the upper_bound value into a register (BX)
        mov bx, [upper_bound]
        xor dx, dx
        div bx ; Divide AX by BX, result in AX, remainder in DX
        add ax, [lower_bound]
        ret
    generate_random_number endp

    clear_keyboard_buffer proc
        ; Clear the keyboard buffer
        mov ah, 0Ch ; DOS flush keyboard buffer function
        int 21h ; Call DOS interrupt
        ret
    clear_keyboard_buffer endp

main proc
    mov ax, @data
    mov ds, ax
    mov es, ax
    mov ss, ax

    ; Display prompt for user's name
    ; Set DS to point to the data segment
    mov ax, @data
    mov ds, ax
    mov ah, 09h         ; DOS print string function
    mov dx, offset name_prompt ; Offset of the message
    int 21h             ; Call DOS interrupt

    ; Read user's first name
    mov ah, 0Ah         ; DOS buffered input function
    lea dx, user_input  ; DX points to the buffer for input
    ; Set DS to point to the data segment
    mov ax, @data
    mov ds, ax
    int 21h             ; Call DOS interrupt

    ; Clear the keyboard buffer
    call clear_keyboard_buffer

    ; Display prompt for the range of numbers
    ; Set DS to point to the data segment
    mov ax, @data
    mov ds, ax
    mov ah, 09h         ; DOS print string function
    mov dx, offset range_prompt ; Offset of the message
    int 21h             ; Call DOS interrupt

    ; Read lower bound of the range
    mov ah, 0Ah         ; DOS buffered input function
    lea dx, range_input ; DX points to the buffer for input
    int 21h             ; Call DOS interrupt

    ; Convert ASCII input to integer (lower bound)
    mov al, [range_input + 2] ; ASCII character
    sub al, '0'               ; Convert ASCII to integer
    mov bl, 10                ; Multiplier for tens place
    mul bl                    ; Multiply AL by BL, result in AX
    mov [lower_bound], ax     ; Store the result

    ; Debug print for lower bound
    ; Set DS to point to the data segment
    mov ax, @data
    mov ds, ax
    mov ah, 09h ; DOS print string function
    mov dx, offset range_prompt ; Prompt for debug print
    int 21h ; Call DOS interrupt

    ; Set DS to point to the data segment
    mov ax, @data
    mov ds, ax
    mov ax, [lower_bound] ; Load lower_bound into AX
    call print_number ; Display the lower bound
    mov ah, 09h ; DOS print string function
    mov dx, offset debug_msg ; Debug message
    int 21h ; Call DOS interrupt

    ; Read upper bound of the range
    mov ah, 0Ah         ; DOS buffered input function
    lea dx, range_input ; DX points to the buffer for input
    int 21h             ; Call DOS interrupt

    ; Convert ASCII input to integer (upper bound)
    mov al, [range_input + 3] ; ASCII character for tens place
    sub al, '0'
    mov bl, 10
    mul bl                    ; Multiply AL by BL, result in AX
    mov bh, 0                 ; Clear BH
    mov bl, [range_input + 2] ; ASCII character for units place
    sub bl, '0'               ; Convert ASCII to integer
    add ax, bx                ; Add to result (upper bound)
    mov [upper_bound], ax     ; Store the result

    ; Debug print for upper bound
    ; Set DS to point to the data segment
    mov ax, @data
    mov ds, ax
    mov ah, 09h ; DOS print string function
    mov dx, offset range_prompt ; Prompt for debug print
    int 21h ; Call DOS interrupt

    ; Set DS to point to the data segment
    mov ax, @data
    mov ds, ax
    mov ax, [upper_bound] ; Load upper_bound into AX
    call print_number ; Display the upper bound
    mov ah, 09h ; DOS print string function
    mov dx, offset debug_msg ; Debug message
    int 21h ; Call DOS interrupt

    ; Preserve dx before calling generate_random_number
    push dx

    ; Generate random numbers in the specified range
    call generate_random_number   ; Call the generate_random_number procedure
    mov [operand1], ax

    call generate_random_number   ; Call the generate_random_number procedure
    mov [operand2], ax

    ; Restore dx after generate_random_number
    pop dx

    ; Generate and display flash cards
    mov cx, 10 ; Number of flash cards

    flash_cards_loop:
    ; Set DS to point to the data segment
    mov ax, @data
    mov ds, ax
        ; Add debug print to check loop iteration
        mov ah, 09h ; DOS print string function
        mov dx, offset debug_msg
        int 21h ; Call DOS interrupt

        mov ax, cx
        call print_number ; Display loop iteration number

        ; Generate random numbers in the specified range
        call generate_random_number   ; Call the generate_random_number procedure
        mov [operand1], ax

        call generate_random_number   ; Call the generate_random_number procedure
        mov [operand2], ax

        ; Display flash card
    ; Set DS to point to the data segment
    mov ax, @data
    mov ds, ax
        mov ah, 09h ; DOS print string function
        mov dx, offset flash_card_prompt
        int 21h ; Call DOS interrupt

        ; Display the first operand
        mov ax, [operand1]
        call print_number ; Display the operand

        ; Display operator (+ or -)
    ; Set DS to point to the data segment
    mov ax, @data
    mov ds, ax
        mov ah, 02h ; DOS print character function
        mov dl, '+'
        int 21h ; Call DOS interrupt

        ; Display the second operand
        mov ax, [operand2]
        call print_number ; Display the operand

        ; Display equals sign
    ; Set DS to point to the data segment
    mov ax, @data
    mov ds, ax
        mov ah, 02h ; DOS print character function
        mov dl, '='
        int 21h ; Call DOS interrupt

        ; Display the second operand
        mov ax, [operand2]
        call print_number;Display operand A2102 SYMBOL NOT DEFINED

        ; Display equals sign
    ; Set DS to point to the data segment
    mov ax, @data
    mov ds, ax
        mov ah, 02h ; DOS print character function
        mov dl, '='
        int 21h ; Call DOS interrupt

        ; Read user's answer
        mov ah, 01h      ; DOS input character function
        int 21h          ; Call DOS interrupt
        sub al, '0'      ; Convert ASCII to integer
        mov bh, 0        ; Clear BH
        mov bX, [correct_answer];Load correct_answer into BL A2048 OP.MUST BE SAME SIZE

        ; Calculate the correct answer
        add bl, bh ; Clear high bits of BL
        cmp al, bl ; Compare AL with BL
        je  correct_answer_handler ; Jump if equal

        ; Display incorrect message
    ; Set DS to point to the data segment
    mov ax, @data
    mov ds, ax
        mov ah, 09h ; DOS print string function
        mov dx, offset incorrect_msg
        int 21h ; Call DOS interrupt
        jmp next_flash_card ; Jump to the next flash card

    correct_answer_handler:
    ; Set DS to point to the data segment
    mov ax, @data
    mov ds, ax
        ; Add debug print to check correct answer handling
        mov ah, 09h ; DOS print string function
        mov dx, offset debug_msg
        int 21h ; Call DOS interrupt

        mov dx, [correct_answer]
        call print_number ; Display correct answer

        ; Display correct message
    ; Set DS to point to the data segment
    mov ax, @data
    mov ds, ax
        mov ah, 09h ; DOS print string function
        mov dx, offset correct_msg
        int 21h ; Call DOS interrupt

        ; Increment correct answer count
        mov al, [correct_count] ; Load the byte value into AL
        inc al                  ; Increment AL
        mov [correct_count], al ; Store the result back in memory
    next_flash_card:
    ; Set DS to point to the data segment
    mov ax, @data
    mov ds, ax
        ; Add debug print to check loop termination
        mov ah, 09h ; DOS print string function
        mov dx, offset debug_msg
        int 21h ; Call DOS interrupt
        ; Move to the next flash card
        dec cx ; Decrement the loop counter
        jnz flash_cards_loop ; Jump if not zero
    ; Display the number of correct answers
    ; Set DS to point to the data segment
    mov ax, @data
    mov ds, ax
    mov ah, 09h ; DOS print string function
    mov dx, offset result_prompt
    int 21h ; Call DOS interrupt
    ; Display the number of correct answers
    ; Set DS to point to the data segment
    mov ax, @data
    mov ds, ax
    mov ah, 02h ; DOS print character function
    mov dl, [correct_count]
    add dl, '0'
    int 21h ; Call DOS interrupt
    ; Exit program
    mov ah, 4Ch ; DOS exit function
    int 21h ; Call DOS interrupt
main endp
END main
.text
    ; Set DS to point to the data segment
    mov ax, @data
    mov ds, ax
    mov ah, 09h ; DOS print string function
    mov dx, offset hello_msg
    int 21h ; Call DOS interrupt
    mov ah, 09h ; DOS print string function
    ; Set DS to point to the data segment
    mov ax, @data
    mov ds, ax
    mov dx, offset debug_end_msg ; Debug message
    int 21h ; Call DOS interrupt
    mov ah, 4Ch ; DOS exit function
    int 21h ; Call DOS interrupt