Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot build oil-0.26.0 on macOS: error: use of undeclared identifier 'GLOB_PERIOD' #2226

Open
latin-1 opened this issue Jan 8, 2025 · 4 comments

Comments

@latin-1
Copy link

latin-1 commented Jan 8, 2025

There will be 3 errors:

  • error: use of undeclared identifier 'GLOB_PERIOD'
  • error: call to undeclared function 'PyUnicode_AS_DATA'
  • error: call to undeclared function 'PyUnicode_GET_DATA_SIZE'

The last two can be suppressed by -Wno-implicit-function-declaration, but the first one requires some code changes.

Full logs:
~/Downloads/oil-0.26.0 took 4s
❯ make
build/ovm-compile.sh build-opt _build/oil/ovm-opt _build/oil/module_init.c _build/oil/main_name.c _build/oil/c-module-srcs.txt
~/Downloads/oil-0.26.0/Python-2.7.13 ~/Downloads/oil-0.26.0
Objects/frameobject.c:613:18: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
  613 | int _PyFrame_Init()
      |                  ^
      |                   void
1 warning generated.
Python/getargs.c:1034:21: warning: variable 'encoding' set but not used [-Wunused-but-set-variable]
 1034 |         const char *encoding;
      |                     ^
1 warning generated.
Python/pyarena.c:131:12: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
  131 | PyArena_New()
      |            ^
      |             void
1 warning generated.
Python/sysmodule.c:1187:22: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
 1187 | Py_SubversionRevision()
      |                      ^
      |                       void
Python/sysmodule.c:1194:25: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
 1194 | Py_SubversionShortBranch()
      |                         ^
      |                          void
