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

How to build oatpp on arm64? #898

Open
weidqi opened this issue Dec 4, 2023 · 4 comments
Open

How to build oatpp on arm64? #898

weidqi opened this issue Dec 4, 2023 · 4 comments

Comments

@weidqi
Copy link

weidqi commented Dec 4, 2023

Do I need any special parameters to compile oatpp on arm64? I compiled it as usual and only saw warnings but no static library was generated.
Would you do me a favor?
Thanks!

details:
cmake -DCMAKE_BUILD_TYPE=Release ..
-- The CXX compiler identification is GNU 8.5.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done

############################################################################
##oatpp module compilation config:

OATPP_DISABLE_ENV_OBJECT_COUNTERS=OFF
OATPP_THREAD_HARDWARE_CONCURRENCY=AUTO
OATPP_COMPAT_BUILD_NO_THREAD_LOCAL=OFF

############################################################################

oatpp version: '1.3.0'
-- Performing Test CXXFLAG_Warith_conversion
-- Performing Test CXXFLAG_Warith_conversion - Failed
-- Performing Test CXXFLAG_ftrivial_auto_var_init_zero
-- Performing Test CXXFLAG_ftrivial_auto_var_init_zero - Failed
-- Performing Test CXXFLAG_Warray_compare
-- Performing Test CXXFLAG_Warray_compare - Failed
-- Performing Test CXXFLAG_Wbidi_chars_unpaired_ucn
-- Performing Test CXXFLAG_Wbidi_chars_unpaired_ucn - Failed
-- Performing Test CXXFLAG_Winfinite_recursion
-- Performing Test CXXFLAG_Winfinite_recursion - Failed
-- Performing Test CXXFLAG_Wopenacc_parallelism
-- Performing Test CXXFLAG_Wopenacc_parallelism - Failed
-- Performing Test CXXFLAG_Wtrivial_auto_var_init
-- Performing Test CXXFLAG_Wtrivial_auto_var_init - Failed
-- Performing Test CXXFLAG_Wcomma_subscript
-- Performing Test CXXFLAG_Wcomma_subscript - Failed
-- Performing Test CXXFLAG_Wmismatched_tags
-- Performing Test CXXFLAG_Wmismatched_tags - Failed
-- Performing Test CXXFLAG_Wredundant_tags
-- Performing Test CXXFLAG_Wredundant_tags - Failed
-- Performing Test CXXFLAG_Wvolatile
-- Performing Test CXXFLAG_Wvolatile - Failed
-- Performing Test CXXFLAG_Wctad_maybe_unsupported
-- Performing Test CXXFLAG_Wctad_maybe_unsupported - Failed
-- Performing Test CXXFLAG_Wdeprecated_enum_enum_conversion
-- Performing Test CXXFLAG_Wdeprecated_enum_enum_conversion - Failed
-- Performing Test CXXFLAG_Wdeprecated_enum_float_conversion
-- Performing Test CXXFLAG_Wdeprecated_enum_float_conversion - Failed
-- Performing Test CXXFLAG_Winvalid_imported_macros
-- Performing Test CXXFLAG_Winvalid_imported_macros - Failed
-- Performing Test CXXFLAG_Wrange_loop_construct
-- Performing Test CXXFLAG_Wrange_loop_construct - Failed
-- Performing Test CXXFLAG_Wno_pessimizing_move
-- Performing Test CXXFLAG_Wno_pessimizing_move - Success
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
OATPP_ADD_LINK_LIBS=atomic

############################################################################
#oatpp-module-install.cmake

OATPP_THIS_MODULE_NAME=oatpp
OATPP_THIS_MODULE_VERSION=1.3.0
OATPP_THIS_MODULE_LIBRARIES=oatpp
OATPP_THIS_MODULE_TARGETS=oatpp
OATPP_THIS_MODULE_DIRECTORIES=oatpp

############################################################################

