When running a program compiled with the zlog logging library on an ARM chip, zlog_init() fails with the following error:
ERROR (zlog.c:178) pthread_rwlock_wrlock fail, rc[35]
The error code 35 corresponds to EDEADLK (Resource deadlock avoided), indicating a threading issue.
Steps to Reproduce:
Build zlog on an ARM cross-compilation environment using only make (no configure):
git clone https://github.com/HardySimpson/zlog.git
cd zlog
make clean
make CC=arm-linux-gnueabihf-gcc CFLAGS="-O2 -Wall -pthread" LDFLAGS="-lpthread"
make CC=arm-linux-gnueabihf-gcc PREFIX=/usr/local install
Create a simple test program (test_zlog.c):
#include <stdio.h>
#include "zlog.h"
int main() {
int rc = zlog_init("/etc/zlog.conf");
if (rc) {
printf("zlog initialization failed\n");
return -1;
}
zlog_info(zlog_get_category("default"), "Test log message");
zlog_fini();
return 0;
}
Compile the test program:
arm-linux-gnueabihf-gcc -o test_zlog test_zlog.c -lzlog -lpthread -ldl -lm \
-I/usr/local/include -L/usr/local/lib
Run the program on the ARM chip:
./test_zlog
Actual Result:
ERROR (zlog.c:178) pthread_rwlock_wrlock fail, rc[35]
zlog initialization failed
Expected Result:
Test log message
Environment:
ARM Processor: Amlogic-based ARM Cortex-A53 (4 cores)
OS: Minimal Linux (BusyBox environment)
Compiler: arm-linux-gnueabihf-gcc
zlog Version: 1.2.18
glibc Version: 2.19
Request:
Review the zlog Makefile for cross-compilation issues.
Provide guidance on using make without configure for ARM targets.
When running a program compiled with the zlog logging library on an ARM chip, zlog_init() fails with the following error:
ERROR (zlog.c:178) pthread_rwlock_wrlock fail, rc[35]
The error code 35 corresponds to EDEADLK (Resource deadlock avoided), indicating a threading issue.
Steps to Reproduce:
Build zlog on an ARM cross-compilation environment using only make (no configure):
Create a simple test program (test_zlog.c):
Compile the test program:
Run the program on the ARM chip:
./test_zlogActual Result:
Expected Result:
Test log messageEnvironment:
ARM Processor: Amlogic-based ARM Cortex-A53 (4 cores)
OS: Minimal Linux (BusyBox environment)
Compiler: arm-linux-gnueabihf-gcc
zlog Version: 1.2.18
glibc Version: 2.19
Request:
Review the zlog Makefile for cross-compilation issues.
Provide guidance on using make without configure for ARM targets.