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

Compilation errors on Raspberry Pi 4 Raspbian #203

Closed
JeanMarcZimmer opened this issue Oct 2, 2020 · 11 comments
Closed

Compilation errors on Raspberry Pi 4 Raspbian #203

JeanMarcZimmer opened this issue Oct 2, 2020 · 11 comments

Comments

@JeanMarcZimmer
Copy link

I'm trying to compile a library that depends on this one. However, when compiling, I get lots of errors of the same type :

In file included from .../opus/celt/arm/celt_neon_intr.c:37:
/usr/lib/gcc/arm-linux-gnueabihf/8/include/arm_neon.h:LINE:1: error: inlining failed in call to always_inline 'v*_f32': target specific option mismatch

Here are my system's specification :
Raspbian GNU/Linux 10 armv7l,
Raspberry Pi 4 Model B Rev 1.2.
Kernel version 5.4.51-v7l+

What GCC configuration am I missing ?

@xnorpx
Copy link
Contributor

xnorpx commented Oct 3, 2020

cmake or autotools?

@JeanMarcZimmer
Copy link
Author

JeanMarcZimmer commented Oct 3, 2020

I just realised I forgot to indicate the lib I'm trying to compile opus for. It's tostc/libDiscordBot.

cmake or autotools?

Cmake.

Strangely enough, it worked without any problem on my computer, which runs the ArchLinux Kernel on a 64-bit Intel Core CPU.

@xnorpx
Copy link
Contributor

xnorpx commented Oct 3, 2020

Can you add

