[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Building fastnetmon on mipsel





Patrick Matthäi <patrick@linux-dev.org> 于2022年5月5日周四 19:54写道:

Hello mips(el) porters,

(please CC us, we are not subscribed).

We are trying to build fastnetmon on mipsel, without success. Maybe you can help us on fixing this?:

/usr/bin/c++ -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wl,-z,relro -Wl,-z,now -rdynamic CMakeFiles/fastnetmon.dir/fastnetmon.cpp.o -o fastnetmon  -latomic libgraphite_metrics.a libinfluxdb_metrics.a -lgpr -lgrpc++ -lgrpc libfastnetmon_grpc_pb_cc.a libfastnetmon_pb_cc.a -lprotobuf -lhiredis -lmongoc-1.0 -lbson-1.0 -llog4cpp -lpthread libpatricia.a libfastnetmon_pcap_format.a libipfix_rfc.a libfast_library.a libunified_parser.a -lssl -lcrypto libgobgp_action.a libexabgp_action.a libafpacket_plugin.a libsflow_plugin.a libnetflow_plugin.a libpcap_plugin.a libexample_plugin.a libfastnetmon_logic.a /usr/lib/mipsel-linux-gnu/libboost_thread.so.1.74.0 /usr/lib/mipsel-linux-gnu/libboost_atomic.so.1.74.0 -lpthread /usr/lib/mipsel-linux-gnu/libboost_regex.so.1.74.0 /usr/lib/mipsel-linux-gnu/libboost_program_options.so.1.74.0 /usr/lib/mipsel-linux-gnu/libboost_system.so.1.74.0 libpatricia.a libfastnetmon_pcap_format.a libsimple_packet_capnp.a -lcapnp -lkj -ljson-c -lssl -lcrypto -lgpr -lgrpc++ -lgrpc -lprotobuf libgobgp_api_client_pb_cc.a libgobgp_api_client_grpc_pb_cc.a libattribute_pb_cc.a libunified_parser.a libfastnetmon_packet_parser.a libsimple_packet_parser_ng.a libnetwork_data_structures.a liblibsflow.a libipfix_rfc.a libnetflow.a -lpcap -lhiredis -lmongoc-1.0 -lbson-1.0 libexabgp_action.a libbgp_protocol.a 
In this command,  libfastnetmon_logic.a is put after -latomic, while libfastnetmon_logic.a(fastnetmon_logic.cpp.o) uses symbols from libatomic.
Due to the limitation of gnu ld, -latomic should be put after  libfastnetmon_logic.a.

/usr/bin/ld: libfastnetmon_logic.a(fastnetmon_logic.cpp.o): undefined reference to symbol '__atomic_fetch_add_8@@LIBATOMIC_1.0'
/usr/bin/ld: /usr/lib/gcc/mipsel-linux-gnu/11/libatomic.so: error adding symbols: DSO missing from command line


-------- Weitergeleitete Nachricht --------
Betreff: Re: GoBGP and FastNetMon on Debian
Datum: Thu, 5 May 2022 11:33:33 +0100
Von: Pavel Odintsov <pavel.odintsov@gmail.com>
An: Patrick Matthäi <patrick@linux-dev.org>


Hello!

That's extremely strange indeed. 

Cmake claims that library is here: 
-- Performing Test HAVE__ATOMIC_ADD_FETCH - Failed
-- We have no __atomic_add_fetch, will try linking with libatomic
-- Looking for __atomic_add_fetch_8 in atomic
-- Looking for __atomic_add_fetch_8 in atomic - found
-- Linked with atomic library
-- Performing Test HAVE__SYNC_FETCH_AND_ADD
-- Performing Test HAVE__SYNC_FETCH_AND_ADD - Failed
-- We have no __sync_fetch_and_add on this platform, will try linking with libatomic
-- Looking for __sync_fetch_and_add_8 in atomic
-- Looking for __sync_fetch_and_add_8 in atomic - not found
-- We have no support for __sync_fetch_and_add in atomic library, skip linking
Do you have ssh access to any machine with this such architecture?
On Thu, 5 May 2022 at 10:37, Patrick Matthäi <patrick@linux-dev.org> wrote:


Am 05.05.2022 um 02:14 schrieb Pavel Odintsov:
Good morning!

I hope you liked your movie yesterday.

I did my side of task and resurrected logic which uses __atomic_add_fetch instead of __sync_fetch_and_add: https://github.com/pavel-odintsov/fastnetmon/commit/dad1c7b0b9fe16d24566649aa92d757050f4ec2a 

Good news that we have it in place for Debian build for multiple platforms we had issues previously: https://salsa.debian.org/debian/fastnetmon/-/blob/master/debian/rules#L11

Please keep me updated about mipsel builds.

We have some work to get rid of atomic increments and replace them by locks and I hope we will drop this magic in coming releases. 


On Wed, 4 May 2022 at 18:54, Pavel Odintsov <pavel.odintsov@gmail.com> wrote:
Hello!

Excellent!

Have a great evening! 

On Wed, 4 May 2022 at 18:54, Patrick Matthäi <patrick@linux-dev.org> wrote:
Yes i will try tomorrow, now i Went to the Cinema :)

