Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 803404 - net-im/toxic-0.10.1: error: 'PATH_MAX' undeclared here
Summary: net-im/toxic-0.10.1: error: 'PATH_MAX' undeclared here
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: JoMull01
Keywords: PullRequest
Depends on:
Blocks: missing-musl-includes
  Show dependency tree
Reported: 2021-07-22 18:29 UTC by Marinus Savoritias
Modified: 2021-08-24 08:50 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---

emerge --info (file_803404.txt,16.24 KB, text/plain)
2021-07-22 18:29 UTC, Marinus Savoritias
build log (file_803404.txt,830 bytes, text/plain)
2021-07-22 18:30 UTC, Marinus Savoritias
emerge -pqv Output (file_803404.txt,162 bytes, text/plain)
2021-07-22 18:31 UTC, Marinus Savoritias
patch for toxic-0.10.1 (toxic-0.10.1-NAME_MAX-and-PATH_MAX.patch,1.44 KB, patch)
2021-08-03 14:49 UTC, JoMull01
Details | Diff
Ebuild to use the patch (toxic-0.10.1-r1.ebuild,2.81 KB, text/plain)
2021-08-03 14:50 UTC, JoMull01
Build output from the custom repository test. (toxic-0.10.1:20210804-112315.log,24.33 KB, text/x-log)
2021-08-04 11:30 UTC, Marinus Savoritias
Error from the Git repository test. (file_803404.txt,1.73 KB, text/plain)
2021-08-04 11:32 UTC, Marinus Savoritias

Note You need to log in before you can comment on or make changes to this bug.
Description Marinus Savoritias 2021-07-22 18:29:00 UTC
Created attachment 725890 [details]
emerge --info

net-im/toxic-0.10.1::gentoo Fails with the following error:

var/tmp/portage/net-im/toxic-0.10.1/work/toxic-0.10.1/src/autocomplete.c:358:60: error: 'NAME_MAX' undeclared (first use in this function)
  358 |     char **dirnames = (char **) malloc_ptr_array(MAX_DIRS, NAME_MAX + 1);
      |                                                            ^~~~~~~~
/var/tmp/portage/net-im/toxic-0.10.1/work/toxic-0.10.1/src/autocomplete.c:358:60: note: each undeclared identifier is reported only once for each function it appears in
make: *** [Makefile:83: /var/tmp/portage/net-im/toxic-0.10.1/work/toxic-0.10.1/build/autocomplete.o] Error 1
make: *** Waiting for unfinished jobs....
In file included from /var/tmp/portage/net-im/toxic-0.10.1/work/toxic-0.10.1/src/avatars.h:26,
                 from /var/tmp/portage/net-im/toxic-0.10.1/work/toxic-0.10.1/src/avatars.c:27:
/var/tmp/portage/net-im/toxic-0.10.1/work/toxic-0.10.1/src/file_transfers.h:56:20: error: 'PATH_MAX' undeclared here (not in a function)
   56 |     char file_path[PATH_MAX + 1];    /* Not used by senders */

Attached the emerge --info and full build log.
Comment 1 Marinus Savoritias 2021-07-22 18:30:04 UTC
Created attachment 725893 [details]
build log
Comment 2 Marinus Savoritias 2021-07-22 18:31:14 UTC
Created attachment 725896 [details]
emerge -pqv Output
Comment 3 JoMull01 2021-08-03 14:49:27 UTC
Created attachment 729878 [details, diff]
patch for toxic-0.10.1
Comment 4 JoMull01 2021-08-03 14:50:24 UTC
Created attachment 729880 [details]
Ebuild to use the patch
Comment 5 JoMull01 2021-08-03 15:09:38 UTC
Good Morning. I apologize for my delay in responding. The problem that you found seems to be caused by the upstream including the wrong header file. It seems that GCC automatically includes the correct header and clang doesn't. Since it seems that clang would take a long time for me to set up, I hope that you would be willing to test my theory. This can be done in one of two ways. 
   First, you could add the patch that I have attached to ${YOUR_GENTOO_REPO}/net-im/toxic/files/ and the updated ebuild to ${YOUR_GENTOO_REPO}/net-im/toxic/ and let me know if that fixes the error. BTW, you may need to run "#repoman manifest" in the ${YOUR_GENTOO_REPO}/net-im/toxic/ directory before portage will use the new ebuild. Also, this change should be overwritten by your next sync. 
   Alternatively, you could download toxic directly, extract it and try to build it with clang. If the build fails, then add "#include <linux/limits.h>" to the following files: src/autocomplete.c, src/file_transfers.h and src/settings.h. Then try the build again. 
Let me know the results of whichever method you elect to try. Thanks for your assistance.
Comment 6 Marinus Savoritias 2021-08-04 11:27:47 UTC
Thanks for the reply. I tried both of the solutions.

the first one you said with the custom repository worked. toxic-0.10.1 is installed. I will attach the build log in case you find anything interesting.

The second solution didnt seem to work with the git repository.
I will attach the output.

Let me know for anything else I can help with.

Comment 7 Marinus Savoritias 2021-08-04 11:30:57 UTC
Created attachment 730104 [details]
Build output from the custom repository test.
Comment 8 Marinus Savoritias 2021-08-04 11:32:15 UTC
Created attachment 730106 [details]
Error from the Git repository test.
Comment 9 JoMull01 2021-08-13 19:12:50 UTC
Thank you for your assistance. The patches are currently awaiting being pulled into the main tree.
Comment 10 Larry the Git Cow gentoo-dev 2021-08-24 08:50:34 UTC
The bug has been closed via the following commit(s):

commit 4ca7fb9be00c1d64e8d963012bca7fb0e64fb575
Author:     Josiah Mullins <>
AuthorDate: 2021-08-11 22:10:35 +0000
Commit:     Joonas Niilola <>
CommitDate: 2021-08-24 08:50:26 +0000

    net-im/toxic: Fix incorrect header file inclusion
    It seems that the upstream developer believes that
    the macros NAME_MAX and PATH_MAX are defined in
    <limits.h> when they are really defined in
    <linux/limits.h>. More interestingly, it seems
    that GCC automatically corrects for this while
    clang does not. This commit adds patches necessary
    to fix this as well as some minor fixes.
    Signed-off-by: Josiah Mullins <>
    Signed-off-by: Joonas Niilola <>

 .../files/toxic-0.10.1-NAME_MAX-and-PATH_MAX.patch | 49 ++++++++++++++++++++++
 .../files/toxic-0.8.3-NAME_MAX-and-PATH_MAX.patch  | 49 ++++++++++++++++++++++
 ...{toxic-0.10.1.ebuild => toxic-0.10.1-r1.ebuild} | 14 +++++--
 ...toxic-0.8.3-r2.ebuild => toxic-0.8.3-r3.ebuild} | 11 +++--
 4 files changed, 115 insertions(+), 8 deletions(-)