git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Undefined reference to __builtin_ctzll

From
РЙРадослав Йовчев <radoslav.tm@gmail.com>
Date
Aug 13, 2014, 08:36 UTC
Message-ID
<CAAC8vw4EzaEM13TWzEW9QUuc-qdZFhPfEA9z1=KjCE0Brzotjg@mail.gmail.com>
Dear GIT community,

I found myself in situation where I had to install GIT on Debian 3.1 sarge. It comes with GCC 3.3.5. I tried to built from source but the libgcc was not providing the ctzll function, thus I decided to put an implementation.

I do not know how to post and do a nice patch (and whether somebody will care), but I guess, for reference I can post my solution. Just appended in compat/strlcpy.c the following:

int __builtin_ctzll (long long x)
{
        int i;
        for (i = 0; i < 8 * sizeof (long long); ++i)
                if (x & ((long long) 1  << i))
                        break;
        return i;
}

I guess that some ifdef macro can be used to detect compiler version or missing __builtin_ctzll.

With best regards and hopes that this can help somebody in similar situation, Radoslav.

Next: Erik Faye-Lund
Message 1 of 2 in “Undefined reference to __builtin_ctzll”
  1. Радослав ЙовчевAug 13, 2014
  2. Erik Faye-LundAug 13, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.