Skip to content

ARM (Raspberry PI) build #98

@lpezet

Description

@lpezet

I'm trying to build this project for ARM but I'm having an issue. Please bear with me as I'm very rusty when it comes to C/C++ builds.

During the cmake --build . process I get the following error:

[ 50%] Linking C executable hdr_histogram_test
/usr/bin/ld: ../src/libhdr_histogram_static.a(hdr_histogram.c.o): in function `counts_inc_normalised_atomic':
hdr_histogram.c:(.text+0x204): undefined reference to `__atomic_fetch_add_8'
/usr/bin/ld: hdr_histogram.c:(.text+0x220): undefined reference to `__atomic_fetch_add_8'
/usr/bin/ld: ../src/libhdr_histogram_static.a(hdr_histogram.c.o): in function `update_min_max_atomic':
hdr_histogram.c:(.text+0x2dc): undefined reference to `__atomic_load_8'
/usr/bin/ld: hdr_histogram.c:(.text+0x32c): undefined reference to `__atomic_compare_exchange_8'
/usr/bin/ld: hdr_histogram.c:(.text+0x354): undefined reference to `__atomic_load_8'
/usr/bin/ld: hdr_histogram.c:(.text+0x398): undefined reference to `__atomic_compare_exchange_8'
/usr/bin/ld: ../src/libhdr_histogram_static.a(hdr_writer_reader_phaser.c.o): in function `_hdr_phaser_get_epoch':
hdr_writer_reader_phaser.c:(.text+0x18): undefined reference to `__atomic_load_8'
/usr/bin/ld: ../src/libhdr_histogram_static.a(hdr_writer_reader_phaser.c.o): in function `_hdr_phaser_set_epoch':
hdr_writer_reader_phaser.c:(.text+0x58): undefined reference to `__atomic_store_8'
/usr/bin/ld: ../src/libhdr_histogram_static.a(hdr_writer_reader_phaser.c.o): in function `_hdr_phaser_reset_epoch':
hdr_writer_reader_phaser.c:(.text+0x8c): undefined reference to `__atomic_exchange_8'
/usr/bin/ld: ../src/libhdr_histogram_static.a(hdr_writer_reader_phaser.c.o): in function `hdr_phaser_writer_enter':
hdr_writer_reader_phaser.c:(.text+0x1c0): undefined reference to `__atomic_fetch_add_8'
/usr/bin/ld: ../src/libhdr_histogram_static.a(hdr_writer_reader_phaser.c.o): in function `hdr_phaser_writer_exit':
hdr_writer_reader_phaser.c:(.text+0x238): undefined reference to `__atomic_fetch_add_8'
collect2: error: ld returned 1 exit status
gmake[2]: *** [test/CMakeFiles/hdr_histogram_test.dir/build.make:120: test/hdr_histogram_test] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1007: test/CMakeFiles/hdr_histogram_test.dir/all] Error 2
gmake: *** [Makefile:182: all] Error 2

Now I went ahead, deleted my "build" folder and re-did it all like so:

LDFLAGS="-latomic" cmake ../HdrHistogram_c/
LDFLAGS="-latomic" cmake --build . -v

Got same error, but this time I can see this (thanks to "-v" argument):

/usr/bin/cc -latomic CMakeFiles/hdr_histogram_test.dir/hdr_histogram_test.c.o CMakeFiles/hdr_histogram_test.dir/minunit.c.o -o hdr_histogram_test  ../src/libhdr_histogram_static.a /usr/lib/arm-linux-gnueabihf/libz.so -lpthread -lm -lrt 

Now that won't work because -latomic is like first argument here.
But this works just fine, with -latomic at the end:

/usr/bin/cc CMakeFiles/hdr_histogram_test.dir/hdr_histogram_test.c.o CMakeFiles/hdr_histogram_test.dir/minunit.c.o -o hdr_histogram_test  ../src/libhdr_histogram_static.a /usr/lib/arm-linux-gnueabihf/libz.so -lpthread -lm -lrt  -latomic

What am I doing wrong? Anyone managed to build this project for ARM (Raspberry PI)?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions