Bonjour

J'essai de crosscompiler https://github.com/bramp/libcec-daemon pour Android 9 x86_64.

Mais j'ai des erreurs de linker. Pouvez-vous m'aider ?

Cordialement,

Ayuzerak

Code Shell : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 linuxlite  ~  Downloads  libcec-daemon-master  build  2  ./xcompile_cmake.sh 
-- Android: Targeting API '21' with architecture 'x86_64', ABI 'x86_64', and processor 'x86_64'
-- Android: Selected GCC toolchain 'x86_64-4.9'
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/linuxlite/Android/Sdk/ndk/android-ndk-r14b/toolchains/x86_64-4.9/prebuilt/linux-x86_64/bin/x86_64-linux-android-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/linuxlite/Android/Sdk/ndk/android-ndk-r14b/toolchains/x86_64-4.9/prebuilt/linux-x86_64/bin/x86_64-linux-android-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Failed
-- Performing Test COMPILER_SUPPORTS_CXX0X
-- Performing Test COMPILER_SUPPORTS_CXX0X - Failed
-- The compiler /home/linuxlite/Android/Sdk/ndk/android-ndk-r14b/toolchains/x86_64-4.9/prebuilt/linux-x86_64/bin/x86_64-linux-android-g++ has no C++11 support. Please use a different C++ compiler.
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.83.0/BoostConfig.cmake (found suitable version "1.83.0", minimum required is "1.83.0")  
Boost_INCLUDE_DIRS=/home/linuxlite/Downloads/libcec-daemon-master/build/boost_1_83_0
-- Configuring done
-- Generating done
-- Build files have been written to: /home/linuxlite/Downloads/libcec-daemon-master/build

Code Shell : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
 linuxlite  ~  Downloads  libcec-daemon-master  build  127  make
[ 20%] Building CXX object CMakeFiles/libcec-daemon.dir/src/main.cpp.o
cc1plus: warning: command line option '-ftarget=x86_64-none-linux-android' is valid for Java but not for C++
In file included from /home/linuxlite/Downloads/libcec-daemon-master/build/boost_1_83_0/boost/any.hpp:22:0,
                 from /home/linuxlite/Downloads/libcec-daemon-master/build/boost_1_83_0/boost/program_options/value_semantic.hpp:12,
                 from /home/linuxlite/Downloads/libcec-daemon-master/build/boost_1_83_0/boost/program_options/options_description.hpp:13,
                 from /home/linuxlite/Downloads/libcec-daemon-master/build/boost_1_83_0/boost/program_options.hpp:15,
                 from /home/linuxlite/Downloads/libcec-daemon-master/src/main.cpp:26:
/home/linuxlite/Downloads/libcec-daemon-master/build/boost_1_83_0/boost/any/fwd.hpp:34:95: note: #pragma message: C++03 support is deprecated in Boost.Any 1.82 and will be removed in Boost.Any 1.84.
 BOOST_PRAGMA_MESSAGE("C++03 support is deprecated in Boost.Any 1.82 and will be removed in Boost.Any 1.84.")
                                                                                               ^
In file included from /home/linuxlite/Downloads/libcec-daemon-master/build/boost_1_83_0/boost/any/detail/placeholder.hpp:15:0,
                 from /home/linuxlite/Downloads/libcec-daemon-master/build/boost_1_83_0/boost/any.hpp:23,
                 from /home/linuxlite/Downloads/libcec-daemon-master/build/boost_1_83_0/boost/program_options/value_semantic.hpp:12,
                 from /home/linuxlite/Downloads/libcec-daemon-master/build/boost_1_83_0/boost/program_options/options_description.hpp:13,
                 from /home/linuxlite/Downloads/libcec-daemon-master/build/boost_1_83_0/boost/program_options.hpp:15,
                 from /home/linuxlite/Downloads/libcec-daemon-master/src/main.cpp:26:
