darlinghq / darling

Darwin/macOS emulation layer for Linux

Home Page:http://www.darlinghq.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fedora 38 build error: no support for implicit function declarations errors?

thatsysadmin opened this issue · comments

Build Log
When trying to build on Fedora 38, going about 8 percent into the build process, clang will end up complaining about C99 (the standard) and up not supporting implicit function declarations. At the end of the file, the Makefile throws an error code of 2, but the actual error text spat out by clang is near the 6 percent mark; not at the end. Any thoughts on how to get the build working? Thanks!

log.txt

Build steps

git clone --recursive ssh://git@github.com/darlinghq/darling.git
mkdir build
cd build
cmake ..
make -j32
<observe error>

System Information

Software Version
Clang 16.0.4-1.fc38
CMake 3.26.4-3.fc38
Linux Kernel 6.3.4-201.fc38.x86_64
Darling 894d62c

I am observing following error on F38 w/ GCC version 13.1.1 20230614 and Clang version 16.0.5.

/2TB/usr/src/github.com/darling/src/external/xnu/darling/src/libsystem_kernel/emulation/linux/fdpath.c:14:9: error: call to undeclared function 'vchroot_fdpath'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] return vchroot_fdpath(&args); ^ /2TB/usr/src/github.com/darling/src/external/xnu/darling/src/libsystem_kernel/emulation/linux/fdpath.c:14:9: note: did you mean 'vchroot_expand'? /2TB/usr/src/github.com/darling/src/external/xnu/darling/src/libsystem_kernel/emulation/linux/vchroot_expand.h:24:5: note: 'vchroot_expand' declared here int vchroot_expand(struct vchroot_expand_args* args); ^ 1 error generated.

Hello @thatsysadmin and @1div0,

I'm currently working on a fix to resolve this issue. For the time being, try switching to the fedora_38_fix branch (don't forget to update your submodules after switching branches). Let me know if you run into any issues.

@CuriousTommy

Cool. Thanks for looking into this. I'm going to try to build that branch tonight or tommorow afternoon. I'll let you know how it goes.

@CuriousTommy

Hmm. Got 3 errors before stopping at around 11 percent.

I'm still getting the C99 implicit function error (it only threw once this time, and seems like it came from an Apple source?), and a new thing that's popped up is "unknown compiler"; not 100% sure what that means; it can't find a specific version of clang on my box?

