Search code examples
capr

Compiling with APR. Error msg: "no decision has been made on APR_PATH_MAX for your platform"


I recently downloaded APR and successfully built it on my machine (Ubuntu 12.0.4). I included /path/to/apr_file_info.h to my project, and when I attempted to compile, I got the following error message:

no decision has been made on APR_PATH_MAX for your platform

Upon investigating the header file (apr.h), I found that the following directives are responsible:

#if defined(PATH_MAX)
#define APR_PATH_MAX       PATH_MAX
#elif defined(_POSIX_PATH_MAX)
#define APR_PATH_MAX       _POSIX_PATH_MAX
#else
#error no decision has been made on APR_PATH_MAX for your platform
#endif

The (naive?) solution would be to define these variables - but I am not sure if there would be any nasty effects for using the wrong size - and I am not sure the correct size to define for the compiler directive.

Why is ./configure not correctly determining my platform (Ubuntu 12.0.4), and how do I fix this?


Solution

  • On Linux, PATH_MAX should be defined in <linux/limits.h>. Include it before APR and it should solve your issue:

    #include <linux/limits.h>
    #include <path/to/apr_file_info.h>
    

    Note that including the standard header <limits.h> header should also include <linux/limits.h> or the relevant header on POSIX systems.

    The equivalent on Windows would be MAX_PATH, defined in <windef.h> if I remember correctly.