2 warnings generated.
Modules/_sre.c:2393:17: warning: variable 'literal' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
 2393 |             if (b == 1) {
      |                 ^~~~~~
Modules/_sre.c:2404:13: note: uninitialized use occurs here
 2404 |         if (literal) {
      |             ^~~~~~~
Modules/_sre.c:2393:13: note: remove the 'if' if its condition is always true
 2393 |             if (b == 1) {
      |             ^~~~~~~~~~~
 2394 |                     literal = sre_literal_template((unsigned char *)ptr, n);
 2395 |             } else {
      |               ~~~~~~
 2396 | #if defined(HAVE_UNICODE)
      | ~~~~~~~~~~~~~~~~~~~~~~~~~
 2397 |                     literal = sre_uliteral_template((Py_UNICODE *)ptr, n);
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2398 | #endif
      | ~~~~~~
 2399 |             }
      |             ~
Modules/_sre.c:2389:20: note: initialize the variable 'literal' to silence this warning
 2389 |         int literal;
      |                    ^
      |                     = 0
1 warning generated.
../pyext/fastfunc.c:37:46: warning: passing 'unsigned char *' to parameter of type 'const char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
   37 |   PyObject *ret = PyString_FromStringAndSize(out.data, out.len);
      |                                              ^~~~~~~~
Include/stringobject.h:62:63: note: passing argument to parameter here
   62 | PyAPI_FUNC(PyObject *) PyString_FromStringAndSize(const char *, Py_ssize_t);
      |                                                               ^
../pyext/fastfunc.c:53:46: warning: passing 'unsigned char *' to parameter of type 'const char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
   53 |   PyObject *ret = PyString_FromStringAndSize(out.data, out.len);
      |                                              ^~~~~~~~
Include/stringobject.h:62:63: note: passing argument to parameter here
   62 | PyAPI_FUNC(PyObject *) PyString_FromStringAndSize(const char *, Py_ssize_t);
      |                                                               ^
../pyext/fastfunc.c:97:15: warning: passing 'char *' to parameter of type 'const unsigned char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
   97 |   utf8_decode(string + start, &decode_result);
      |               ^~~~~~~~~~~~~~
../data_lang/utf8.h:98:53: note: passing argument to parameter 'input' here
   98 | static inline void utf8_decode(const unsigned char *input,
      |                                                     ^
3 warnings generated.
../pyext/libc.c:409:54: error: use of undeclared identifier 'GLOB_PERIOD'
  409 |       PyModule_AddIntConstant(module, "GLOB_PERIOD", GLOB_PERIOD);
      |                                                      ^
1 error generated.
Modules/operator.c:312:44: error: call to undeclared function 'PyUnicode_AS_DATA'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  312 |         rc = _tscmp((const unsigned char *)PyUnicode_AS_DATA(a),
      |                                            ^
Modules/operator.c:312:21: warning: cast to 'const unsigned char *' from smaller integer type 'int' [-Wint-to-pointer-cast]
  312 |         rc = _tscmp((const unsigned char *)PyUnicode_AS_DATA(a),
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Modules/operator.c:313:21: warning: cast to 'const unsigned char *' from smaller integer type 'int' [-Wint-to-pointer-cast]
  313 |                     (const unsigned char *)PyUnicode_AS_DATA(b),
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Modules/operator.c:314:21: error: call to undeclared function 'PyUnicode_GET_DATA_SIZE'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  314 |                     PyUnicode_GET_DATA_SIZE(a),
      |                     ^
2 warnings and 2 errors generated.
../pyext/posixmodule.c:190:13: warning: result of comparison of constant 9223372036854775807 with expression of type 'uid_t' (aka 'unsigned int') is always true [-Wtautological-constant-out-of-range-compare]
  190 |     if (uid <= LONG_MAX)
      |         ~~~ ^  ~~~~~~~~
../pyext/posixmodule.c:198:13: warning: result of comparison of constant 9223372036854775807 with expression of type 'gid_t' (aka 'unsigned int') is always true [-Wtautological-constant-out-of-range-compare]
  198 |     if (gid <= LONG_MAX)
      |         ~~~ ^  ~~~~~~~~
2 warnings generated.
make: *** [_build/oil/ovm-opt] Error 1
@andychu
Copy link
Contributor

andychu commented Jan 9, 2025

Thanks for the report!

I'm not sure why this happened, but I'm going to prioritize the oils-for-unix bugs

The oil tarball is OLD, more like the "reference implementation" ... and oils-for-unix is what people should actually use

Not sure if these bugs are OS X specific or not, I don't think we changed anything with OS X

@cideM
Copy link

cideM commented Feb 3, 2025

I am seeing the same thing in Nixpkgs, which uses the oils-for-unix tarball as far as I can tell from this.

  src = fetchurl {
    url = "https://www.oils.pub/download/oils-for-unix-${version}.tar.gz";
    hash = "sha256-K1spWld6J2OBQgO0o0iAygMGeinuuAr0hXtgkjFNbu0=";
  };

@andychu
Copy link
Contributor

andychu commented Feb 3, 2025

Thanks for the report - the oils-for-unix tarball bug was fixed and will be out with the next release - d25e4df

(The oil- tarball bug is not fixed yet. We may not fix it soon, since that is the slow Python implementation, not the recommended tarball )

@cideM
Copy link

cideM commented Feb 4, 2025

In case someone else stumbles upon this issue and is equally rusty when it comes to Nix patches, here's how I am working around the issue until the above commit has been released:

      (self: super: {
        oils-for-unix = super.oils-for-unix.overrideAttrs (old: {
          patches = [./oils_patch.diff];
        });
      })

with the patch file being the commit linked above just with .diff added to the URL, like this

diff --git a/configure b/configure
index 8d7efbaa9..4b69e26c0 100755
--- a/configure
+++ b/configure
@@ -528,6 +528,7 @@ echo_cpp() {
     echo '#define HAVE_GLOB_PERIOD 1'
   else
     echo '#define HAVE_GLOB_PERIOD 0'
+    echo '#define GLOB_PERIOD 0  /* define bit flag to have no effect */'
   fi
 
   # Used by cpp/core.cc

Downgrading to 0.25.0 didn't work since this seems to also be affected by the GLOB_PERIOD issue on my Darwin machine.

cideM added a commit to cideM/dotfiles that referenced this issue Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants