Menu

#150 Problems when compiling application against log4cpp (1.1.3).

Feature Request
closed-fixed
5
2026-03-23
2019-08-16
No

Cross compiler: ARM64 (version 7.4.0)
Host: ubuntu 18.04
Compiling with -std=c++17

Successfully cross compiled log4cpp (1.1.3) source for arm64 on Ubuntu 18.04.
When I compile our application against log4cpp, we get following error message: "Naming collision for 'DEBUG' detected. Please read the FAQ for a workaround".

I read FAQ and defined LOG4CPP_FIX_ERROR_COLLISION to 1. Then I got, ERROR is not defined. I think I am seeing this issue because Linux defined ERROR as #define ERROR.
Any immediate solution would be appreciated.

Discussion

  • Alexander Perepelkin

    Library version log4cpp (1.1.6) includes examples folder, which builds smaller programs using the library.

    I've run a test to ensure cross compilation with g++-aarch64-linux-gnu works and binary is able to log lines using the library when clean build is used:

    x86_64 host running Ubuntu 24.04 and cross compiling log4cpp for aarch64 builds example binary and executes it well:

    cd log4cpp-codegit
    mkdir build-arm64
    cd build-arm64
    cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain-x86_64-aarch64.cmake -DLOG4CPP_BUILD_EXAMPLES=ON  -DCMAKE_BUILD_TYPE=Release
    make 
    
    cd examples/cmake_usages/log4cpp_as_package/
    
    file ./log4cpp_as_package_example
    ./log4cpp_as_package_example: ELF 64-bit LSB pie executable, ARM aarch64
    
    qemu-aarch64 -L /usr/aarch64-linux-gnu ./log4cpp_as_package_example_static
    2026-03-23 19:39:05,792 [INFO] Hello, log4cpp 1.1.6 library as imported cmake package!
    

    cmake/toolchain-x86_64-aarch64.cmake

    set(CMAKE_SYSTEM_NAME Linux)
    set(CMAKE_SYSTEM_PROCESSOR aarch64)
    
    set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
    set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++)
    
    set(CMAKE_FIND_ROOT_PATH
        /usr/lib/aarch64-linux-gnu
        /usr/aarch64-linux-gnu
    )
    
    set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
    set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
    set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
    set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
    
     
  • Alexander Perepelkin

    • labels: log4cpp, Cross compiler: ARM64 (version 7.4.0) Host: ubuntu 18.04 Compiling with -std=c++17 Successfully cross compiled log4cpp (1.1.3) source for arm64 on Ubuntu 18.04. When I compile our application against log4cpp, we get following error message: "Naming collision for 'DEBUG' detected. Please read the FAQ for a workaround". I read FAQ and defined LOG4CPP_FIX_ERROR_COLLISION to 1. Then I got, ERROR is not defined. I think I am seeing this issue because Linux defined ERROR as #define ERROR. Any immediate solution would be appreciated. --> cross compiling
    • status: open --> closed-fixed
    • assigned_to: Alexander Perepelkin
     

Log in to post a comment.

MongoDB Logo MongoDB