Problems compiling version 1.8.x

Hi.
When trying to compile version 1.8.x, the following error occurs.

make TARGET=linux2628

……
src/queue.o: In function __pendconn_free': /root/haproxy-1.8.1/src/queue.c:292: undefined reference to__atomic_sub_fetch’
src/queue.o:/root/haproxy-1.8.1/src/queue.c:299: more undefined references to __atomic_sub_fetch' follow src/queue.o: In functionpendconn_add’:
/root/haproxy-1.8.1/src/queue.c:196: undefined reference to __atomic_add_fetch' /root/haproxy-1.8.1/src/queue.c:198: undefined reference to__atomic_compare_exchange_n’
/root/haproxy-1.8.1/src/queue.c:200: undefined reference to __atomic_add_fetch' /root/haproxy-1.8.1/src/queue.c:188: undefined reference to__atomic_add_fetch’
/root/haproxy-1.8.1/src/queue.c:190: undefined reference to __atomic_compare_exchange_n' src/queue.o: In functionpendconn_get_next_strm’:
/root/haproxy-1.8.1/src/queue.c:128: undefined reference to __atomic_add_fetch' /root/haproxy-1.8.1/src/queue.c:129: undefined reference to__atomic_add_fetch’
src/applet.o: In function __appctx_free': /root/haproxy-1.8.1/include/proto/applet.h:97: undefined reference to__atomic_sub_fetch’
src/memory.o: In function pool_gc': /root/haproxy-1.8.1/src/memory.c:188: undefined reference to__atomic_compare_exchange_n’
/root/haproxy-1.8.1/src/memory.c:209: undefined reference to __atomic_store_n' src/lb_fwrr.o: In functionfwrr_queue_srv’:
/root/haproxy-1.8.1/src/lb_fwrr.c:330: undefined reference to __atomic_sub_fetch' src/lb_fwrr.o: In functionfwrr_update_position’:
/root/haproxy-1.8.1/src/lb_fwrr.c:445: undefined reference to __atomic_add_fetch' /root/haproxy-1.8.1/src/lb_fwrr.c:453: undefined reference to__atomic_add_fetch’
/root/haproxy-1.8.1/src/lb_fwrr.c:454: undefined reference to __atomic_add_fetch' /root/haproxy-1.8.1/src/lb_fwrr.c:457: undefined reference to__atomic_sub_fetch’
/root/haproxy-1.8.1/src/lb_fwrr.c:458: undefined reference to __atomic_add_fetch' /root/haproxy-1.8.1/src/lb_fwrr.c:448: undefined reference to__atomic_sub_fetch’
/root/haproxy-1.8.1/src/lb_fwrr.c:449: undefined reference to __atomic_add_fetch' src/lb_fwrr.o: In functionfwrr_get_srv_next’:
/root/haproxy-1.8.1/src/lb_fwrr.c:362: undefined reference to __atomic_add_fetch' src/hathreads.o: In functionthread_sync_barrier’:
/root/haproxy-1.8.1/src/hathreads.c:108: undefined reference to __atomic_compare_exchange_n' /root/haproxy-1.8.1/src/hathreads.c:109: undefined reference to__atomic_or_fetch’
src/hathreads.o: In function thread_want_sync': /root/haproxy-1.8.1/src/hathreads.c:75: undefined reference to__atomic_or_fetch’
src/hathreads.o: In function thread_exit_sync': /root/haproxy-1.8.1/src/hathreads.c:142: undefined reference to__atomic_and_fetch’
src/hathreads.o: In function thread_sync_barrier': /root/haproxy-1.8.1/src/hathreads.c:108: undefined reference to__atomic_compare_exchange_n’
/root/haproxy-1.8.1/src/hathreads.c:109: undefined reference to __atomic_or_fetch' src/lb_map.o: In functionrecalc_server_map’:
/root/haproxy-1.8.1/src/lb_map.c:116: undefined reference to __atomic_add_fetch' /root/haproxy-1.8.1/src/lb_map.c:125: undefined reference to__atomic_add_fetch’
src/time.o: In function tv_update_date': /root/haproxy-1.8.1/src/time.c:228: undefined reference to__atomic_compare_exchange_n’
collect2: ld returned 1 exit status
make: *** [haproxy] Error 1

Is there anything else I need to compile the 1.8.x version?
There was no problem compiling from version 1.5.x to version 1.7.9 on this server.

Thanks.

Can you elaborate what system you are using? OS release, kernel, cc release?

OS : CentOS release 6.5 (Final)
kernel : 2.6.32-696.10.2.el6.x86_64 #1 SMP Tue Sep 12 14:33:29 UTC 2017
cc : gcc version 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC)

Thanks.

I guess your gcc release is just too old to compile haproxy 1.8 with threads.
Disabling thread support would make this work:

make clean; make TARGET=linux2628 USE_THREAD=

If you want to benefit from threads (or generally trying to get the best performance out of it), I strongly recommend upgrading to a more updated OS, like CentOs 7 or Ubuntu LTS.

Thanks @lukastribus

Compille was successful using the USE_THREAD = option.
I wonder what the minimum version of gcc release is required to use threads with version 1.8.x.

Thanks.

I believe you need at least GCC 4.7.

ok. I will try again later.

Thanks for your help.