Homebrew Homebrew app View video on Nintendo Switch

Luigi31

Member
OP
Newcomer
Joined
May 3, 2023
Messages
14
Trophies
0
Age
15
XP
236
Country
France
Hello / good evening, recently I looked into the development of hombrew application for switch. I wanted to start very simply so I tried to display a video with FFmpg + SDL2. But when compiling I get this:

Code:
linking Rickroll2000.elf

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.o: in function `main':

main.cpp:(.text.startup.main+0xf8): undefined reference to `av_register_all()'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x118): undefined reference to `avformat_open_input(AVFormatContext**, char const*, AVInputFormat*, AVDictionary**)'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x128): undefined reference to `avformat_find_stream_info(AVFormatContext*, AVDictionary**)'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x17c): undefined reference to `avcodec_find_decoder(AVCodecID)'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x184): undefined reference to `avcodec_alloc_context3(AVCodec const*)'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x190): undefined reference to `avcodec_parameters_to_context(AVCodecContext*, AVCodecParameters const*)'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x1a4): undefined reference to `avcodec_open2(AVCodecContext*, AVCodec const*, AVDictionary**)'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x1fc): undefined reference to `av_frame_alloc()'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x204): undefined reference to `av_packet_alloc()'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x214): undefined reference to `av_packet_unref(AVPacket*)'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x220): undefined reference to `av_read_frame(AVFormatContext*, AVPacket*)'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x240): undefined reference to `avcodec_send_packet(AVCodecContext*, AVPacket const*)'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x24c): undefined reference to `avcodec_receive_frame(AVCodecContext*, AVFrame*)'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x2a8): undefined reference to `av_frame_free(AVFrame**)'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x2b0): undefined reference to `av_packet_free(AVPacket**)'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x2bc): undefined reference to `avcodec_close(AVCodecContext*)'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x2c4): undefined reference to `avformat_close_input(AVFormatContext**)'

collect2.exe: error: ld returned 1 exit status

make[1]: *** [/opt/devkitpro/libnx/switch_rules:81: /home/mpopc/Desktop/Rickroll2000/Rickroll2000.elf] Error 1

make: *** [Makefile:160: build] Error 2

I think it comes from the make file, by the way if you need it, here it is:

Makefile:
ARCH    :=    -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE

CFLAGS    :=    `$(PREFIX)pkg-config --cflags sdl2 SDL2_mixer SDL2_image` -Wall -O2 -ffunction-sections \
            $(ARCH) $(DEFINES)

CFLAGS    +=    $(INCLUDE) -D__SWITCH__

CXXFLAGS    := $(CFLAGS) -std=c++14

ASFLAGS    :=    -g $(ARCH)
LDFLAGS    =    -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)

LIBS    :=    `$(PREFIX)pkg-config --libs sdl2 SDL2_mixer SDL2_image SDL2_ttf` \
            -lavformat -lavcodec -lswresample -lswscale -lavutil -lbz2 -lass -ltheora -lvorbis -logg -lz -lnx

#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS    := $(PORTLIBS) $(LIBNX)

I didn't give the whole makefile because I think the rest is useless.
Does anyone know about it and can explain to me why the references are indefinite ?
Thanks in advance for your reply.
 

The Real Jdbye

*is birb*
Member
Joined
Mar 17, 2010
Messages
23,384
Trophies
4
Location
Space
XP
14,017
Country
Norway
Hello / good evening, recently I looked into the development of hombrew application for switch. I wanted to start very simply so I tried to display a video with FFmpg + SDL2. But when compiling I get this:

Code:
linking Rickroll2000.elf

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.o: in function `main':

main.cpp:(.text.startup.main+0xf8): undefined reference to `av_register_all()'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x118): undefined reference to `avformat_open_input(AVFormatContext**, char const*, AVInputFormat*, AVDictionary**)'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x128): undefined reference to `avformat_find_stream_info(AVFormatContext*, AVDictionary**)'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x17c): undefined reference to `avcodec_find_decoder(AVCodecID)'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x184): undefined reference to `avcodec_alloc_context3(AVCodec const*)'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x190): undefined reference to `avcodec_parameters_to_context(AVCodecContext*, AVCodecParameters const*)'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x1a4): undefined reference to `avcodec_open2(AVCodecContext*, AVCodec const*, AVDictionary**)'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x1fc): undefined reference to `av_frame_alloc()'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x204): undefined reference to `av_packet_alloc()'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x214): undefined reference to `av_packet_unref(AVPacket*)'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x220): undefined reference to `av_read_frame(AVFormatContext*, AVPacket*)'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x240): undefined reference to `avcodec_send_packet(AVCodecContext*, AVPacket const*)'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x24c): undefined reference to `avcodec_receive_frame(AVCodecContext*, AVFrame*)'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x2a8): undefined reference to `av_frame_free(AVFrame**)'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x2b0): undefined reference to `av_packet_free(AVPacket**)'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x2bc): undefined reference to `avcodec_close(AVCodecContext*)'

