juha-h / libbaresip-android

libbaresip for Android
Other
40 stars 29 forks source link

'absl/meta/type_traits.h' file not found #20

Closed ludovicroland closed 3 years ago

ludovicroland commented 3 years ago

Hello,

I am trying to build baresip in order to use it into an Android application. Unfortunately, the build fails.

I am trying to setup a pipeline running on Ubuntu 20.04. From the README file, the steps 1, 2 and 3 seems to work, but my pipeline failed on the step 4.

To launch this step, I am using the following command:

make install-all NDK_PATH='/usr/local/lib/android/sdk/ndk-bundle' OUTPUT_DIR='distribution'

But it fails with the following message:

make[2]: Entering directory '/home/vsts/work/1/s/webrtc' [armeabi-v7a] Compile++ thumb: webrtc <= aecm_core.cc In file included from jni/src/webrtc/modules/audio_processing/aecm/aecm_core.cc:24: jni/src/webrtc/rtc_base/checks.h:57:10: fatal error: 'absl/meta/type_traits.h' file not found

include "absl/meta/type_traits.h"

^~~~~~~~~ 1 error generated. make[2]: [/usr/local/lib/android/sdk/ndk/21.4.7075529/build/core/build-binary.mk:478: obj/local/armeabi-v7a/objs/webrtc/src/webrtc/modules/audio_processing/aecm/aecm_core.o] Error 1 make[2]: Leaving directory '/home/vsts/work/1/s/webrtc' make[1]: [Makefile:247: webrtc] Error 2 make[1]: Leaving directory '/home/vsts/work/1/s' make: *** [Makefile:324: install-all] Error 2

[error]Bash exited with code '2'.

I am not a C or C++ developer and I have no idea how to fix this issue. Any help is welcome :) Should I update any tools on my pipeline ? Am I missing something from the README file?

Thank you for your help.

juha-h commented 3 years ago

I cannot reproduce this issue (see below). I'm using latest NDK LTS release 23.0.7599858.

/usr/src/libbaresip-android$ git checkout master 
Already on 'master'
Your branch is up to date with 'origin/master'.
/usr/src/libbaresip-android$ git pull
Already up to date.
/usr/src/libbaresip-android$ rm -rf webrtc
j/usr/src/libbaresip-android$ git clone https://github.com/juha-h/libwebrtc.git -b mobile --single-branch webrtc
Cloning into 'webrtc'...
remote: Enumerating objects: 987, done.
remote: Counting objects: 100% (807/807), done.
remote: Compressing objects: 100% (703/703), done.
remote: Total 987 (delta 98), reused 746 (delta 92), pack-reused 180
Receiving objects: 100% (987/987), 1.43 MiB | 1.76 MiB/s, done.
Resolving deltas: 100% (120/120), done.
j/usr/src/libbaresip-android$ make webrtc
cd webrtc && \
rm -rf obj && \
/opt/Android/ndk/23.0.7599858/ndk-build APP_PLATFORM=android-21
make[1]: Entering directory '/usr/src/libbaresip-android/webrtc'
[armeabi-v7a] Compile++ thumb: webrtc <= aecm_core.cc
[armeabi-v7a] Compile++ thumb: webrtc <= echo_control_mobile.cc
[armeabi-v7a] Compile++ thumb: webrtc <= delay_estimator_wrapper.cc
[armeabi-v7a] Compile++ thumb: webrtc <= delay_estimator.cc
[armeabi-v7a] Compile++ thumb: webrtc <= fft4g.cc
[armeabi-v7a] Compile thumb  : webrtc <= spl_sqrt_floor.c
[armeabi-v7a] Compile thumb  : webrtc <= ring_buffer.c
[armeabi-v7a] Compile thumb  : webrtc <= complex_bit_reverse.c
[armeabi-v7a] Compile thumb  : webrtc <= complex_fft.c
[armeabi-v7a] Compile thumb  : webrtc <= copy_set_operations.c
[armeabi-v7a] Compile thumb  : webrtc <= cross_correlation.c
[armeabi-v7a] Compile thumb  : webrtc <= division_operations.c
[armeabi-v7a] Compile thumb  : webrtc <= downsample_fast.c
[armeabi-v7a] Compile thumb  : webrtc <= energy.c
[armeabi-v7a] Compile thumb  : webrtc <= get_scaling_square.c
[armeabi-v7a] Compile thumb  : webrtc <= min_max_operations.c
[armeabi-v7a] Compile thumb  : webrtc <= randomization_functions.c
[armeabi-v7a] Compile thumb  : webrtc <= real_fft.c
[armeabi-v7a] Compile thumb  : webrtc <= spl_init.c
[armeabi-v7a] Compile thumb  : webrtc <= spl_sqrt.c
[armeabi-v7a] Compile thumb  : webrtc <= vector_scaling_operations.c
[armeabi-v7a] Compile++ thumb: webrtc <= aecm_core_neon.cc
[armeabi-v7a] Compile++ thumb: webrtc <= aecm_core_c.cc
[armeabi-v7a] Compile thumb  : webrtc <= cross_correlation_neon.c
[armeabi-v7a] Compile thumb  : webrtc <= downsample_fast_neon.c
[armeabi-v7a] Compile thumb  : webrtc <= min_max_operations_neon.c
[armeabi-v7a] StaticLibrary  : libwebrtc.a
[arm64-v8a] Compile++      : webrtc <= aecm_core.cc
[arm64-v8a] Compile++      : webrtc <= echo_control_mobile.cc
[arm64-v8a] Compile++      : webrtc <= delay_estimator_wrapper.cc
[arm64-v8a] Compile++      : webrtc <= delay_estimator.cc
[arm64-v8a] Compile++      : webrtc <= fft4g.cc
[arm64-v8a] Compile        : webrtc <= spl_sqrt_floor.c
[arm64-v8a] Compile        : webrtc <= ring_buffer.c
[arm64-v8a] Compile        : webrtc <= complex_bit_reverse.c
[arm64-v8a] Compile        : webrtc <= complex_fft.c
[arm64-v8a] Compile        : webrtc <= copy_set_operations.c
[arm64-v8a] Compile        : webrtc <= cross_correlation.c
[arm64-v8a] Compile        : webrtc <= division_operations.c
[arm64-v8a] Compile        : webrtc <= downsample_fast.c
[arm64-v8a] Compile        : webrtc <= energy.c
[arm64-v8a] Compile        : webrtc <= get_scaling_square.c
[arm64-v8a] Compile        : webrtc <= min_max_operations.c
[arm64-v8a] Compile        : webrtc <= randomization_functions.c
[arm64-v8a] Compile        : webrtc <= real_fft.c
[arm64-v8a] Compile        : webrtc <= spl_init.c
[arm64-v8a] Compile        : webrtc <= spl_sqrt.c
[arm64-v8a] Compile        : webrtc <= vector_scaling_operations.c
[arm64-v8a] Compile++      : webrtc <= aecm_core_neon.cc
[arm64-v8a] Compile++      : webrtc <= aecm_core_c.cc
[arm64-v8a] Compile        : webrtc <= cross_correlation_neon.c
[arm64-v8a] Compile        : webrtc <= downsample_fast_neon.c
[arm64-v8a] Compile        : webrtc <= min_max_operations_neon.c
[arm64-v8a] StaticLibrary  : libwebrtc.a
make[1]: Leaving directory '/usr/src/libbaresip-android/webrtc'
ludovicroland commented 3 years ago

