Skip to content

Commit

Permalink
451 wrong platform toolset (#452)
Browse files Browse the repository at this point in the history
* Fixing issue with the toolset.
  • Loading branch information
aregtech authored Nov 20, 2024
1 parent c4cdc6e commit 9054631
Show file tree
Hide file tree
Showing 12 changed files with 47 additions and 35 deletions.
4 changes: 0 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ include(${AREG_CMAKE_CONFIG_DIR}/setup.cmake)
# set CMake tool settings
set(CMAKE_BUILD_TYPE ${AREG_BUILD_TYPE} CACHE STRING "Configuration Type" FORCE)

if (${AREG_COMPILER_FAMILY} MATCHES "llvm" AND WIN32)
set(CMAKE_GENERATOR_TOOLSET ClangCL)
endif()

# AREG SDK project name and version
set(AREG_PROJECT_NAME "areg-sdk")
set(AREG_PROJECT_VERSION "1.9.99.111")
Expand Down
22 changes: 16 additions & 6 deletions conf/cmake/functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,14 @@ endmacro(macro_guess_processor_architecture)
macro(macro_system_bitness var_bitness)
# Detect and set bitness here
# 8 bytes ==> 64-bits (x64) and 4 bytes ==> 32-nit (x86)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(${var_bitness} 64)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(${var_bitness} 32)
else()
set(${var_bitness} 0)
if (DEFINED CMAKE_SIZEOF_VOID_P)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(${var_bitness} 64)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(${var_bitness} 32)
else()
set(${var_bitness} 0)
endif()
endif()
endmacro(macro_system_bitness)

Expand Down Expand Up @@ -285,9 +287,17 @@ macro(macro_setup_compilers_data compiler_path compiler_family compiler_short co
set(${is_identified} FALSE)
if (DEFINED AREG_PROCESSOR)
set(${sys_platform} ${AREG_PROCESSOR})
elseif(DEFINED CMAKE_SYSTEM_PROCESSOR AND NOT "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "")
set(${sys_platform} ${CMAKE_SYSTEM_PROCESSOR})
endif()

if (DEFINED AREG_BITNESS)
set(${sys_bitness} ${AREG_BITNESS})
elseif(NOT ${sys_platform} STREQUAL "")
macro_get_processor(${sys_platform} ${sys_platform} ${sys_bitness} _ignore)
unset(_ignore)
else()
macro_system_bitness(${sys_bitness})
endif()

# Iterate over known compilers to identify the compiler type
Expand Down
6 changes: 6 additions & 0 deletions conf/cmake/setup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,17 @@ if (NOT "${AREG_C_COMPILER}" STREQUAL "")
endif()

if (WIN32)

if ("${AREG_COMPILER_FAMILY}" STREQUAL "llvm")
set(CMAKE_GENERATOR_TOOLSET ClangCL CACHE INTERNAL "Force ClangCL tool-set")
endif()

if (AREG_BITNESS EQUAL 32)
set(CMAKE_GENERATOR_PLATFORM Win32 CACHE INTERNAL "Force 32-bit compilation")
elseif (AREG_BITNESS EQUAL 64)
set(CMAKE_GENERATOR_PLATFORM x64 CACHE INTERNAL "Force 64-bit compilation")
endif()

endif()

# check and fix CXX standard for AREG Framework sources.
Expand Down
4 changes: 2 additions & 2 deletions conf/exports/logcollector.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Description=AREG TCP/IP Logging Service to collect application logs
StartLimitIntervalSec=1

[Service]
# Set the full path to logcollector.out file and start with option '--service'
ExecStart=@AREG_INSTALL_DST@/tools/@AREG_PACKAGE_NAME@/logcollector.out --service
# Set the full path to logcollector.elf file and start with option '--service'
ExecStart=@AREG_INSTALL_DST@/tools/@AREG_PACKAGE_NAME@/logcollector.elf --service
Type=simple
Restart=on-failure
RestartSec=1
Expand Down
4 changes: 2 additions & 2 deletions conf/exports/mcrouter.service.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Description=AREG TCP/IP Multicast Router Service to automate messaging
StartLimitIntervalSec=1

[Service]
# Set the full path to mcrouter.out file and start with option '--service'
ExecStart=@AREG_INSTALL_DST@/tools/@AREG_PACKAGE_NAME@/mcrouter.out --service
# Set the full path to mcrouter.elf file and start with option '--service'
ExecStart=@AREG_INSTALL_DST@/tools/@AREG_PACKAGE_NAME@/mcrouter.elf --service
Type=simple
Restart=on-failure
RestartSec=1
Expand Down
8 changes: 4 additions & 4 deletions docs/wiki/01b-cmake-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,10 @@ To compile AREG SDK for a 32-bit system, you need to specify the target bitness

To verify that a binary is 32-bit, navigate to the build directory and run:
```bash
file ./mcrouter.out
file ./mcrouter.elf
```
This command should output something like:
> ./mcrouter.out: ELF **32-bit** LSB pie executable, **Intel 80386**, version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux.so.2, BuildID[sha1]=3df1d5e3d1b90b9533b93a906cece6ff95fa816c, for GNU/Linux 3.2.0, not stripped
> ./mcrouter.elf: ELF **32-bit** LSB pie executable, **Intel 80386**, version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux.so.2, BuildID[sha1]=3df1d5e3d1b90b9533b93a906cece6ff95fa816c, for GNU/Linux 3.2.0, not stripped

Alternatively, you can run:
```bash
Expand Down Expand Up @@ -218,7 +218,7 @@ Cross-compiling for ARM processors requires an ARM-compatible toolchain and conf

Verify the architecture of the compiled binary with:
```bash
file ./mcrouter.out
file ./mcrouter.elf
```
This should output message `ELF 32-bit LSB executable, ARM, ...`.

Expand All @@ -244,7 +244,7 @@ For AARCH64 architecture, install the 64-bit ARM toolchain and configure CMake a

Verify the binary architecture:
```bash
file ./mcrouter.out
file ./mcrouter.elf
```
This should output message `ELF 64-bit LSB executable, ARM aarch64, ...`.

Expand Down
16 changes: 8 additions & 8 deletions docs/wiki/01d-wsl-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ cmake --build ./build -j
> [!TIP]
> To verify if an application is compiled for a 32-bit system, navigate to the build binary directory and use:
> ```bash
> file ./mcrouter.out
> file ./mcrouter.elf
> ```
> This command shows the binary's architecture. Example output for a 32-bit `mcrouter` binary:
> > ./mcrouter.out: ELF **32-bit** LSB pie executable, **Intel 80386**, version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux.so.2, BuildID[sha1]=3df1d5e3d1b90b9533b93a906cece6ff95fa816c, for GNU/Linux 3.2.0, not stripped
> > ./mcrouter.elf: ELF **32-bit** LSB pie executable, **Intel 80386**, version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux.so.2, BuildID[sha1]=3df1d5e3d1b90b9533b93a906cece6ff95fa816c, for GNU/Linux 3.2.0, not stripped
>
> Alternatively, run:
> ```bash
Expand Down Expand Up @@ -181,8 +181,8 @@ Then configure and build AREG SDK binaries:
cmake -B ./build -DAREG_PROCESSOR=arm -DAREG_COMPILER_FAMILY=gnu
cmake --build ./build -j
```
Check the binary with `file ./mcrouter.out`. If successful, you'll see output like:
> ./mcrouter.out: ELF **32-bit** LSB executable, **ARM**, EABI5 version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux.so.3, BuildID[sha1]=c606ea5ce7be9cb1175fd87587b5975e235c084e, for GNU/Linux 3.2.0, not stripped
Check the binary with `file ./mcrouter.elf`. If successful, you'll see output like:
> ./mcrouter.elf: ELF **32-bit** LSB executable, **ARM**, EABI5 version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux.so.3, BuildID[sha1]=c606ea5ce7be9cb1175fd87587b5975e235c084e, for GNU/Linux 3.2.0, not stripped
### CMake for 64-bit ARM Build with GNU
To compile for a 64-bit ARM system, install the appropriate toolchain:
Expand All @@ -194,8 +194,8 @@ Then configure and build AREG SDK binaries:
cmake -B ./build -DAREG_PROCESSOR=aarch64 -DAREG_COMPILER_FAMILY=gnu
cmake --build ./build -j
```
Check the binary with `file ./mcrouter.out`. Successful output will look like:
> ./mcrouter.out: ELF **64-bit** LSB pie executable, **ARM aarch64**, version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=bcf786a8c893b950868addecbc347d24518a25cd, for GNU/Linux 3.7.0, not stripped
Check the binary with `file ./mcrouter.elf`. Successful output will look like:
> ./mcrouter.elf: ELF **64-bit** LSB pie executable, **ARM aarch64**, version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=bcf786a8c893b950868addecbc347d24518a25cd, for GNU/Linux 3.7.0, not stripped
For more information, refer to the **[AREG SDK Build Guide](./01b-cmake-build.md)**.
Expand All @@ -208,9 +208,9 @@ Navigate to the SDK root directory, e.g.,:
cd /mnt/c/projects/areg-sdk/
```
Run applications located in the `bin` directory, such as `10_locservice.out`:
Run applications located in the `bin` directory, such as `10_locservice.elf`:
```bash
./product/build/llvm-clang++/linux-64-x86_64-release/bin/10_locservice.out
./product/build/llvm-clang++/linux-64-x86_64-release/bin/10_locservice.elf
```
Sample output:
Expand Down
6 changes: 3 additions & 3 deletions docs/wiki/02a-cmake-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@ The following are the available CMake options to configure the AREG SDK build. O
> [!TIP]
> To check if an application has been compiled for a 32-bit or 64-bit system, navigate to the build binary directory and run:
> ```bash
> file ./mcrouter.out
> file ./mcrouter.elf
> ```
> This command displays the binary's architecture. For example, the output for a 32-bit `mcrouter` binary may appear as:
> > ./mcrouter.out: ELF **32-bit** LSB pie executable, **Intel 80386**, version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux.so.2, BuildID[sha1]=3df1d5e3d1b90b9533b93a906cece6ff95fa816c, for GNU/Linux 3.2.0, not stripped
> > ./mcrouter.elf: ELF **32-bit** LSB pie executable, **Intel 80386**, version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux.so.2, BuildID[sha1]=3df1d5e3d1b90b9533b93a906cece6ff95fa816c, for GNU/Linux 3.2.0, not stripped
> Alternatively, use the following command to check specific details in the ELF header:
> ```bash
Expand Down Expand Up @@ -372,7 +372,7 @@ sudo cmake --install ./product/cache/llvm
-- AREG: >>> Binary Output Dir ..: '/mnt/c/projects/areg-sdk/product/build/llvm-clang++/linux-64-x86_64-release-shared/bin'
-- AREG: >>> Generated Files Dir : '/mnt/c/projects/areg-sdk/product/generate'
-- AREG: >>> Packages Dir .......: '/mnt/c/projects/areg-sdk/product/packages'
-- AREG: >>> Build Modules ......: areg = 'shared', aregextend = static, areglogger = 'shared', executable extension '.out'
-- AREG: >>> Build Modules ......: areg = 'shared', aregextend = static, areglogger = 'shared', executable extension '.elf'
-- AREG: >>> Java Version .......: '17.0.12', Java executable = '/usr/bin/java', minimum version required = 17
-- AREG: >>> Packages Use .......: SQLite3 package use = 'ON', GTest package use = 'ON'
-- AREG: >>> Other Options ......: Examples = 'OFF', Unit Tests = 'OFF', AREG Extended = 'OFF', Logs = 'ON'
Expand Down
2 changes: 1 addition & 1 deletion framework/logcollector/resources/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ logcollector --service

Before installing `logcollector` under the Linux, make sure that the location of the `logcollector` executable
is properly set in the `logcollector.service` file.
Check the script `ExecStart=/usr/local/bin/logcollector.out --service`.
Check the script `ExecStart=/usr/local/bin/logcollector.elf --service`.
Change the path if you have another location. Make sure that `config/areg.init` is
in the same directory with `logcollector`.

Expand Down
4 changes: 2 additions & 2 deletions framework/logcollector/resources/logcollector.service
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Description=AREG TCP/IP Logging Service to collect application logs
StartLimitIntervalSec=1

[Service]
# Set the full path to logcollector.out file and start with option '--service'
ExecStart=/usr/local/bin/logcollector.out --service
# Set the full path to logcollector.elf file and start with option '--service'
ExecStart=/usr/local/bin/logcollector.elf --service
Type=simple
Restart=on-failure
RestartSec=1
Expand Down
2 changes: 1 addition & 1 deletion framework/mcrouter/resources/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mcrouter --service

## Install under Linux

Before installing `mcrouter` under the Linux, make sure that the location of the `mcrouter` executable is properly set in the `mcrouter.service` file. Check the script `ExecStart=/usr/local/bin/mcrouter.out --service`. Change the path if you have another location. Make sure that `config/areg.init` is in the same directory with `mcrouter`.
Before installing `mcrouter` under the Linux, make sure that the location of the `mcrouter` executable is properly set in the `mcrouter.service` file. Check the script `ExecStart=/usr/local/bin/mcrouter.elf --service`. Change the path if you have another location. Make sure that `config/areg.init` is in the same directory with `mcrouter`.

To install the `mcrouter` under Linux, use `mcrouter.service` file and perform following steps:
1. Copy `mcrouter.service` to the `/etc/systemd/system/` directory. For example, run this script:
Expand Down
4 changes: 2 additions & 2 deletions framework/mcrouter/resources/mcrouter.service
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Description=AREG TCP/IP Multicast Router Service to automate messaging
StartLimitIntervalSec=1

[Service]
# Set the full path to mcrouter.out file and start with option '--service'
ExecStart=/usr/local/bin/mcrouter.out --service
# Set the full path to mcrouter.elf file and start with option '--service'
ExecStart=/usr/local/bin/mcrouter.elf --service
Type=simple
Restart=on-failure
RestartSec=1
Expand Down

0 comments on commit 9054631

Please sign in to comment.