C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x2c4): undefined reference to `avformat_close_input(AVFormatContext**)'

collect2.exe: error: ld returned 1 exit status

make[1]: *** [/opt/devkitpro/libnx/switch_rules:81: /home/mpopc/Desktop/Rickroll2000/Rickroll2000.elf] Error 1

make: *** [Makefile:160: build] Error 2

I think it comes from the make file, by the way if you need it, here it is:

Makefile:
ARCH    :=    -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE

CFLAGS    :=    `$(PREFIX)pkg-config --cflags sdl2 SDL2_mixer SDL2_image` -Wall -O2 -ffunction-sections \
            $(ARCH) $(DEFINES)

CFLAGS    +=    $(INCLUDE) -D__SWITCH__

CXXFLAGS    := $(CFLAGS) -std=c++14

ASFLAGS    :=    -g $(ARCH)
LDFLAGS    =    -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)

LIBS    :=    `$(PREFIX)pkg-config --libs sdl2 SDL2_mixer SDL2_image SDL2_ttf` \
            -lavformat -lavcodec -lswresample -lswscale -lavutil -lbz2 -lass -ltheora -lvorbis -logg -lz -lnx

#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS    := $(PORTLIBS) $(LIBNX)

I didn't give the whole makefile because I think the rest is useless.
Does anyone know about it and can explain to me why the references are indefinite ?
Thanks in advance for your reply.
Do you have libavcodec and related libraries?
 

Luigi31

Member
OP
Newcomer
Joined
May 3, 2023
Messages
14
Trophies
0
Age
15
XP
236
Country
France
It's mentioned here that av_register_all has been deprecated :
https://github.com/leandromoreira/ffmpeg-libav-tutorial/issues/29

There seems to be missing something or not referenced.
Maybe there are some hints here :
https://github.com/leandromoreira/ffmpeg-libav-tutorial/issues/27
Thank you for your answer, I think the problem comes from the fact that I am not the lib.
Do you have libavcodec and related libraries?
Thank you for your answer. I don't think I have the libs, because when I run the command
Code:
pacman -Ss libavacodec
it does not return anything to me, unless it is not this command that must be executed 😅.
Even when I try to install the package with this command:
Code:
pacman -S libavacodec
gives me an error that the packet is not found.
What command should I use to install this lib ?
 

The Real Jdbye

*is birb*
Member
Joined
Mar 17, 2010
Messages
23,384
Trophies
4
Location
Space
XP
14,017
Country
Norway
Thank you for your answer, I think the problem comes from the fact that I am not the lib.

Thank you for your answer. I don't think I have the libs, because when I run the command
Code:
pacman -Ss libavacodec
it does not return anything to me, unless it is not this command that must be executed 😅.
Even when I try to install the package with this command:
Code:
pacman -S libavacodec
gives me an error that the packet is not found.
What command should I use to install this lib ?
libavcodec, not libavacodec
From your makefile:
LIBS := `$(PREFIX)pkg-config --libs sdl2 SDL2_mixer SDL2_image SDL2_ttf` \
-lavformat -lavcodec -lswresample -lswscale -lavutil -lbz2 -lass -ltheora -lvorbis -logg -lz -lnx
Make sure you have all of these. Most of them are probably separate packages. But you need devkitPro/ARM64 specific versions, devkitPro can not use normal packages installed on your Linux system.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
  • Minox @ Minox:
    No idea what any of those things you mention are
    +1
  • K3Nv2 @ K3Nv2:
    Cholesterol and Triglycerides? Basically a way they measure fatty cells in your blood
  • AncientBoi @ AncientBoi:
    Cholesterol is sorta high, according to my doc
    +1
  • K3Nv2 @ K3Nv2:
    I've been taking fiber pills, eating more grapes, switched to wheat bread in hopes to lower it
    +1
  • BigOnYa @ BigOnYa:
    I like wheat bread, I even like the chunky wheat bread with pieces of whole grain in it.
  • K3Nv2 @ K3Nv2:
    Been getting this honey wheat bread from aldis pretty decent not very sweet to out do it
  • K3Nv2 @ K3Nv2:
    Me making any food at home is an improvement to how I use to be
    +1
  • BigOnYa @ BigOnYa:
    I have an bread machine and use it alot, better than breads you buy, but don't last as long, cause no bs preservatives
  • K3Nv2 @ K3Nv2:
    I got compliments about my weight loss and thought well guess I can pig out again now I'm the piggy
  • BigOnYa @ BigOnYa:
    My biggest prob is alcohol, definitely is fattening
  • K3Nv2 @ K3Nv2:
    I know when to stop at least honestly don't get those that go and go with food
  • BigOnYa @ BigOnYa:
    Or those that order 2 big macs , large fry, ice cream sundie, then a diet coke
  • K3Nv2 @ K3Nv2:
    I might get downing two big macs but nah that's it
  • BigOnYa @ BigOnYa:
    Ok that will be $15.99, cash or charge?
  • K3Nv2 @ K3Nv2:
    My go to orders usually a mcdouble and a mcchicken and I'm happy rarely mess with fries
  • K3Nv2 @ K3Nv2:
    Pro tip ask for that clowns jizzmac sauce on your mcdouble
    +1
  • BigOnYa @ BigOnYa:
    Do they charge extra when you add sauce,etc? I know burger king used to not, but don't know nowadays
  • K3Nv2 @ K3Nv2:
    They may squrit it for free if you ask nice
    +1
  • K3Nv2 @ K3Nv2:
    Last time I got bk it was 35c per sauce fuck you king of my nutsack
    +1
  • K3Nv2 @ K3Nv2:
    I'll buy a bottle of baby rays BBQ for $2 and add it from home out of spite
    +1
  • BigOnYa @ BigOnYa:
    I like baby rays, my favorite is KC masterpiece tho. Figured all you could buy is that there.
  • K3Nv2 @ K3Nv2:
    The metro doesn't discriminate good sauce
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    Baby Rays isn't that what killed the crocodile hunter?
  • Psionic Roshambo @ Psionic Roshambo:
    If only he had done an endorsement for them....
  • Psionic Roshambo @ Psionic Roshambo:
    Oy mate don't let a bad bbq sauce kill your party! Baby Rays are killing it!! The flavor hits you right in the chest!
    +1
    Psionic Roshambo @ Psionic Roshambo: Oy mate don't let a bad bbq sauce kill your party! Baby Rays are killing it!! The flavor hits... +1