/home/linuxlite/Downloads/libcec-daemon-master/build/boost_1_83_0/boost/type_index.hpp:39:107: note: #pragma message: C++03 support is deprecated in Boost.TypeIndex 1.82 and will be removed in Boost.TypeIndex 1.84.
 BOOST_PRAGMA_MESSAGE("C++03 support is deprecated in Boost.TypeIndex 1.82 and will be removed in Boost.TypeIndex 1.84.")
                                                                                                           ^
In file included from /home/linuxlite/Downloads/libcec-daemon-master/build/boost_1_83_0/boost/program_options/value_semantic.hpp:14:0,
                 from /home/linuxlite/Downloads/libcec-daemon-master/build/boost_1_83_0/boost/program_options/options_description.hpp:13,
                 from /home/linuxlite/Downloads/libcec-daemon-master/build/boost_1_83_0/boost/program_options.hpp:15,
                 from /home/linuxlite/Downloads/libcec-daemon-master/src/main.cpp:26:
/home/linuxlite/Downloads/libcec-daemon-master/build/boost_1_83_0/boost/lexical_cast.hpp:40:111: note: #pragma message: C++03 support is deprecated in Boost.LexicalCast 1.82 and will be removed in Boost.LexicalCast 1.84.
 BOOST_PRAGMA_MESSAGE("C++03 support is deprecated in Boost.LexicalCast 1.82 and will be removed in Boost.LexicalCast 1.84.")
                                                                                                               ^
