PLCnext on Instagram  PLCnext on YouTube Github PLCnext CommunityStore PLCnext Community

 

 How to create a Blog Entry

x86 or ARM? Check your cross compilation with "readelf"

Using your own or other cross compiled executables is sometimes not clear documented for which target it was originally compiled. Compiling a Library for the AXC F 2152 means you have to compile it for an ARM architecture.
In such situation the tool "readelf" is very helpful and this manual demonstrates the usage with an example
(a more detailed description is available here).

 

 
Download
article

Usage of readelf and grep

Calling readelf gives a lot of output, it's better to pipe the output to grep to filter and view only what you need.

readelf -h libcpp_redis.a
grep 'Class\|File\|Machine'

Use the "|" pipe operator to send the output of readelf to grep as follows:

 readelf -h libcpp_redis.a | grep 'Class\|File\|Machine' 

This leads to the output
 File: libcpp_redis.a(future_client.cpp.o)
Class: ELF32
Machine: ARM
File: libcpp_redis.a(logger.cpp.o)
Class: ELF32
Machine: ARM
File: libcpp_redis.a(redis_client.cpp.o)
Class: ELF32
Machine: ARM
File: libcpp_redis.a(redis_subscriber.cpp.o)
Class: ELF32
Machine: ARM
File: libcpp_redis.a(reply.cpp.o)
Class: ELF32
Machine: ARM
File: libcpp_redis.a(redis_connection.cpp.o)
Class: ELF32
Machine: ARM
File: libcpp_redis.a(array_builder.cpp.o)
Class: ELF32
Machine: ARM
File: libcpp_redis.a(builders_factory.cpp.o)
Class: ELF32
Machine: ARM
File: libcpp_redis.a(bulk_string_builder.cpp.o)
Class: ELF32
Machine: ARM
File: libcpp_redis.a(error_builder.cpp.o)
Class: ELF32
Machine: ARM
File: libcpp_redis.a(integer_builder.cpp.o)
Class: ELF32
Machine: ARM
File: libcpp_redis.a(reply_builder.cpp.o)
Class: ELF32
Machine: ARM
File: libcpp_redis.a(simple_string_builder.cpp.o)
Class: ELF32
Machine: ARM

Yes it is compiled to be used on a ARM processor and you can use the binary on an AXC F 2152!