Project

General

Profile

Bug #1634

undefined reference to `__sync_fetch_and_add_4'

Added by Randy M over 11 years ago. Updated over 11 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Category:
General
Target version:
-
Start date:
2013-02-19
Due date:
% Done:

0%

Estimated time:
Found in version:
3.3
Affected Versions:

Description

After seeing this PR being pulled https://github.com/tvheadend/tvheadend/commit/eaec34220b9c7960b80e7bb9481521f04985b1d9 i tried to compile it for my ARM Based Synology to see if it would succeed now. (using Synology toolchain)
It didn't and it returned this error: undefined reference to `__sync_fetch_and_add_4' and this undefined reference to `__sync_fetch_and_add_8'

Is this something i can fix by using a somewhat older atomic.h file or a piece of it something like this https://github.com/tvheadend/tvheadend/commit/6bb8d14bd3178e23804230f3dd105ef481a12f47#L0R88

http://pastebin.com/UPisBHRR

Get the same error when compiling it directly on my NAS.

History

#1

Updated by Randy M over 11 years ago

GCC version used is 4.2.1

#2

Updated by Adam Sutton over 11 years ago

  • Status changed from New to Rejected

That commit is somewhat misleading and I'm not entirely sure how they were compiling with GCC 4.2 (unless that was related to TVH 3.2) as this is no longer support due to use of GCC atomic intrinsic ops. The changes were merged as they are generally good things.

But you might want to contact the author, maybe they have another solution (i.e. custom replacement for atomics?) to the problem. Nothing will be done in TVH though, it's too much hassle to maintain such ops for a plethora of platforms when support already exists in later versions of GCC.

Adam

#3

Updated by Andrew M. over 11 years ago

Adam Sutton wrote:

That commit is somewhat misleading and I'm not entirely sure how they were compiling with GCC 4.2 (unless that was related to TVH 3.2) as this is no longer support due to use of GCC atomic intrinsic ops.

I'm the author of the gcc4.2 PR. Atomics were added no later than gcc4.1, according to this link.

I'm pretty sure Randy's issue has to do with his processor (and perhaps a bug in gcc), not his compiler version. Another synology user had success building with gcc4.2 by specifying ARCH=native. That does not seem to work for non-atom processors though.

I just noticed a small build issue with gcc4.2.x has crept into the trunk in the last month which I intend to issue a PR for:

src/tvhtime.c: In function ‘tvhtime_update’:
src/tvhtime.c:98: warning: implicit declaration of function ‘llabs’
src/tvhtime.c:98: warning: incompatible implicit declaration of built-in function ‘llabs’

However if you remove "-Werror" from the Makefile it compiles fine.

#4

Updated by Andrew M. over 11 years ago

...on x64/i686 anyway

#5

Updated by Randy M over 11 years ago

I also noticed the successful compiling directly on Synology NAS but in my case i'm using the Synology toolchain found in SynoCommunity spksrc. https://github.com/SynoCommunity/spksrc/blob/develop/README.rst

I can compile it on my NAS but i prefer packages at this moment ;)

Maybe someone finds out how to get this working with Syno's toolchain but for now i'll stick with version 3.2.18

#6

Updated by virtual dj over 11 years ago

Hi, I have the same llabs error when compiling with gcc 4.3.2.
By removing the -Werror parameter from the Makefile it builds succesfully.

You'll say that the gcc version is somewhat old, and that's true, but when compiling for embedded systems like QNAP and Synology you haven't a lot of choices unfortunately.

Do you think that the makefile workaround is acceptable or not? Or, better, are you planning to fix this small issue in the upcomings gits?
I'm not asking about the "__sync_fetch_and_add_4" but the "warning: incompatible implicit declaration of built-in function ‘llabs’".

#7

Updated by virtual dj over 11 years ago

Sometimes after posting the ideas arrive...
After documenting on the llabs function, it seems that when using old gcc version you have to define _ISOC9X_SOURCE, see: http://linux.die.net/man/3/llabs.

Don't know if it's correct (I do not know C at all) but it works, so I've submitted PR270.

Also available in: Atom PDF