-- Configuring done
-- Generating done
-- Build files have been written to: /home/armer/Apps/oatpp-master/build
$make -j8
[ 52%] Building CXX object src/CMakeFiles/oatpp.dir/oatpp/network/monitor/ConnectionMonitor.cpp.o
In file included from /usr/include/arpa/inet.h:22,
from /home/armer/Apps/oatpp-master/src/oatpp/encoding/Unicode.cpp:30:
/home/armer/Apps/oatpp-master/src/oatpp/encoding/Unicode.cpp:121:105: Warnning:conversion from ‘v_uint32’ {aka ‘unsigned int’} to ‘__uint16_t’ {aka ‘short unsigned int’} may change value [-Wconversion]
(reinterpret_cast<p_int16>(buffer)) = static_cast<v_int16>(htons(((((code >> 6) & 31) | 192) << 8) | ((code & 63) | 128)));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
/home/armer/Apps/oatpp-master/src/oatpp/encoding/Unicode.cpp:124:108: Warnning:conversion from ‘v_uint32’ {aka ‘unsigned int’} to ‘_uint16_t’ {aka ‘short unsigned int’} may change value [-Wconversion]
*(reinterpret_cast<p_int16>(buffer)) = static_cast<v_int16>(htons((((( code >> 12 ) & 15) | 224) << 8) |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
(((code >> 6 ) & 63) | 128)));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/armer/Apps/oatpp-master/src/oatpp/encoding/Unicode.cpp:126:29: Warnning:conversion from ‘v_uint32’ {aka ‘unsigned int’} to ‘v_char8’ {aka ‘unsigned char’} may change value [-Wconversion]
buffer[2] = (code & 63) | 128;
~~~~~~~~~~~~^~~~~
/home/armer/Apps/oatpp-master/src/oatpp/encoding/Unicode.cpp:139:29: Warnning:conversion from ‘v_uint32’ {aka ‘unsigned int’} to ‘v_char8’ {aka ‘unsigned char’} may change value [-Wconversion]
buffer[4] = (code & 63) | 128;
~~~~~~~~~~~~^~~~~
In file included from /usr/include/arpa/inet.h:22,
from /home/armer/Apps/oatpp-master/src/oatpp/encoding/Unicode.cpp:30:
/home/armer/Apps/oatpp-master/src/oatpp/encoding/Unicode.cpp:146:110: Warnning:conversion from ‘v_uint32’ {aka ‘unsigned int’} to ‘uint16_t’ {aka ‘short unsigned int’} may change value [-Wconversion]
*(reinterpret_cast<p_int16>(&buffer[4])) = static_cast<v_int16>(htons(((((code >> 6 ) & 63) | 128) << 8) | (code & 63)));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
[ 53%] Building CXX object src/CMakeFiles/oatpp.dir/oatpp/network/tcp/Connection.cpp.o
[ 53%] Building CXX object src/CMakeFiles/oatpp.dir/oatpp/network/tcp/client/ConnectionProvider.cpp.o
[ 54%] Building CXX object src/CMakeFiles/oatpp.dir/oatpp/network/tcp/server/ConnectionProvider.cpp.o
[ 55%] Building CXX object src/CMakeFiles/oatpp.dir/oatpp/network/virtual
/Interface.cpp.o
[ 56%] Building CXX object src/CMakeFiles/oatpp.dir/oatpp/network/virtual
/Pipe.cpp.o
[ 57%] Building CXX object src/CMakeFiles/oatpp.dir/oatpp/network/virtual
/Socket.cpp.o
....
/home/armer/Apps/oatpp-master/src/oatpp/core/async/Coroutine.hpp:600:16: Warnning:function might be candidate for attribute ‘malloc’ if it is known to return normally [-Wsuggest-attribute=malloc]
static void
operator new(std::size_t sz) {
^~~~~~~~
In global :
cc1plus: Warnning:unrecognized command line option ‘-Wno-pessimizing-move’
In global :
cc1plus: Warnning:unrecognized command line option ‘-Wno-pessimizing-move’
In global :
cc1plus: Warnning:unrecognized command line option ‘-Wno-pessimizing-move’
In global :
cc1plus: Warnning:unrecognized command line option ‘-Wno-pessimizing-move’
In global :
cc1plus: Warnning:unrecognized command line option ‘-Wno-pessimizing-move’
In global :
cc1plus: Warnning:unrecognized command line option ‘-Wno-pessimizing-move’
In global :
cc1plus: Warnning:unrecognized command line option ‘-Wno-pessimizing-move’
In global :
cc1plus: Warnning:unrecognized command line option ‘-Wno-pessimizing-move’
In global :
cc1plus: Warnning:unrecognized command line option ‘-Wno-pessimizing-move’
[100%] Linking CXX static library liboatpp.a
[100%] Built target oatpp

@wlfsky
Copy link

wlfsky commented Dec 9, 2023

I build oatpp with aarch64-linux-gnu, arm-linux-gnueabihf;
build it with xilinx sdk 2018.3 arm32 and aarch64 ;
build it with zig build system arm32 and aarch64;

You must prepare openssl aarch64 , cmake 3.20+ and aarch64-linux-gnu first.
Ubuntu20.04 64
aarch64-linux-gnu-g++-10

oatpp src code in dir "oatpp-aarch64"

mkdir build-aarch64
cd build-aarch64

in Cmakelists.txt after first line:
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
set(CMAKE_SYSROOT "/usr/lib/x86_64-linux-gnu")
SET(CMAKE_C_COMPILER "/usr/bin/aarch64-linux-gnu-gcc-10")
SET(CMAKE_CXX_COMPILER "/usr/bin/aarch64-linux-gnu-g++-10")
SET(CC "/usr/bin/aarch64-linux-gnu-gcc-10")
SET(CXX "/usr/bin/aarch64-linux-gnu-g++-10")
set(CMAKE_C_FLAGS "-lpthread")
set(CMAKE_CXX_FLAGS "-lpthread")
SET(OPENSSL_LIBRARIES /home/weilai/oatpp/openssl/lib)
SET(OPENSSL_INCLUDE_DIR /home/weilai/oatpp/openssl/include)
SET(CMAKE_INSTALL_PREFIX "/home/weilai/oatpp/build-aarch64")

~/cmake/cmake-3.27.1-linux-x86_64/bin/cmake ../oatpp-aarch64
make && make install
running...
...................................ok

but..... the executable I compiled on aarch64 did not run successfully.
On arm32 with xilinx 2018.3 is success.

with zig build system build oatpp success. build executable success. but run server program crash!
malloc(): corrupted top size
at this code
AppComponent components;

So, I don't know if oatpp really supports the aarch64 platform.

I hope it helps.

By the way, I think you've compiled it. You just can't find the compiled library file!

@weidqi
Copy link
Author

weidqi commented Dec 12, 2023

Yes, the static library was not generated. Thank you for your help, I will try the method you suggested.

@wlfsky
Copy link

wlfsky commented Dec 12, 2023

"Cmakelists.txt", find
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
set to
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
build.....
it build static library.

@weidqi
Copy link
Author

weidqi commented Dec 15, 2023

Yes, using your method, the compilation for arm64 was also not successful. It is possible that it is not supported after all.

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

2 participants