Am 04.05.2022 19:45 schrieb Pavel Odintsov <pavel.odintsov@gmail.com>:
Hello!

It may be really fun but I even had fix for it back in time: https://github.com/pavel-odintsov/fastnetmon/commit/d5711bb3da43bff3f90a33c5d5ab9b5a262660c5 

I think it was removed during one of many code refactorings from previous years. 

I'll return this logic back shortly. 

Is it possible to set flag cmake .. -DUSE_NEW_ATOMIC_BUILTINS=ON only for mipsel targets? I'm not 100% sure about this patch to enable it for all platforms. 

Thank you! 

On Wed, 4 May 2022 at 18:41, Pavel Odintsov <pavel.odintsov@gmail.com> wrote:
Hello!

Oh, sad stuff indeed.

-- Will use new memory model aware atomic builtins
-- Performing Test HAVE__ATOMIC_ADD_FETCH
-- Performing Test HAVE__ATOMIC_ADD_FETCH - Failed
-- We have no __atomic_add_fetch, will try linking with libatomic
-- Looking for __atomic_add_fetch_8 in atomic
-- Looking for __atomic_add_fetch_8 in atomic - found
-- Linked with atomic library
-- Performing Test HAVE__SYNC_FETCH_AND_ADD
-- Performing Test HAVE__SYNC_FETCH_AND_ADD - Failed
-- We have no __sync_fetch_and_add on this platform, will try linking with libatomic
-- Looking for __sync_fetch_and_add_8 in atomic
-- Looking for __sync_fetch_and_add_8 in atomic - not found
-- We have no support for __sync_fetch_and_add in atomic library, skip linking

We actually linked with libatomic for __atomic_add_fetch but it looks like __sync_fetch_and_add_8 is missing from libatomic. 

But I found something in Debian's bug tracker: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=869805 which is quite insightful about this exact issue. 

On Wed, 4 May 2022 at 18:17, Patrick Matthäi <patrick@linux-dev.org> wrote:

https://buildd.debian.org/status/fetch.php?pkg=fastnetmon&arch=mipsel&ver=1.2.0%2Bgit20220504-1&stamp=1651682939&raw=0

Does not work :/ But I see the -latomic humpf..

Am 04.05.2022 um 14:49 schrieb Pavel Odintsov:
Hello!

Thank you for feedback.

I added some logic to fix it or at least confirm root cause of this issue with atomic: 

Would you mind adding this patch and trying build again?

Thank you!

On Tue, 3 May 2022 at 19:18, Patrick Matthäi <patrick@linux-dev.org> wrote:



--
YunQiang Su

Reply to: