Re: __builtin_expect function isn't available in gcc below version 3

"'Richard Beckmann' via lua-l" <[email protected]>
Newsgroups gmane.comp.lang.lua.general
Message-ID <H4Snj57rBxbfywT3DfeCrTAeqxR91UcZVM1k8GQsyIec9fcKjUndU6c6vq4sYlmOezXz8RUEg36xzmI68twNklMaUubDy5viXLbrZBYQ7xU=@protonmail.com>
> Did you try to set `LUA_NOBUILTIN` with `CFLAGS`? e.g.:
>
> CFLAGS="-DLUA_NOBUILTIN" luarocks install ...

No, I didn't. But manually setting `-DLUA_NOBUILTIN` with CFLAGS is not what I'm looking for. If `-DLUA_NOBUILTIN` would work for me, LuaRocks would automatically apply `-DLUA_NOBUILTIN` behind the scene when running `luarocks install <package name>`. Though, I don't know if LuaRocks can be configured to do that.
Anyway, the Haiku developer Begasus and I chose to patch the headers, which does work for us. Also in my opinion, it's the easiest solution. It doesn't require to put `-DLUA_NOBUILTIN` almost everywhere.

Sent with [Proton Mail](https://proton.me/mail/home) secure email.

On Sunday, March 1st, 2026 at 8:12 AM, Christophe Delord <[email protected]> wrote:

> Hello,
>
> Le 01/03/2026 à 04:09, ‘Richard Beckmann’ via lua-l a écrit :
>
>>> In this case, just compile Lua with -DLUA_NOBUILTIN.
>>
>> Forgot to mention. I and the Haiku developer Begasus already tried `-DLUA_NOBUILTIN` and it wasn't good enough for us. `-DLUA_NOBUILTIN` works for compiling Lua but not when using headers to compile Lua/C modules with LuaRocks. LuaRocks doesn't issue `-DLUA_NOBUILTIN` when compiling Lua/C modules. So, to make building Lua/C modules with LuaRocks work as well, we were forced to patch the headers.
>
> Did you try to set LUA_NOBUILTIN with CFLAGS? e.g.:
>
> CFLAGS=
>
> "-DLUA_NOBUILTIN"
>
> luarocks install ...
>
>> Sent with Proton Mail secure email.
>>
>> On Saturday, February 28th, 2026 at 10:28 AM, Luiz Henrique de Figueiredo
>> [<[email protected]>](mailto:[email protected])
>> wrote:
>>
>>>> When compiling Lua 5.4.7 for Haiku targeting x86 32 bit using gcc 2 I encounter that '__builtin_expect' function isn't available.
>>>
>>> In this case, just compile Lua with -DLUA_NOBUILTIN.
>>>
>>> Thanks for the report and patch.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups "lua-l" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an email to
>>> [email protected]
>>> .
>>> To view this discussion visit
>>> https://groups.google.com/d/msgid/lua-l/CABt16qmjBW5iUXk36QW2Vkmon-Hxc7kB%2B35T4%3DOhVbZOESsyvQ%40mail.gmail.com
>>> .
>
> &#8203;
>
> --
> You received this message because you are subscribed to the Google Groups "lua-l" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
> To view this discussion visit https://groups.google.com/d/msgid/lua-l/dab36a4e-3d3a-4b9e-87d6-8060bac1508f%40cdelord.fr.

-- 
You received this message because you are subscribed to the Google Groups "lua-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/lua-l/H4Snj57rBxbfywT3DfeCrTAeqxR91UcZVM1k8GQsyIec9fcKjUndU6c6vq4sYlmOezXz8RUEg36xzmI68twNklMaUubDy5viXLbrZBYQ7xU%3D%40protonmail.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.