/mnt/ramdisk/darling/src/external/security/trust/trustd/OTATrustUtilities.m:321:9: error: call to undeclared function 'CFPreferencesAppValueIsForced'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    if (CFPreferencesAppValueIsForced(kSecSUScanPrefConfigDataInstallKey, kSecSUPrefDomain)) {
        ^
1 warning generated.
1 error generated.
make[2]: *** [src/external/security/trust/trustd/CMakeFiles/libtrustd.dir/build.make:118: src/external/security/trust/trustd/CMakeFiles/libtrustd.dir/OTATrustUtilities.m.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /mnt/ramdisk/darling/src/external/system_cmds/reboot.tproj/kextmanager.defs:1:
/mnt/ramdisk/darling/basic-headers/TargetConditionals.h:335:10: error: TargetConditionals.h: unknown compiler (see comment above)
        #error TargetConditionals.h: unknown compiler (see comment above)
         ^
1 error generated.

Here's the full output of the build if needed.
stderr.txt
stdout.txt

I saw this:

/2TB/usr/src/github.com/darling/src/external/xnu/darling/src/libsystem_kernel/emulation/linux/fdpath.c:14:9: error: call to undeclared function 'vchroot_fdpath'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        return vchroot_fdpath(&args);
               ^
/2TB/usr/src/github.com/darling/src/external/xnu/darling/src/libsystem_kernel/emulation/linux/fdpath.c:14:9: note: did you mean 'vchroot_expand'?
/2TB/usr/src/github.com/darling/src/external/xnu/darling/src/libsystem_kernel/emulation/linux/vchroot_expand.h:24:5: note: 'vchroot_expand' declared here
int vchroot_expand(struct vchroot_expand_args* args);
    ^
1 error generated.
make[2]: *** [src/external/xnu/darling/src/libsystem_kernel/emulation/linux/CMakeFiles/emulation.dir/build.make:220: src/external/xnu/darling/src/libsystem_kernel/emulation/linux/CMakeFiles/emulation.dir/fdpath.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:14529: src/external/xnu/darling/src/libsystem_kernel/emulation/linux/CMakeFiles/emulation.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

Hmm. Got 3 errors before stopping at around 11 percent.

I'm still getting the C99 implicit function error (it only threw once this time, and seems like it came from an Apple source?), and a new thing that's popped up is "unknown compiler"; not 100% sure what that means; it can't find a specific version of clang on my box?

/mnt/ramdisk/darling/src/external/security/trust/trustd/OTATrustUtilities.m:321:9: error: call to undeclared function 'CFPreferencesAppValueIsForced'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    if (CFPreferencesAppValueIsForced(kSecSUScanPrefConfigDataInstallKey, kSecSUPrefDomain)) {
        ^
1 warning generated.
1 error generated.
make[2]: *** [src/external/security/trust/trustd/CMakeFiles/libtrustd.dir/build.make:118: src/external/security/trust/trustd/CMakeFiles/libtrustd.dir/OTATrustUtilities.m.o] Error 1
make[2]: *** Waiting for unfinished jobs....

Can you cd into src/external/corefoundation/submodules/swift-corelibs-foundation and report what git status returns. It looks like swift-corelibs-foundation might have not been updated (did you recursively update your submodules).

In file included from /mnt/ramdisk/darling/src/external/system_cmds/reboot.tproj/kextmanager.defs:1:
/mnt/ramdisk/darling/basic-headers/TargetConditionals.h:335:10: error: TargetConditionals.h: unknown compiler (see comment above)
        #error TargetConditionals.h: unknown compiler (see comment above)
         ^
1 error generated.

I'm not sure what is causing that... The only theory I have is that maybe the wrong compiler was being used. Try deleting your current build and create a new build.


I saw this:

/2TB/usr/src/github.com/darling/src/external/xnu/darling/src/libsystem_kernel/emulation/linux/fdpath.c:14:9: error: call to undeclared function 'vchroot_fdpath'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        return vchroot_fdpath(&args);
               ^
/2TB/usr/src/github.com/darling/src/external/xnu/darling/src/libsystem_kernel/emulation/linux/fdpath.c:14:9: note: did you mean 'vchroot_expand'?
/2TB/usr/src/github.com/darling/src/external/xnu/darling/src/libsystem_kernel/emulation/linux/vchroot_expand.h:24:5: note: 'vchroot_expand' declared here
int vchroot_expand(struct vchroot_expand_args* args);
    ^
1 error generated.
make[2]: *** [src/external/xnu/darling/src/libsystem_kernel/emulation/linux/CMakeFiles/emulation.dir/build.make:220: src/external/xnu/darling/src/libsystem_kernel/emulation/linux/CMakeFiles/emulation.dir/fdpath.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:14529: src/external/xnu/darling/src/libsystem_kernel/emulation/linux/CMakeFiles/emulation.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

Did you update your submodules?

Retried:

[ 12%] Building CXX object src/external/objc4/runtime/CMakeFiles/objc_obj.dir/objc-runtime.mm.o
In file included from /2TB/usr/src/github.com/darling/src/external/objc4/runtime/objc-runtime.mm:37:
In file included from /2TB/usr/src/github.com/darling/src/external/objc4/runtime/objc-private.h:1217:
/2TB/usr/src/github.com/darling/src/external/objc4/runtime/objc-object.h:152:13: warning: 'this' pointer cannot be null in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion]
    return !this;
           ~^~~~
/2TB/usr/src/github.com/darling/src/external/objc4/runtime/objc-runtime.mm:128:2: error: mismatch in debug-ness macros
#error mismatch in debug-ness macros
 ^
1 warning and 1 error generated.
make[2]: *** [src/external/objc4/runtime/CMakeFiles/objc_obj.dir/build.make:384: src/external/objc4/runtime/CMakeFiles/objc_obj.dir/objc-runtime.mm.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:20653: src/external/objc4/runtime/CMakeFiles/objc_obj.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

real	14m24,688s
user	9m2,512s
sys	4m53,110s
commented

I'm building on the branch fedora_38_fix with Fedora 38 as well. there was nested submodule you need to make sure git status shows nothing, otherwise git submodule update and in mycase a further git -C src/external/corefoundation submodule update

I can build with no errors.

commented

I do get crash of darlingserver from dmesg, after I see Cannot open mnt namespace file: No such file or directory

+[Mon Jun 26 21:36:36 2023] overlayfs: upperdir is in-use as upperdir/workdir of another mount, accessing files from both mounts will result in undefined behavior.
+[Mon Jun 26 21:36:36 2023] overlayfs: workdir is in-use as upperdir/workdir of another mount, accessing files from both mounts will result in undefined behavior.
+[Mon Jun 26 21:36:36 2023] darlingserver[1091754]: segfault at 63f000 ip 00000000004f618f sp 00007ffc124fa010 error 6 in darlingserver[408000+172000] likely on CPU 51 (core 25, socket 0)
+[Mon Jun 26 21:36:36 2023] Code: 00 00 00 00 00 e8 71 25 ff ff 48 89 45 d8 48 89 55 e0 48 8b 45 d8 48 89 45 e8 48 8b 45 e8 48 89 45 f0 48 8b 4d f0 48 8b 45 f8 <48> 89 0c c5 f0 41 62 00 48 8b 7d f0 31 f6 ba a0 04 00 00 e8 b9 23
+[Mon Jun 26 21:37:22 2023] overlayfs: upperdir is in-use as upperdir/workdir of another mount, accessing files from both mounts will result in undefined behavior.
+[Mon Jun 26 21:37:22 2023] overlayfs: workdir is in-use as upperdir/workdir of another mount, accessing files from both mounts will result in undefined behavior.
+[Mon Jun 26 21:37:22 2023] darlingserver[1092219]: segfault at 63f000 ip 00000000004f618f sp 00007ffd690ae030 error 6 in darlingserver[408000+172000] likely on CPU 38 (core 2, socket 0)
+[Mon Jun 26 21:37:22 2023] Code: 00 00 00 00 00 e8 71 25 ff ff 48 89 45 d8 48 89 55 e0 48 8b 45 d8 48 89 45 e8 48 8b 45 e8 48 89 45 f0 48 8b 4d f0 48 8b 45 f8 <48> 89 0c c5 f0 41 62 00 48 8b 7d f0 31 f6 ba a0 04 00 00 e8 b9 23
+[Mon Jun 26 21:38:17 2023] overlayfs: upperdir is in-use as upperdir/workdir of another mount, accessing files from both mounts will result in undefined behavior.
+[Mon Jun 26 21:38:17 2023] overlayfs: workdir is in-use as upperdir/workdir of another mount, accessing files from both mounts will result in undefined behavior.
+[Mon Jun 26 21:38:17 2023] darlingserver[1092427]: segfault at 63f000 ip 00000000004f618f sp 00007ffe633f0660 error 6 in darlingserver[408000+172000] likely on CPU 51 (core 25, socket 0)
+[Mon Jun 26 21:38:17 2023] Code: 00 00 00 00 00 e8 71 25 ff ff 48 89 45 d8 48 89 55 e0 48 8b 45 d8 48 89 45 e8 48 8b 45 e8 48 89 45 f0 48 8b 4d f0 48 8b 45 f8 <48> 89 0c c5 f0 41 62 00 48 8b 7d f0 31 f6 ba a0 04 00 00 e8 b9 23

I do get crash of darlingserver from dmesg, after I see Cannot open mnt namespace file: No such file or directory

+[Mon Jun 26 21:36:36 2023] overlayfs: upperdir is in-use as upperdir/workdir of another mount, accessing files from both mounts will result in undefined behavior.
+[Mon Jun 26 21:36:36 2023] overlayfs: workdir is in-use as upperdir/workdir of another mount, accessing files from both mounts will result in undefined behavior.
+[Mon Jun 26 21:36:36 2023] darlingserver[1091754]: segfault at 63f000 ip 00000000004f618f sp 00007ffc124fa010 error 6 in darlingserver[408000+172000] likely on CPU 51 (core 25, socket 0)
+[Mon Jun 26 21:36:36 2023] Code: 00 00 00 00 00 e8 71 25 ff ff 48 89 45 d8 48 89 55 e0 48 8b 45 d8 48 89 45 e8 48 8b 45 e8 48 89 45 f0 48 8b 4d f0 48 8b 45 f8 <48> 89 0c c5 f0 41 62 00 48 8b 7d f0 31 f6 ba a0 04 00 00 e8 b9 23
+[Mon Jun 26 21:37:22 2023] overlayfs: upperdir is in-use as upperdir/workdir of another mount, accessing files from both mounts will result in undefined behavior.
+[Mon Jun 26 21:37:22 2023] overlayfs: workdir is in-use as upperdir/workdir of another mount, accessing files from both mounts will result in undefined behavior.
+[Mon Jun 26 21:37:22 2023] darlingserver[1092219]: segfault at 63f000 ip 00000000004f618f sp 00007ffd690ae030 error 6 in darlingserver[408000+172000] likely on CPU 38 (core 2, socket 0)
+[Mon Jun 26 21:37:22 2023] Code: 00 00 00 00 00 e8 71 25 ff ff 48 89 45 d8 48 89 55 e0 48 8b 45 d8 48 89 45 e8 48 8b 45 e8 48 89 45 f0 48 8b 4d f0 48 8b 45 f8 <48> 89 0c c5 f0 41 62 00 48 8b 7d f0 31 f6 ba a0 04 00 00 e8 b9 23
+[Mon Jun 26 21:38:17 2023] overlayfs: upperdir is in-use as upperdir/workdir of another mount, accessing files from both mounts will result in undefined behavior.
+[Mon Jun 26 21:38:17 2023] overlayfs: workdir is in-use as upperdir/workdir of another mount, accessing files from both mounts will result in undefined behavior.
+[Mon Jun 26 21:38:17 2023] darlingserver[1092427]: segfault at 63f000 ip 00000000004f618f sp 00007ffe633f0660 error 6 in darlingserver[408000+172000] likely on CPU 51 (core 25, socket 0)
+[Mon Jun 26 21:38:17 2023] Code: 00 00 00 00 00 e8 71 25 ff ff 48 89 45 d8 48 89 55 e0 48 8b 45 d8 48 89 45 e8 48 8b 45 e8 48 89 45 f0 48 8b 4d f0 48 8b 45 f8 <48> 89 0c c5 f0 41 62 00 48 8b 7d f0 31 f6 ba a0 04 00 00 e8 b9 23

I'm assuming this happens when you try to run darling shell, correct?

I uninstalled my current install of Darling (by using tools/uninstall) and reinstalled Darling. I was able to get into the Darling shell.

$ darling shell
Bootstrapping the container with launchd...
libEGL warning: egl: failed to create dri2 screen

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
Darling [/Volumes/SystemRoot/home/thomasa]$

Is this your first time running Darling on your machine? Did you have a prior install of Darling? if so, how old was it?

I'm building on the branch fedora_38_fix with Fedora 38 as well. there was nested submodule you need to make sure git status shows nothing, otherwise git submodule update and in mycase a further git -C src/external/corefoundation submodule update

I can build with no errors.

A more easier option would be to use git submodule update --init --recursive

@CuriousTommy

I looked through my zsh history and when I did the submodule update I didn't do it recursively, so I think that fixed it. Haven't tried to use the build yet. I have to do that later.

It built succuessfully, but I can't install it at the moment with CMAKE_INSTALL_PREFIX yet.

I did the build SSH'd into my machine from my phone hastily, so I might've missed something.

It built succuessfully, but I can't install it at the moment with CMAKE_INSTALL_PREFIX yet.

I did the build SSH'd into my machine from my phone hastily, so I might've missed something.

So if I'm understanding you correctly, when you did sudo make install, some error occurred?

I was trying to point the install to a folder in a tmpfs, so I ran make install without sudo. I was apparently trying to set CMAKE_INSTALL_PREFIX as an environment variable, I should've used -DCMAKE_INSTALL_PREFIX=<arbitrary path>. That was my goof. Other than that, it's working. But to answer your question, yes saying that it couldn't write to files due to permissions, but that was my problem.

When I tried setting the install directory as an environment variable, what did happen is that it couldn't write to the default install directory because it ended up never picking up the environment variable.

Running ./darling shell with sudo privileges is working now, albeit with a load of SELinux errors. Darling complains of not having setuid root on itself if I run it as myself, although I'm pretty sure my tmpfs has nosuid on it, so that might eb the issue. I haven't ran anything else on it yet though. I'll probably try the Xcode tools later this week with a past project of mine.

At the moment I'm trying to feed it a hello world rust binary. I'm trying to build that binary on the host Linux machine.

Rebuild with the debug configuration succeeded after small modification of the make file by skipping compilation of securityd_ucspc.

So far so good, Darling shell is working.

Albeit:
Darling [/Volumes/SystemRoot/2TB/Downloads/Apple]$ unxip Xcode_15_beta_2.xip Segmentation fault: 11 (core dumped)

So digging deeper.

@1div0
I managed to get the Xcode CLI tools installed (same version, 15b2), but when running clang, it thinks that the version of macOS is too old. So even if you did get it to install, it probably wouldn't have ran.

@CuriousTommy
Off topic, and this might be a stupid question, but is there a way to get a macOS 13 environment instead of a macOS 11 one?

Off topic, and this might be a stupid question, but is there a way to get a macOS 13 environment instead of a macOS 11 one?

You can update the macOS version number in the SystemVersion.plist file.

Albeit: Darling [/Volumes/SystemRoot/2TB/Downloads/Apple]$ unxip Xcode_15_beta_2.xip Segmentation fault: 11 (core dumped)

So digging deeper.

@1div0 There is a ticket opened about this issue: #1380

FTR It just works!™

Darling [/Volumes/SystemRoot/home/peter.kovar/Apple/macOS/14.0]$ /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang helloworld.c -arch x86_64 -arch arm64 -o helloworld
Darling [/Volumes/SystemRoot/home/peter.kovar/Apple/macOS/14.0]$ file helloworld
file: File 5.39 supports only version 16 magic files. `/usr/share/file/magic.mgc' is version 14
helloworld: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64:Mach-O 64-bit executable arm64]
helloworld (for architecture x86_64):	Mach-O 64-bit executable x86_64
helloworld (for architecture arm64):	Mach-O 64-bit executable arm64
commented

Hi 1div0, I had similar problems unxip gives me segmentation fault, what did you do to fix it?
(btw I had to give up on Fedora38 and used Ubuntu22.04 to enter darling shell, above is when I was in Ubuntu22.04)

@fay2003hiend For issues related to unxip segfaulting, please discuss it in #1380