MESSAGE(STATUS "CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
MESSAGE(STATUS "CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}")
MESSAGE(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")

In libDiscordBot\externals\opus\CMakeLists.txt after the project line. Then paste the info here once you configured again.

@JeanMarcZimmer
Copy link
Author

I get the following :
CMAKE_SYSTEM_NAME: Linux
CMAKE_SYSTEM_PROCESSOR: armv7l
CMAKE_C_COMPILER: /usr/bin/cc

Here is the full output of the cmake command :

~/libDiscordBot/build > cmake ..
-- Opus library version: 0.8.0
-- Opus package version: 2.2.0-alpha-4-g0d2c584
-- Opus project version: 2.2.0
-- CMAKE_SYSTEM_NAME: Linux
-- CMAKE_SYSTEM_PROCESSOR: armv7l
-- CMAKE_C_COMPILER: /usr/bin/cc
-- Performing Test VLA_SUPPORTED -- success
-- Check NEON support by compiler
-- The following features have been enabled:

 * OPUS_STACK_PROTECTOR, Use stack protection
 * OPUS_VAR_ARRAYS, Use variable length arrays for stack arrays
 * OPUS_FLOAT_API, compile with the floating point API (for machines with float library)
 * OPUS_INSTALL_PKG_CONFIG_MODULE, install PkgConfig module
 * OPUS_INSTALL_CMAKE_CONFIG_MODULE, install CMake package config module

-- The following REQUIRED packages have been found:

 * Git, fast, scalable, distributed revision control system, <https://git-scm.com/>
   required to set up package version

-- The following features have been disabled:

 * OPUS_BUILD_SHARED_LIBRARY, Build shared library
 * OPUS_USE_ALLOCA, Use alloca for stack arrays (on non-C99 compilers)
 * OPUS_NONTHREADSAFE_PSEUDOSTACK, Use a non threadsafe pseudostack when neither variable length arrays or alloca is supported
 * OPUS_CUSTOM_MODES, Enable non-Opus modes, e.g. 44.1 kHz & 2^n frames
 * OPUS_BUILD_TESTING, Build test programs
 * OPUS_BUILD_PROGRAMS, Build programs
 * OPUS_FIXED_POINT, compile as fixed-point (for machines without a fast enough FPU)
 * OPUS_FLOAT_APPROX, Enable floating point approximations (Ensure your platform supports IEEE 754 before enabling)
 * OPUS_FAST_MATH, Enable fast math, (depending on OPUS_FLOAT_APPROX to be enabled)

-- OPUS_MAY_HAVE_NEON enabling runtime detection
2.2.0
-- Configuring done
-- Generating done
-- Build files have been written to: .../libDiscordBot/build

@xnorpx
Copy link
Contributor

xnorpx commented Oct 5, 2020

Looks, like Opus revision is not the newest, I did some updates regarding submodules so can you try to update with.

git submodule update --remote --merge externals/opus

inside libDiscordBot

note, there might still be bugs here as I don't have added rpi in CI yet, but let's start with updating to the latest Opus version.

@JeanMarcZimmer
Copy link
Author

Well, just updating and trying to compile didn't work. The errors remained.

Also now I'm getting a lot of this warning in most files (I don't remember having them before, but maybe my memory's bad)

In file included from .../libDiscordBot/externals/opus/celt/celt_encoder.c:49:
.../libDiscordBot/externals/opus/celt/float_cast.h:135:10: warning: #warning "Don't have the functions lrint() and lrintf ()." [-Wcpp]
         #warning "Don't have the functions lrint() and lrintf ()."
          ^~~~~~~
.../libDiscordBot/externals/opus/celt/float_cast.h:136:10: warning: #warning "Replacing these functions with a standard C cast." [-Wcpp]
         #warning "Replacing these functions with a standard C cast."

@silverbacknet
Copy link
Contributor

I don't think Opus is designed to work with -Werror in general. Those warnings just tell you that it's falling back to unoptimized code on your platform, because your standard library isn't fully C99 compliant.

@xnorpx
Copy link
Contributor

xnorpx commented Oct 5, 2020

The lrint is a bug in the lrint detection in cmake scripts. I have a fix for that somewhere.
Created: https://gitlab.xiph.org/xiph/opus/-/issues/2342 to track

Can you try to compile only opus on the raspberry pi so we know if it's a submodule issue or not.
Also, can you check exact what compiler and version of compiler you are using.

cd externals/opus
mkdir build
cd build
cmake .. -DOPUS_BUILD_TESTING=ON
cmake --build .
ctest

If that doesn't work can you try

cd externals/opus
mkdir build
cd build
cmake .. -DOPUS_BUILD_TESTING=ON -DOPUS_DISABLE_INTRINSICS=OFF
cmake --build .
ctest

@JeanMarcZimmer
Copy link
Author

I don't think Opus is designed to work with -Werror in general. Those warnings just tell you that it's falling back to unoptimized code on your platform, because your standard library isn't fully C99 compliant.

That was just a side note, this warning is not causing any issue. -Werror isn't used.

Also, can you check exact what compiler and version of compiler you are using.

Just in case, the CMake version is 3.13.4
The compiler used by CMake is /usr/bin/cc, version 8.3.0

Can you try to compile only opus on the raspberry pi so we know if it's a submodule issue or not.

-DOPUS_BUILD_TESTING=ON gives the same result (the errors in opus/celt/arm/celt_neon_intr.c)
-DOPUS_DISABLE_INTRINSICS=OFF didn't change anything (and I'm not surprised, this feature is disabled by default, when using cmake .. without options)

However...
-DOPUS_DISABLE_INTRINSICS=ON at least allowed the compilation to complete successfully. I'm not sure if libDiscordBot will still work as intended though. I still don't use its voice chat system, so I might not now before a good time. I'm closing the issue, but I might reopen it later if I have trouble with the voice system. I'm also indicating the issue and its fix on the libDiscordBot page.

TL;DR for people looking after the same problem : add -DOPUS_DISABLE_INTRINSICS=ON when generating the CMake files.

@xnorpx
Copy link
Contributor

xnorpx commented Oct 5, 2020

Thanks, I will open a separate bug on this item to ensure to fix neon optimizations. But hopefully this unblocks you to move on and create your bot :)

@xnorpx
Copy link
Contributor

xnorpx commented Oct 5, 2020

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

3 participants