[Rpm-maint] [rpm-software-management/rpm] 6.0.1 - macOS fails to compile `rpmio/lposix.cc` (Issue #4139)

Michael Cho notifications at github.com
Sun Mar 8 22:36:30 UTC 2026


cho-m created an issue (rpm-software-management/rpm#4139)

**Describe the bug**
macOS fails to compile `rpmio/lposix.cc` from code at:
https://github.com/rpm-software-management/rpm/blob/4ea8622a8ffc2a5c24aaca754fd268f5d0b7032b/rpmio/lposix.cc#L425-L427

Error may have started since switch from C to C++.

Moving above code out of function seems to fix issue. Or using the `misc/system.h` environ but I haven't checked if that has any unintended side effects.

**To Reproduce**
Steps to reproduce the behavior:
1. Will need a macOS machine as specific to `__APPLE__` code
2. `cmake -S . -B _build -DENABLE_NLS=ON -DENABLE_PLUGINS=OFF -DWITH_AUDIT=OFF -DWITH_SELINUX=OFF -DENABLE_TESTSUITE=OFF -DWITH_ACL=OFF -DWITH_CAP=OFF -DWITH_LIBELF=OFF -DWITH_LIBDW=OFF && cmake --build _build`
3. Error encountered

**Expected behavior**
Successful build. 

**Output**
```
In file included from /private/tmp/rpm-20260308-63363-slerxg/rpm-6.0.1/rpmio/lposix.cc:426:
/Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk/usr/include/crt_externs.h:39:1: error: expected unqualified-id
   39 | __BEGIN_DECLS
      | ^
/Library/Developer/CommandLineTools/SDKs/MacOSX26.sdk/usr/include/sys/cdefs.h:71:32: note: expanded from macro '__BEGIN_DECLS'
   71 | #define __BEGIN_DECLS   extern "C" {
      |                                ^
/private/tmp/rpm-20260308-63363-slerxg/rpm-6.0.1/rpmio/lposix.cc:432:8: error: use of undeclared identifier '_NSGetEnviron'
  432 |                 if (*environ==NULL) lua_pushnil(L); else lua_newtable(L);
      |                      ^
/private/tmp/rpm-20260308-63363-slerxg/rpm-6.0.1/rpmio/lposix.cc:427:21: note: expanded from macro 'environ'
  427 |                 #define environ (*_NSGetEnviron())
      |                                   ^
/private/tmp/rpm-20260308-63363-slerxg/rpm-6.0.1/rpmio/lposix.cc:433:10: error: use of undeclared identifier '_NSGetEnviron'
  433 |                 for (e=environ; *e!=NULL; e++)
      |                        ^
/private/tmp/rpm-20260308-63363-slerxg/rpm-6.0.1/rpmio/lposix.cc:427:21: note: expanded from macro 'environ'
  427 |                 #define environ (*_NSGetEnviron())
      |                                   ^
3 errors generated.
```

**Environment**
 - OS / Distribution: macOS 26 Tahoe
 - Version: rpm 6.0.1

**Additional context**
Seen while trying to update Homebrew's package of `rpm` to latest version.



-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/4139
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/issues/4139 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20260308/039a12f0/attachment.htm>


More information about the Rpm-maint mailing list