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

Linker error when linking libwebrtc.a against C++ code on Linux OS after building with build.md instructions #30

Open
e-p-foley opened this issue Dec 31, 2024 · 0 comments

Comments

@e-p-foley
Copy link

e-p-foley commented Dec 31, 2024

https://github.com/webrtc-sdk/webrtc-build/blame/3f144c5c0e145ea8e714cec6955abbff68c3caf1/docs/build.md#L222

Issue Observed:

Linker error when linking libwebrtc.a against C++ code on Linux OS after building with build.md instructions:

gn gen out/Linux-x64 --args="target_os="linux" target_cpu="x64" is_debug=false rtc_include_tests=false rtc_use_h264=false is_component_build=false use_rtti=true use_custom_libcxx=false rtc_enable_protobuf=false"

Error:

/usr/bin/ld: unknown architecture of input file webrtc-checkout/src/out/Linux-x64/obj/libwebrtc.a(peer_connection_interface.o)' is incompatible with i386:x86-64 output
/usr/bin/ld: unknown architecture of input file webrtc-checkout/src/out/Linux-x64/obj/libwebrtc.a(rtc_certificate.o)' is incompatible with i386:x86-64 output

Steps to reproduce:

  1. mkdir webrtc-checkout

  2. cd webrtc-checkout

  3. fetch --nohooks webrtc

  4. gclient sync

  5. cd src

  6. gn gen out/Linux-x64 --args="target_os="linux" target_cpu="x64" is_debug=false rtc_include_tests=false rtc_use_h264=false is_component_build=false use_rtti=true use_custom_libcxx=false rtc_enable_protobuf=false"

  7. ninja -C out/Linux-x64

  8. g++ -o test test.cpp peer_connection.o // test.cpp print "hello world"

Environment Configuration :

lscpu

Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 48 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 32
On-line CPU(s) list: 0-31
Vendor ID: AuthenticAMD
Model name: AMD Ryzen 9 7950X 16-Core Processor
CPU family: 25
Model: 97
Thread(s) per core: 2
Core(s) per socket: 16
Socket(s): 1
Stepping: 2
BogoMIPS: 8999.77

Base machine Windows 11 pro, but running everything in WSL with OS:

Ubuntu 24.04.1 LTS

gcc -v

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.3.0-6ubuntu2~24.04' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-

ld --verbose

GNU ld (GNU Binutils for Ubuntu) 2.42
Supported emulations:
elf_x86_64
elf32_x86_64
elf_i386
elf_iamcu
i386pep
i386pe
using internal linker script:
OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64",
"elf64-x86-64")
OUTPUT_ARCH(i386:x86-64)

When inspecting generated *.o files they do look compatible with an x86_64 arch:

ar -t obj/libwebrtc.a
ar -x obj/libwebrtc.a
*file .o

I see format:

ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped

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