Closed CarterLi closed 2 years ago
LLDB
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x00000001c343ed98 libsystem_kernel.dylib`__pthread_kill + 8
libsystem_kernel.dylib`__pthread_kill:
-> 0x1c343ed98 <+8>: b.lo 0x1c343edb8 ; <+40>
0x1c343ed9c <+12>: pacibsp
0x1c343eda0 <+16>: stp x29, x30, [sp, #-0x10]!
0x1c343eda4 <+20>: mov x29, sp
Target 0: (fastfetch) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
* frame #0: 0x00000001c343ed98 libsystem_kernel.dylib`__pthread_kill + 8
frame #1: 0x00000001c3473ee0 libsystem_pthread.dylib`pthread_kill + 288
frame #2: 0x00000001c33ae340 libsystem_c.dylib`abort + 168
frame #3: 0x00000001c32908c0 libsystem_malloc.dylib`malloc_vreport + 552
frame #4: 0x00000001c32a5c84 libsystem_malloc.dylib`malloc_zone_error + 100
frame #5: 0x00000001c3287088 libsystem_malloc.dylib`szone_free + 664
frame #6: 0x00000001c34bf768 CoreFoundation`__CFStringCreateImmutableFunnel3 + 1588
frame #7: 0x00000001c3517c84 CoreFoundation`CFStringCreateWithCStringNoCopy + 100
frame #8: 0x000000010001a0f8 fastfetch`ffDetectGPUImpl + 788
frame #9: 0x00000001000123f4 fastfetch`ffDetectGPU + 152
frame #10: 0x0000000100017558 fastfetch`ffPrintGPU + 128
frame #11: 0x00000001000014ec fastfetch`parseStructureCommand + 868
frame #12: 0x0000000100000f30 fastfetch`main + 256
frame #13: 0x000000010004908c dyld`start + 520
I think i fixed it, can you please test? I can't really test the code, because my VM refuses to start when emulating a graphics card, so i am stuck with software rendering...
How about adding a github runner running on macOS?
Number of processes is not right ( ok I saw the hard coded zero )
Tbh I prefer the color palette of neofetch. I found the --color
switch, but the switch changes both the color of title and keys. Can I change the color of keys to yellow (33) and leave the color of title to green?
Tbh I prefer the color palette of neofetch. I found the --color switch, but the switch changes both the color of title and keys. Can I change the color of keys to yellow (33) and leave the color of title to green?
You can now change them independently by --color-keys
and --color-title
, but they are the same as neofetch by default now.
brew package detection should be working. Are those installed as directories in /usr/local/Caskroom
or /usr/local/Cellar
?
brew package detection should be working. Are those installed as directories in
/usr/local/Caskroom
or/usr/local/Cellar
?
For arm64 they are installed in /opt/homebrew
Use env variable $HOMEBREW_PREFIX
should be a better option
Full screenshot on my physical machine
Brew package count should now be working on M1 macs too.
The code was wrong.
$HOMEBREW_PREFIX
is /opt/homebrew
on M1 or /usr/local
on Intel. You still need to check its subfolder
eg
$ ls $HOMEBREW_PREFIX/Cellar/ | wc -l
229
$ ls $HOMEBREW_PREFIX/Caskroom/ | wc -l
8
$ brew ls | wc -l
237
I suggest that you should assume brew
doesn't exist if $HOMEBREW_PREFIX
doesn't exit and don't hard code paths
I have a running Apple M1 server ( which is used for running github actions currently ). I can give you the ssh user name and password if you need a working machine to test
I am in the process of setting up something similar for myself, but thanks for the offer.
I think i finally got brew packages right, its working on both my tests machines now.
Brew packages worked, GPU didnt work still
Might be that i need to hardcode GPU for M1 CPUs, since the gpu isn't connected via PCI anymore, but part of the actual chip. Wouldn't be surprised if system_profiler
does the same thing, but sadly it doesn't seem to be open source...
Did that. If it works for you, i think i now have decent enough Apple support to release 1.7.1 and carry on with different features.
Running on my old intel MBP
Might be that i need to hardcode GPU for M1 CPUs
That seems cheating. Even for Apple silicon, macOS supports discrete GPUs.
There are some open source projects to consult. For example: https://github.com/exelban/stats/tree/master/Modules/GPU
That seems cheating. Even for Apple silicon, macOS supports discrete GPUs.
In the current code, i add a GPU with the name of CPU, if the CPU starts with Apple M
. I still go through all PCI devices, so discrete GPUs should still be detected.
There are some open source projects to consult. For example: https://github.com/exelban/stats/tree/master/Modules/GPU
They do exactly what i do, iterating over IOPCIDevice
, i can't find how they handle M1. But it does contain some other interesting code, thanks for pointing out!
Vulkan ( MoltenVK ) works fine on macOS
Dirty code ( need vulkan sdk installed )
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 96cbc4b..2691902 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -24,7 +24,7 @@ endif()
include(CMakeDependentOption)
cmake_dependent_option(ENABLE_LIBPCI "Enable libpci" ON "LINUX" OFF)
-cmake_dependent_option(ENABLE_VULKAN "Enable vulkan" ON "LINUX" OFF)
+cmake_dependent_option(ENABLE_VULKAN "Enable vulkan" ON "LINUX OR APPLE" OFF)
cmake_dependent_option(ENABLE_WAYLAND "Enable wayland-client" ON "LINUX" OFF)
cmake_dependent_option(ENABLE_XCB_RANDR "Enable xcb-randr" ON "LINUX" OFF)
cmake_dependent_option(ENABLE_XCB "Enable xcb" ON "LINUX" OFF)
diff --git a/src/detection/vulkan.c b/src/detection/vulkan.c
index 43a208f..151122d 100644
--- a/src/detection/vulkan.c
+++ b/src/detection/vulkan.c
@@ -11,6 +11,12 @@
#include <stdlib.h>
#include <vulkan/vulkan.h>
+#ifdef __APPLE__
+# define FF_SO_EXTENSION ".dylib"
+#else
+# define FF_SO_EXTENSION ".so"
+#endif
+
static inline void applyVulkanVersion(uint32_t vulkanVersion, FFVersion* ffVersion)
{
ffVersion->major = VK_VERSION_MAJOR(vulkanVersion);
@@ -35,7 +41,7 @@ static void applyDriverName(VkPhysicalDeviceDriverProperties* properties, FFstrb
static void detectVulkan(const FFinstance* instance, FFVulkanResult* result)
{
- FF_LIBRARY_LOAD(vulkan, instance->config.libVulkan, , "libvulkan.so", 2)
+ FF_LIBRARY_LOAD(vulkan, instance->config.libVulkan, , "libvulkan" FF_SO_EXTENSION, 2)
FF_LIBRARY_LOAD_SYMBOL(vulkan, vkGetInstanceProcAddr,)
FF_LIBRARY_LOAD_SYMBOL(vulkan, vkCreateInstance,)
FF_LIBRARY_LOAD_SYMBOL(vulkan, vkDestroyInstance,)
@@ -79,7 +85,7 @@ static void detectVulkan(const FFinstance* instance, FFVulkanResult* result)
.apiVersion = requestedVkVersion
};
- const VkInstanceCreateInfo instanceCreateInfo = {
+ VkInstanceCreateInfo instanceCreateInfo = {
.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
.pNext = NULL,
.pApplicationInfo = &applicationInfo,
@@ -90,6 +96,14 @@ static void detectVulkan(const FFinstance* instance, FFVulkanResult* result)
.flags = 0
};
+ #if defined(__APPLE__) && defined(VK_KHR_portability_enumeration)
+ // Required for macOS ( MoltenVK ) compatibility
+ const char *exts[] = { VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME };
+ instanceCreateInfo.ppEnabledExtensionNames = exts;
+ instanceCreateInfo.enabledExtensionCount = 1;
+ instanceCreateInfo.flags = VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR;
+ #endif
+
VkInstance vkInstance;
if(ffvkCreateInstance(&instanceCreateInfo, NULL, &vkInstance) != VK_SUCCESS)
{
diff --git a/src/flashfetch.c b/src/flashfetch.c
index a571345..8e156fa 100644
--- a/src/flashfetch.c
+++ b/src/flashfetch.c
@@ -9,50 +9,51 @@ int main(int argc, char** argv)
ffInitInstance(&instance); //This also applys default configuration to instance.config
//Modify instance.config here
+ instance.config.showErrors = true;
//Does things like starting detection threads, disabling line wrap, etc
ffStart(&instance);
//Printing
- ffPrintTitle(&instance);
- ffPrintSeparator(&instance);
- ffPrintOS(&instance);
- ffPrintHost(&instance);
- ffPrintKernel(&instance);
- ffPrintUptime(&instance);
- //ffPrintProcesses(&instance);
- ffPrintPackages(&instance);
- ffPrintShell(&instance);
- ffPrintResolution(&instance);
- ffPrintDesktopEnvironment(&instance);
- ffPrintWM(&instance);
- ffPrintWMTheme(&instance);
- ffPrintTheme(&instance);
- ffPrintIcons(&instance);
- ffPrintFont(&instance);
- ffPrintCursor(&instance);
- ffPrintTerminal(&instance);
- ffPrintTerminalFont(&instance);
+ // ffPrintTitle(&instance);
+ // ffPrintSeparator(&instance);
+ // ffPrintOS(&instance);
+ // ffPrintHost(&instance);
+ // ffPrintKernel(&instance);
+ // ffPrintUptime(&instance);
+ // ffPrintProcesses(&instance);
+ // ffPrintPackages(&instance);
+ // ffPrintShell(&instance);
+ // ffPrintResolution(&instance);
+ // ffPrintDesktopEnvironment(&instance);
+ // ffPrintWM(&instance);
+ // ffPrintWMTheme(&instance);
+ // ffPrintTheme(&instance);
+ // ffPrintIcons(&instance);
+ // ffPrintFont(&instance);
+ // ffPrintCursor(&instance);
+ // ffPrintTerminal(&instance);
+ // ffPrintTerminalFont(&instance);
ffPrintCPU(&instance);
- //ffPrintCPUUsage(&instance);
- ffPrintGPU(&instance);
- ffPrintMemory(&instance);
- //ffPrintSwap(&instance);
- ffPrintDisk(&instance);
- ffPrintBattery(&instance);
- //ffPrintPlayer(&instance);
- //ffPrintSong(&instance);
- //ffPrintLocalIp(&instance);
- //ffPrintPublicIp(&instance);
- ffPrintLocale(&instance);
- //ffPrintDateTime(&instance);
- //ffPrintDate(&instance);
- //ffPrintTime(&instance);
- //ffPrintVulkan(&instance);
- //ffPrintOpenGL(&instance);
- //ffPrintOpenCL(&instance);
- ffPrintBreak(&instance);
- ffPrintColors(&instance);
+ // ffPrintCPUUsage(&instance);
+ // ffPrintGPU(&instance);
+ // ffPrintMemory(&instance);
+ // ffPrintSwap(&instance);
+ // ffPrintDisk(&instance);
+ // ffPrintBattery(&instance);
+ // ffPrintPlayer(&instance);
+ // ffPrintSong(&instance);
+ // ffPrintLocalIp(&instance);
+ // ffPrintPublicIp(&instance);
+ // ffPrintLocale(&instance);
+ // ffPrintDateTime(&instance);
+ // ffPrintDate(&instance);
+ // ffPrintTime(&instance);
+ ffPrintVulkan(&instance);
+ // ffPrintOpenGL(&instance);
+ // ffPrintOpenCL(&instance);
+ // ffPrintBreak(&instance);
+ // ffPrintColors(&instance);
ffFinish(&instance);
return 0;
diff --git a/src/modules/vulkan.c b/src/modules/vulkan.c
index c62489f..a689dfa 100644
--- a/src/modules/vulkan.c
+++ b/src/modules/vulkan.c
@@ -1,5 +1,6 @@
#include "fastfetch.h"
#include "common/printing.h"
+#include "detection/gpu/gpu.h"
#include "detection/vulkan.h"
#define FF_VULKAN_MODULE_NAME "Vulkan"
@@ -40,4 +41,10 @@ void ffPrintVulkan(FFinstance* instance)
{FF_FORMAT_ARG_TYPE_STRBUF, &vulkan->conformanceVersion}
});
}
+
+ for(uint32_t i = 0; i < vulkan->gpus.length; i++) {
+ FFGPUResult* gpu = ffListGet(&vulkan->gpus, i);
+ ffPrintLogoAndKey(instance, "GPU", 0, &instance->config.gpu.key);
+ ffStrbufWriteTo(&gpu->name, stdout);
+ }
}
Thanks for the vulkan code. I will definitely update the current one, to make in work on MacOS too. But i still think it should be only the fallback for the pci code. Im am still figuring out how to use CFStringGetCString
correctly...
Why? You don't need to run GPU detection code when vulkan module have been run. It will save time. If vulkan fails then fallback to the pci code
Noticed that Disk usage was wrong.
可用
means storage left, 共
means storage total
Total usage seems right, 234 GiB = 251 GB. I will look into what is wrong with the used one.
And the crash in gpu_apple.c might be resolved now.
Disk is now working correctly. Use --binary-prefix si
to get the exact same information as "About this Mac".
Is there anything else missing, before i can make the bugfix release?
--localip-show-loop
doesn't work on macOS. See my PR
I am pretty happy with this. I want to leave WM Theme / Terminal Font for Hacktoberfest next month. Can this be closed, or is there anything else that should be done before the release?
I'd like to have Battery
and Power Adapter
( because my MBP supports PD charging ) working before switching to fastfetch from neofetch, but It's ok to release a bug fix version.
General description of bug:
Often helpful questions:
Output of
fastfetch --version
:Output of
fastfetch --load-config devinfo
:Output of
fastfetch --load-config devinfo-verbose
:Output of
fastfetch --list-features
:./run.sh
doesn't work./bin/env
doesn't exist, should be/usr/bin/env
If run with
bash run.sh