'Generic Commit'
Some checks failed
dropshell-build / build (push) Failing after 51m54s

This commit is contained in:
Your Name
2025-06-14 18:17:57 +12:00
parent 091c1f0850
commit eeb5d44b73
8 changed files with 232 additions and 25 deletions

View File

@ -169,6 +169,9 @@ void assert_failed(
std::source_location location
) {
if (!condition) {
std::cout << std::flush;
std::cerr << std::flush;
std::cerr << colors::red << "Assertion failed at " << location.file_name() << ":" << location.line() << ": "
<< location.function_name() << ": " << message << colors::reset << "\n";
print_stacktrace();

View File

@ -0,0 +1,28 @@
cmake_minimum_required(VERSION 3.16)
# Project setup
if(NOT DEFINED PROJECT_NAME)
set(PROJECT_NAME "path_checker")
endif()
string(TIMESTAMP PROJECT_VERSION "%Y.%m%d.%H%M")
project(${PROJECT_NAME} VERSION ${PROJECT_VERSION} LANGUAGES CXX)
# Build configuration
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXE_LINKER_FLAGS "-static")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(BUILD_SHARED_LIBS OFF)
# Configure version.hpp and create executable
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/version.hpp"
"#pragma once\n#define PROJECT_VERSION \"${PROJECT_VERSION}\"\n")
add_custom_target(run_prebuild_script ALL
COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/cmake_prebuild.sh
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
add_executable(${PROJECT_NAME} path_checker.cpp)
add_dependencies(${PROJECT_NAME} run_prebuild_script)
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})

View File

@ -0,0 +1,3 @@
#!/bin/bash
# Prebuild script for path_checker
echo "Running prebuild script for path_checker"

View File

@ -0,0 +1,101 @@
#include <iostream>
#include <filesystem>
#include <vector>
#include <fstream>
#include <cstdlib>
#include <unistd.h>
#include <sys/utsname.h>
#include "version.hpp"
void checkPath(const std::string& path, const std::string& description) {
std::cout << "\n=== " << description << " ===" << std::endl;
std::cout << "Path: " << path << std::endl;
if (std::filesystem::exists(path)) {
std::cout << "EXISTS: Yes" << std::endl;
if (std::filesystem::is_directory(path)) {
std::cout << "TYPE: Directory" << std::endl;
std::cout << "Contents:" << std::endl;
try {
for (const auto& entry : std::filesystem::directory_iterator(path)) {
std::cout << " " << entry.path().filename().string() << std::endl;
}
} catch (const std::exception& e) {
std::cout << " Error listing contents: " << e.what() << std::endl;
}
} else {
std::cout << "TYPE: File" << std::endl;
}
} else {
std::cout << "EXISTS: No" << std::endl;
}
}
void checkFile(const std::string& path, const std::string& description) {
std::cout << "\n=== " << description << " ===" << std::endl;
std::cout << "File: " << path << std::endl;
if (std::filesystem::exists(path)) {
std::cout << "EXISTS: Yes" << std::endl;
std::ifstream file(path);
if (file.is_open()) {
std::string line;
std::cout << "Contents:" << std::endl;
while (std::getline(file, line)) {
std::cout << " " << line << std::endl;
}
}
} else {
std::cout << "EXISTS: No" << std::endl;
}
}
int main() {
std::cout << "Alpine Linux Library Path Checker" << std::endl;
std::cout << "Version: " << PROJECT_VERSION << std::endl;
// Get system information
struct utsname sys_info;
if (uname(&sys_info) == 0) {
std::cout << "\nSystem Information:" << std::endl;
std::cout << " System: " << sys_info.sysname << std::endl;
std::cout << " Machine: " << sys_info.machine << std::endl;
std::cout << " Architecture: " << sys_info.machine << std::endl;
}
// Check standard library directories
checkPath("/lib", "System Libraries (/lib)");
checkPath("/usr/lib", "User Libraries (/usr/lib)");
checkPath("/usr/lib64", "64-bit Libraries (/usr/lib64)");
checkPath("/usr/local/lib", "Local Libraries (/usr/local/lib)");
// Check include directories
checkPath("/usr/include", "System Headers (/usr/include)");
checkPath("/usr/local/include", "Local Headers (/usr/local/include)");
// Check architecture-specific paths
checkPath("/usr/lib/x86_64-linux-gnu", "x86_64 GNU Libraries");
checkPath("/usr/lib/aarch64-linux-gnu", "aarch64 GNU Libraries");
checkPath("/lib64", "64-bit System Libraries");
// Check musl-specific configuration files
checkFile("/etc/ld-musl-x86_64.path", "musl x86_64 Library Path Config");
checkFile("/etc/ld-musl-aarch64.path", "musl aarch64 Library Path Config");
// Check for dynamic linker
checkFile("/lib/ld-musl-x86_64.so.1", "musl x86_64 Dynamic Linker");
checkFile("/lib/ld-musl-aarch64.so.1", "musl aarch64 Dynamic Linker");
// Check environment variables
std::cout << "\n=== Environment Variables ===" << std::endl;
const char* ld_library_path = std::getenv("LD_LIBRARY_PATH");
std::cout << "LD_LIBRARY_PATH: " << (ld_library_path ? ld_library_path : "(not set)") << std::endl;
const char* pkg_config_path = std::getenv("PKG_CONFIG_PATH");
std::cout << "PKG_CONFIG_PATH: " << (pkg_config_path ? pkg_config_path : "(not set)") << std::endl;
return 0;
}