@juha-h : thank you for your help and your answer.

I am using an Azure Pipeline with a Microsoft hosted agent. You can check the configuration here.

By default, the version of the NDK used is 21.4.7075529. But I have also tried with the version 23.0.7599858. Unfortunately I am having the same issue:

cd webrtc && \ rm -rf obj && \ /usr/local/lib/android/sdk/ndk/23.0.7599858/ndk-build APP_PLATFORM=android-21 make[2]: Entering directory '/home/vsts/work/1/s/webrtc' [armeabi-v7a] Compile++ thumb: webrtc <= aecm_core.cc In file included from jni/src/webrtc/modules/audio_processing/aecm/aecm_core.cc:24: jni/src/webrtc/rtc_base/checks.h:57:10: fatal error: 'absl/meta/type_traits.h' file not found

include "absl/meta/type_traits.h"

^~~~~~~~~ 1 error generated. make[2]: [/usr/local/lib/android/sdk/ndk/23.0.7599858/build/core/build-binary.mk:478: obj/local/armeabi-v7a/objs/webrtc/src/webrtc/modules/audio_processing/aecm/aecm_core.o] Error 1 make[2]: Leaving directory '/home/vsts/work/1/s/webrtc' make[1]: [Makefile:247: webrtc] Error 2 make[1]: Leaving directory '/home/vsts/work/1/s' make: *** [Makefile:324: install-all] Error 2

[error]Bash exited with code '2'.

Here, all the command lines I am using:

make download-sources

sudo apt-get install libtool

sudo apt-get install cmake

make install-all NDK_PATH='/usr/local/lib/android/sdk/ndk/23.0.7599858' OUTPUT_DIR='distribution'

Maybe the issue is due to a wrong configuration of the agent? Should I use a specific version of cmake? or gcc? or g++?

juha-h commented 3 years ago

You didn't show how you got your webrtc directory (see my git clone in above). make is from the host. gcc etc. are from the NDK toolchain. My make (on Debian 11) is this:

/usr/src/libbaresip-android$ make -v
GNU Make 4.3
ludovicroland commented 3 years ago

@juha-h : If I am not wrong, the web RTC directory is created during the "download-sources" command. I can see these logs when I launch the command:

git clone https://github.com/juha-h/libwebrtc.git -b mobile --single-branch webrtc Cloning into 'webrtc'...

ludovicroland commented 3 years ago

@juha-h : The issue is the same which has been opened 2 days ago on the libwebrtc repository: https://github.com/juha-h/libwebrtc/issues/4

juha-h commented 3 years ago