[ 40%] Building CXX object CMakeFiles/libcec-daemon.dir/src/hdmi.cpp.o
cc1plus: warning: command line option '-ftarget=x86_64-none-linux-android' is valid for Java but not for C++
[ 60%] Building CXX object CMakeFiles/libcec-daemon.dir/src/libcec.cpp.o
cc1plus: warning: command line option '-ftarget=x86_64-none-linux-android' is valid for Java but not for C++
[ 80%] Building CXX object CMakeFiles/libcec-daemon.dir/src/uinput.cpp.o
cc1plus: warning: command line option '-ftarget=x86_64-none-linux-android' is valid for Java but not for C++
[100%] Linking CXX executable libcec-daemon
/home/linuxlite/Downloads/libcec-daemon-master/build/boost_1_83_0/boost/program_options/errors.hpp:379: error: undefined reference to 'boost::program_options::validation_error::get_template(boost::program_options::validation_error::kind_t)'
/home/linuxlite/Downloads/libcec-daemon-master/build/boost_1_83_0/boost/program_options/errors.hpp:379: error: undefined reference to 'boost::program_options::error_with_option_name::error_with_option_name(std::string const&, std::string const&, std::string const&, int)'
/home/linuxlite/Downloads/libcec-daemon-master/build/boost_1_83_0/boost/program_options/variables_map.hpp:155: error: undefined reference to 'boost::program_options::abstract_variables_map::operator[](std::string const&) const'
/home/linuxlite/Downloads/libcec-daemon-master/src/main.cpp:120: error: undefined reference to 'log4cplus::detail::get_macro_body_oss()'
/home/linuxlite/Downloads/libcec-daemon-master/src/main.cpp:120: error: undefined reference to 'log4cplus::detail::macro_forced_log(log4cplus::Logger const&, int, std::string const&, char const*, int, char const*)'
/home/linuxlite/Downloads/libcec-daemon-master/src/main.cpp:123: error: undefined reference to 'log4cplus::detail::get_macro_body_oss()'
/home/linuxlite/Downloads/libcec-daemon-master/src/main.cpp:123: error: undefined reference to 'log4cplus::detail::macro_forced_log(log4cplus::Logger const&, int, std::string const&, char const*, int, char const*)'
/home/linuxlite/Downloads/libcec-daemon-master/src/main.cpp:135: error: undefined reference to 'log4cplus::detail::get_macro_body_oss()'
/home/linuxlite/Downloads/libcec-daemon-master/src/main.cpp:135: error: undefined reference to 'log4cplus::detail::macro_forced_log(log4cplus::Logger const&, int, std::string const&, char const*, int, char const*)'
/home/linuxlite/Downloads/libcec-daemon-master/src/main.cpp:138: error: undefined reference to 'log4cplus::detail::get_macro_body_oss()'
/home/linuxlite/Downloads/libcec-daemon-master/src/main.cpp:138: error: undefined reference to 'log4cplus::detail::macro_forced_log(log4cplus::Logger const&, int, std::string const&, char const*, int, char const*)'
/home/linuxlite/Downloads/libcec-daemon-master/src/main.cpp:569: error: undefined reference to 'boost::program_options::options_description::options_description(std::string const&, unsigned int, unsigned int)'
/home/linuxlite/Downloads/libcec-daemon-master/build/boost_1_83_0/boost/program_options/detail/parsers.hpp:28: error: undefined reference to 'boost::program_options::detail::cmdline::cmdline(std::vector<std::string, std::allocator<std::string> > const&)'
/home/linuxlite/Downloads/libcec-daemon-master/build/boost_1_83_0/boost/program_options/detail/convert.hpp:79: error: undefined reference to 'boost::program_options::to_internal(std::string const&)'
CMakeFiles/libcec-daemon.dir/src/main.cpp.o:main.cpp:vtable for typed_value_name<HDMI::address>: error: undefined reference to 'boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::vector<std::string, std::allocator<std::string> > const&, bool) const'
CMakeFiles/libcec-daemon.dir/src/main.cpp.o:main.cpp:vtable for boost::program_options::typed_value<HDMI::address, char>: error: undefined reference to 'boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::vector<std::string, std::allocator<std::string> > const&, bool) const'
CMakeFiles/libcec-daemon.dir/src/main.cpp.o:main.cpp:vtable for typed_value_name<std::string>: error: undefined reference to 'boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::vector<std::string, std::allocator<std::string> > const&, bool) const'
CMakeFiles/libcec-daemon.dir/src/main.cpp.o:main.cpp:vtable for boost::program_options::typed_value<std::string, char>: error: undefined reference to 'boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::vector<std::string, std::allocator<std::string> > const&, bool) const'
CMakeFiles/libcec-daemon.dir/src/main.cpp.o:main.cpp:vtable for boost::program_options::invalid_option_value: error: undefined reference to 'boost::program_options::error_with_option_name::substitute_placeholders(std::string const&) const'
CMakeFiles/libcec-daemon.dir/src/main.cpp.o:main.cpp:vtable for boost::program_options::validation_error: error: undefined reference to 'boost::program_options::error_with_option_name::substitute_placeholders(std::string const&) const'
/home/linuxlite/Downloads/libcec-daemon-master/src/main.cpp:48: error: undefined reference to 'log4cplus::Logger::getInstance(std::string const&)'
/home/linuxlite/Downloads/libcec-daemon-master/build/boost_1_83_0/boost/program_options/detail/value_semantic.hpp:22: error: undefined reference to 'boost::program_options::arg'
/home/linuxlite/Downloads/libcec-daemon-master/build/boost_1_83_0/boost/program_options/detail/value_semantic.hpp:184: error: undefined reference to 'boost::program_options::validate(boost::any&, std::vector<std::string, std::allocator<std::string> > const&, std::string*, int)'
/home/linuxlite/Downloads/libcec-daemon-master/build/boost_1_83_0/boost/program_options/detail/value_semantic.hpp:22: error: undefined reference to 'boost::program_options::arg'
/home/linuxlite/Downloads/libcec-daemon-master/build/boost_1_83_0/boost/program_options/detail/value_semantic.hpp:95: error: undefined reference to 'boost::program_options::invalid_option_value::invalid_option_value(std::string const&)'
CMakeFiles/libcec-daemon.dir/src/main.cpp.o:main.cpp:vtable for boost::wrapexcept<boost::program_options::validation_error>: error: undefined reference to 'boost::program_options::error_with_option_name::substitute_placeholders(std::string const&) const'
CMakeFiles/libcec-daemon.dir/src/main.cpp.o:main.cpp:vtable for boost::wrapexcept<boost::program_options::invalid_option_value>: error: undefined reference to 'boost::program_options::error_with_option_name::substitute_placeholders(std::string const&) const'
/home/linuxlite/Downloads/libcec-daemon-master/src/libcec.cpp:44: error: undefined reference to 'log4cplus::Logger::getInstance(std::string const&)'
/home/linuxlite/Downloads/libcec-daemon-master/src/uinput.cpp:19: error: undefined reference to 'log4cplus::Logger::getInstance(std::string const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/libcec-daemon.dir/build.make:149: libcec-daemon] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/libcec-daemon.dir/all] Error 2
make: *** [Makefile:91: all] Error 2