The file 'absl/meta/type_traits.h' is included only if __cplusplus is defined:

#ifdef __cplusplus
// C++ version.

#include <string>
#include "absl/meta/type_traits.h"
...

In my build it is not defined, since I don't get the error. The file does not even exist in https://github.com/juha-h/libwebrtc.git mobile branch.

I don't know why it is defined in your build. Try to add -U__cplusplus in file webrtc/jni/Android.mk on line like this:

common_CFLAGS := -fexceptions -DWEBRTC_POSIX=1 -DWEBRTC_ANDROID -U__cplusplus -I$(LOCAL_PATH)/src/webrtc/
juha-h commented 3 years ago

juha-h writes:

I don't know why it is defined in your build. Try to add -U__cplusplus in file webrtc/jni/Android.mk on line like this:

common_CFLAGS := -fexceptions -DWEBRTC_POSIX=1 -DWEBRTC_ANDROID -U__cplusplus -I$(LOCAL_PATH)/src/webrtc/

Or try to change in file checks.h lines:

ifdef __cplusplus

to lines:

ifdef FOOBAR

ludovicroland commented 3 years ago

@juha-h : thank you for your help.

Adding the -U__cplusplus option, I still have an error when building the webRTC module. But the error is not the same:

cd webrtc && \ rm -rf obj && \ /usr/local/lib/android/sdk/ndk-bundle/ndk-build APP_PLATFORM=android-21 make[2]: Entering directory '/home/vsts/work/1/s/webrtc' [armeabi-v7a] Compile++ thumb: webrtc <= aecm_core.cc In file included from jni/src/webrtc/modules/audio_processing/aecm/aecm_core.cc:11: In file included from jni/src/webrtc/modules/audio_processing/aecm/aecm_core.h:17: In file included from jni/src/webrtc/common_audio/ring_buffer.h:23: In file included from /usr/local/lib/android/sdk/ndk/21.4.7075529/sources/cxx-stl/llvm-libc++/include/stddef.h:45: /usr/local/lib/android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/9.0.9/include/stddef.h:74:24: error: cannot combine with previous 'int' declaration specifier typedef __WCHAR_TYPE__ wchar_t;

In file included from jni/src/webrtc/modules/audio_processing/aecm/aecm_core.cc:25: In file included from jni/src/webrtc/rtc_base/numerics/safe_conversions.h:16: In file included from /usr/local/lib/android/sdk/ndk/21.4.7075529/sources/cxx-stl/llvm-libc++/include/limits:105: In file included from /usr/local/lib/android/sdk/ndk/21.4.7075529/sources/cxx-stl/llvm-libc++/include/type_traits:417: /usr/local/lib/android/sdk/ndk/21.4.7075529/sources/cxx-stl/llvm-libc++/include/cstddef:47:1: error: unknown type name '_LIBCPP_BEGIN_NAMESPACE_STD' _LIBCPP_BEGIN_NAMESPACE_STD ^ /usr/local/lib/android/sdk/ndk/21.4.7075529/sources/cxx-stl/llvm-libc++/include/cstddef:49:1: error: expected unqualified-id using ::ptrdiff_t; ^ /usr/local/lib/android/sdk/ndk/21.4.7075529/sources/cxx-stl/llvm-libc++/include/cstddef:60:1: error: unknown type name '_LIBCPP_END_NAMESPACE_STD' _LIBCPP_END_NAMESPACE_STD ^ In file included from jni/src/webrtc/modules/audio_processing/aecm/aecm_core.cc:25: In file included from jni/src/webrtc/rtc_base/numerics/safe_conversions.h:16: In file included from /usr/local/lib/android/sdk/ndk/21.4.7075529/sources/cxx-stl/llvm-libc++/include/limits:105: /usr/local/lib/android/sdk/ndk/21.4.7075529/sources/cxx-stl/llvm-libc++/include/type_traits:424:28: error: expected ';' after top level declarator _LIBCPP_BEGIN_NAMESPACE_STD ^ [...]

Any idea on how to fix these new issues?

juha-h commented 3 years ago

Ludovic ROLAND writes:

Adding the -U__cplusplus option, I still have an error when building the webRTC module. But the error is not the same:

Instead of adding the -U__cplusplus option try to change in file checks.h lines:

ifdef __cplusplus

to lines:

ifdef FOOBAR

juha-h commented 3 years ago

I found better solution by including absl include files in mobile branch of https://github.com/juha-h/libwebrtc. Re-install webrtc source:

$ rm -rf webrtc $ git clone https://github.com/juha-h/libwebrtc.git -b mobile --single-branch webrtc

And then try to make webrtc

$ make webrtc

ludovicroland commented 3 years ago

@juha-h : thank you so much. It works perfectly now :)

juha-h commented 3 years ago

Thanks for testing.

ashellunts commented 3 years ago

FYI, absl lib is usually located in webrtc third_party folder not in root.

juha-h commented 3 years ago

OK, if I some day have extra time, I can try to move it there. Currently make does not find it from there and some other changes would be needed.