Code CMake : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Nous voulons un cmake "récent" pour utiliser les dernières fonctionnalités
cmake_minimum_required(VERSION 3.0)
 
# Notre projet est étiqueté libcec-daemon
project(libcec-daemon)
 
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# set(CMAKE_CXX_EXTENSIONS OFF)
 
# set(CMAKE_CXX_FLAGS "-lboost_program_options")
# set(CMAKE_CXX_FLAGS_INIT "-Werror -Wall -Wextra -Wpedantic")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
 
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
        message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
 
# set(Boost_USE_STATIC_LIBS   ON)
 
set(Libcec_INCLUDE_DIR "/home/linuxlite/libcec/platform/include")
set(log4_INCLUDE_DIR "/home/linuxlite/Downloads/log4cplus-2.1.1/include")
 
find_package(Boost 1.83.0 REQUIRED)
if(Boost_FOUND)
    include_directories(include)
    set(Boost_INCLUDE_DIRS "/home/linuxlite/Downloads/libcec-daemon-master/build/boost_1_83_0")
    message("Boost_INCLUDE_DIRS=${Boost_INCLUDE_DIRS}")
    include_directories(${Boost_INCLUDE_DIRS})
endif()
 
include_directories(${Libcec_INCLUDE_DIR})
include_directories(${log4_INCLUDE_DIR})
 
# Crée des variables avec les fichiers à compiler
set(SRCS
    ./src/main.cpp
    ./src/hdmi.cpp
    ./src/libcec.cpp
    ./src/uinput.cpp
    )
 
set(HEADERS
    ./src/accumulator.hpp
    ./src/main.h
    ./src/hdmi.h
    ./src/libcec.h
    ./src/uinput.h
    )
 
add_library(externalLibA SHARED IMPORTED)
set_target_properties(externalLibA 
    PROPERTIES IMPORTED_LOCATION /usr/lib/x86_64-linux-gnu/liblog4cplus.so)
target_include_directories(externalLibA
    INTERFACE /usr/lib/x86_64-linux-gnu/)
 
add_library(externalLibB SHARED IMPORTED)
set_target_properties(externalLibB 
    PROPERTIES IMPORTED_LOCATION /usr/lib/x86_64-linux-gnu/libboost_program_options.so)
target_include_directories(externalLibB
    INTERFACE /usr/lib/x86_64-linux-gnu/)
 
add_library(externalLibC SHARED IMPORTED)
set_target_properties(externalLibC 
    PROPERTIES IMPORTED_LOCATION /usr/lib/x86_64-linux-gnu/libboost_thread.so)
target_include_directories(externalLibC
    INTERFACE /usr/lib/x86_64-linux-gnu/)
 
add_library(externalLibD SHARED IMPORTED)
set_target_properties(externalLibD 
    PROPERTIES IMPORTED_LOCATION /usr/lib/x86_64-linux-gnu/libcec.so)
target_include_directories(externalLibD
    INTERFACE /usr/lib/x86_64-linux-gnu/)
 
# On indique que l'on veut un exécutable compilé à partir des fichiers décrits par les variables SRCS et HEADERS
add_executable(libcec-daemon ${SRCS} ${HEADERS})
target_link_libraries(${PROJECT_NAME} PUBLIC externalLibA)
target_link_libraries(${PROJECT_NAME} PUBLIC externalLibB)
target_link_libraries(${PROJECT_NAME} PUBLIC externalLibC)
target_link_libraries(${PROJECT_NAME} PUBLIC externalLibD)