Hi, I'm having problems with extremely build and compilation of software in the command line and I'm not sure why. I'm currently using macOS Sonoma 14.3 on my 2020 MacBook Air 1.1 GHz Quad-Core Intel Core i5. I also have the latest version of Xcode installed.
Although I've been experiencing extreme delays in the command line for a while, the problem really became noticeable after I updated my OS to Sonoma. It meant that all the software I had installed via command line that I regularly use became outdated and now I cannot build it again. I've spoken in depth with the authors of the software and they have tried on a system identical to mine and have a build time of 30 minutes, but my machine takes over 3 hours on the same software. I've uninstalled and reinstalled command line tools several times but nothing seems to work. Also when I build I use the command make -j7 to use 7/8 cores so the problem isn't that I'm making full use of my CPU either. I've spoken to Apple support who recommended I try in Safe Mode and using a different user to rule out background software that opens on start up and decreases performance, as well as to rule out the setup on my main user. I'm just not sure what to do anymore as I've been trying for days and to no avail. Does anyone have any suggestions?
P.S. It may be irrelevant, but since Sonoma I've also been experiencing a lot of issues with clang and also SDK pathways.
Compiler
RSS for tagDiscuss the various compiler and toolchain technologies used in development.
Posts under Compiler tag
104 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
I have the below code where my swift code calls a cpp function. In this the swift calls a cpp function and passes a swift 'String' as argument to it, which is then received in the cpp code as 'const char *'. This conversion works without any errors. Is this a documented behaviour in cpp-swift interop and is this safe to use?
Swift side:
internal static func CharCheck (pSentence: String) -> Void
{
TWSoundLogic.CharacterSoundCount (pSentence)
}
In the C++ side,
void TWSoundLogic::CharacterSoundCount (const char * pSentence)
{
..
}
However, on returning a String type from a swift function and trying to receive it as a const char* in c++, it gives an error in cpp No viable conversion from 'swift::String' to 'const char *' . Why does it not allow to return, but it allows to pass as argument? Can someone explain this behaviour?
Hello everyone!
I'm quite new to App development (but have quite a bit of programming experience).
I have reached the point where I would like to Archive my app for release but I'm stumped at an issue where the app compiles, builds and runs just fine in XCode on device and simulator targets however fails when I want to archive the app.
My app ends up using a mix of a lot of things possible:
Swift and SwiftUI
Obj-C and some vanilla C, mainly because I use a framework in C
Very minimal but some UIKit (that bridges with some parts in C)
Here is the stacktrace, would appreciate some insights
1. Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)
2. Compiling with the current language version
3. While evaluating request ExecuteSILPipelineRequest(Run pipelines { PrepareOptimizationPasses, EarlyModulePasses, HighLevel,Function+EarlyLoopOpt, HighLevel,Module+StackPromote, MidLevel,Function, ClosureSpecialize, LowLevel,Function, LateLoopOpt, SIL Debug Info Generator } on SIL for CamHero)
4. While running pass #12497 SILModuleTransform "PerformanceSILLinker".
5. While deserializing SIL function "$s7SwiftUI11EnvironmentV12wrappedValuexvg"
6. While deserializing SIL function "os_log_type_enabled"
7. *** DESERIALIZATION FAILURE ***
*** If any module named here was modified in the SDK, please delete the ***
*** new swiftmodule files from the SDK and keep only swiftinterfaces. ***
module 'SwiftUI', builder version '5.9.2(5.9.2)/Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)', built from swiftinterface, resilient, loaded from '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/prebuilt-modules/17.2/SwiftUI.swiftmodule/arm64-apple-ios.swiftmodule'
result not found (isEnabled)
Cross-reference to module 'os'
... OSLog
... in an extension in module 'os'
... isEnabled
... with type (OSLog) -> (OSLogType) -> Bool
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 swift-frontend 0x0000000103a11abc llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 swift-frontend 0x0000000106677cb0 llvm::sys::RunSignalHandlers() + 112
2 swift-frontend 0x00000001063e1054 SignalHandler(int) + 352
3 libsystem_platform.dylib 0x00000001895b3a24 _sigtramp + 56
4 libsystem_pthread.dylib 0x0000000189584cc0 pthread_kill + 288
5 libsystem_c.dylib 0x0000000189494a40 abort + 180
6 swift-frontend 0x0000000102bd7c2c (anonymous namespace)::ParsedAttrInfoFallThrough::~ParsedAttrInfoFallThrough() + 0
7 swift-frontend 0x0000000104470db8 std::__1::__function::__func<swift::evaluator::PerRequestReferences swift::evaluator::PerRequestReferences::makeEmpty<swift::LookupPrefixOperatorRequest>()::'lambda'(void*), std::__1::allocator<swift::evaluator::PerRequestReferences swift::evaluator::PerRequestReferences::makeEmpty<swift::LookupPrefixOperatorRequest>()::'lambda'(void*)>, void (void*)>::operator()(void*&&) + 0
8 swift-frontend 0x0000000102b2c534 swift::ModuleFile::fatal(llvm::Error) const + 44
9 swift-frontend 0x00000001044721dc swift::CyclicalRequestError<swift::LookupPrefixOperatorRequest>::~CyclicalRequestError() + 0
10 swift-frontend 0x00000001045bb880 swift::SILDeserializer::readSILFunctionChecked(llvm::PointerEmbeddedInt<unsigned int, 31>, swift::SILFunction*, llvm::StringRef, bool, bool) + 1588
11 swift-frontend 0x0000000102bb0f50 swift::SILDeserializer::getFuncForReference(llvm::StringRef, swift::SILType) + 504
12 swift-frontend 0x00000001045cb578 swift::SILDeserializer::readSILInstruction(swift::SILFunction*, swift::SILBuilder&, unsigned int, llvm::SmallVectorImpl<unsigned long long>&) + 29524
13 swift-frontend 0x00000001045bc554 swift::SILDeserializer::readSILFunctionChecked(llvm::PointerEmbeddedInt<unsigned int, 31>, swift::SILFunction*, llvm::StringRef, bool, bool) + 4872
14 swift-frontend 0x00000001045d6934 swift::SILDeserializer::lookupSILFunction(swift::SILFunction*, bool) + 636
15 swift-frontend 0x0000000102c4d990 swift::SILLinkerVisitor::deserializeAndPushToWorklist(swift::SILFunction*) + 88
16 swift-frontend 0x0000000102c4dfb0 swift::SILLinkerVisitor::processFunction(swift::SILFunction*) + 248
17 swift-frontend 0x0000000103c60fa4 (anonymous namespace)::SILLinker::run() (.llvm.15023899450236721039) + 136
18 swift-frontend 0x0000000106018874 swift::SILPassManager::executePassPipelinePlan(swift::SILPassPipelinePlan const&) + 16276
19 swift-frontend 0x00000001061c21c4 swift::SimpleRequest<swift::ExecuteSILPipelineRequest, std::__1::tuple<> (swift::SILPipelineExecutionDescriptor), (swift::RequestFlags)1>::evaluateRequest(swift::ExecuteSILPipelineRequest const&, swift::Evaluator&) + 56
20 swift-frontend 0x00000001060646b8 llvm::Expected<swift::ExecuteSILPipelineRequest::OutputType> swift::Evaluator::getResultUncached<swift::ExecuteSILPipelineRequest>(swift::ExecuteSILPipelineRequest const&) + 476
21 swift-frontend 0x000000010607c424 swift::runSILOptimizationPasses(swift::SILModule&) + 472
22 swift-frontend 0x000000010400c3c0 swift::CompilerInstance::performSILProcessing(swift::SILModule*) + 572
23 swift-frontend 0x0000000105f59454 performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>>, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) + 956
24 swift-frontend 0x0000000105f54f00 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 3020
25 swift-frontend 0x0000000105f58854 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 4568
26 swift-frontend 0x0000000105fbfd44 swift::mainEntry(int, char const**) + 4408
27 dyld 0x00000001892090e0 start + 2360
Command SwiftCompile failed with a nonzero exit code
Using Xcode 15.2, x86_64, and for the life of me, I can't figure out how to declare a data structure in assembly.
All the "current"ish references I've read for Clang LLVM & "as" assembly have no references to data structure directives. Tons of different types of sections, but I haven't seen any that would apply.
I've looked at .bss, and while I can defines different fields in it, it still reserves space in the program, and I don't need space reserved - I just need a data structure definition so I'm not using magic numbers.
Perhaps there is a utility to convert a C struct to an assembly struct that I haven't seen? Surely there has to be a way to define a data structure in assembly.
Is there any way to get an unnamed property of a tuple given its position?
Like below:
let record = ("field1", "field2")
func getRecordFieldValue(at: Int, of record: (String, String)) -> Any? {
// pseudo code
record.[at]
}
I have a project that has Cpp code and swift code and I m making some calls from swift to cpp. For this I m using the Cpp-swift interop mechanism introduced in swift 5.9 for making direct calls between swift and cpp.
I m using module.modulemap file to expose the cpp code to swift. I am facnig an error when I try to access a cpp header that are using the cpp compiler flags in some static assert statements. These methods are working fine in cpp however, when I try to access these methods from swift using the modulemap file, the compiler flags are not being identified by swift, and produces the below error
error: use of undeclared identifier 'TW_KERNEL_WINDOWS'.
This is my module.modulemap file:
module CoreModule {
header "ProcessStates.hpp" //cpp header that contains compiler flags
export *
}
below is the cpp header code that I m trying to access in swift:
#pragma once
// if the given condition is false – treat as an error
#define STATIC_CHECKFALSE(condition, message) static_assert (condition, message)
STATIC_CHECKFALSE ((TW_KERNEL_WINDOWS == 0) || (TW_KERNEL_WINDOWS == 1), "TW_KERNEL_WINDOWS can only be 0 or 1");
Can someone help, why is this happening and how to resolve this?
Linker flag specified in Package.swift as unsafe flag is passed to main app target.
steps:
create empty package and add linkerSettings: [.unsafeFlags(["-Wl,-make_mergeable"])] to target
import PackageDescription
let package = Package(
name: "TestPackage",
products: [
// Products define the executables and libraries a package produces, making them visible to other packages.
.library(
name: "TestPackage",
type: .dynamic,
targets: ["TestPackage"]),
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
// Targets can depend on other targets in this package and products from dependencies.
.target(
name: "TestPackage",
linkerSettings: [.unsafeFlags(["-Wl,-make_mergeable"])]
),
.testTarget(
name: "TestPackageTests",
dependencies: ["TestPackage"]),
]
)
create empty Xcode iOS app project and add package to project via Add Files
3 add package as a framework dependency to the main app
in the result, build fails with error:
ld: -make_mergeable can only be used when creating a dynamic library
package itself builds with -mergable_library and that is fine
Hi --
I would like to be able to pass a Swift Array to C++ code. I know it should be possible, but having trouble figuring out the right way to do it. Here is an example class showing what I want to do.
C++ code:
class Foo {
public:
Foo(const std::vector<uint8_t> & values) : _values(values) {}
protected:
std::vector<uint_8> _values;
};
Swift code:
let values: [UInt8] = [ 1, 2, 3, 4, 5, 6 ]
var foo = Foo(values)
If I do this, I get the following error message: Cannot convert value of type '[UInt8]' to expected argument type 'std.__1.vector<UInt8, allocator<UInt8>>'.
The setlocale C/C++ function writes the global variable errno to 0. In Linux it doesn't have this behavior and the documentation doesn't says anything about setting errno (as I understand, no function should set errno to 0
The following code allows to reproduce it
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream myStream;
myStream.open("NONEXISTENT.txt", ios::in);
cout << errno << endl;
setlocale(LC_ALL, "en_US.UTF-8");
cout << errno << endl;
}
// Output:
// 2
// 0
I don't think is a compiler issue as the error also happens with gcc but rather a libc issue.
I'm trying to build a dynamic version of an old C static library. The static library, as it stands, references symbols which are defined in the program the static library is bound to. When I try to build this as a dynamic library I get:
ld: symbol(s) not found for architecture x86_64
messages. I suspect there is a way to work around this (weak references?) but I don't understand how to do it, and none of the online documentation and commentary I have found seems to help.
Does anyone have suggestions to offer?
Hi --
I am attempting to use C++ and Swift in a single project but I am struggling with finding the proper way to do this. Ideally I want to have both my C++ and Swift code in the same project and not use a framework to keep them separate.
As an example, how would I create an object of the following C++ class:
class Foo {
public:
Foo() {
// do stuff
}
}
From what I read, it should be as simple as this:
let foo = Foo()
But Xcode says it Cannot find 'Foo' in scope. How do I import Foo into my Swift code? Is there a project setting that needs to be changed to automatically make my C++ classes available? Or do I need to create a Clang module (as described in this page: https://www.swift.org/documentation/cxx-interop/#importing-c-into-swift) to expose the C++ code to Swift? If so, where in my Xcode project should that go?
I am using Xcode 15.2 on macOS 14.2.1. I have also set the C++ and Objective-C Interoperability setting for my project to C++/Objective-C++.
I am facing very strange issue on the last version of Xcode. At some point during heavy build (like building QtWebEngine from the sources) some headers from MacOSX SDK may disappear for the compiler, what leads to the errors. The issue happens build to build. I haven't found any other issue even close to be similar anywhere.
The errors during the build looks like this:
../../../../../../../../../../../Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -MMD -MF obj/pdf/internal/pdfium_permissions.o.d -DOFFICIAL_BUILD -DTOOLKIT_QT -D_LIBCPP_HAS_NO_ALIGNED_ALLOCATION -DCR_XCODE_VERSION=1510 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DWEBP_EXTERN=extern -DUSE_EGL -DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 -DUSE_CHROMIUM_ICU=1 -DU_ENABLE_TRACING=1 -DU_ENABLE_RESOURCE_TRACING=0 -DU_STATIC_IMPLEMENTATION -DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE -DUCHAR_TYPE=uint16_t -DV8_COMPRESS_POINTERS -DV8_31BIT_SMIS_ON_64BIT_ARCH -DV8_DEPRECATION_WARNINGS -DV8_REVERSE_JSARGS -DGOOGLE_PROTOBUF_NO_RTTI -DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER -DHAVE_PTHREAD -DSK_CODEC_DECODES_PNG -DSK_CODEC_DECODES_WEBP -DSK_ENCODE_PNG -DSK_ENCODE_WEBP -DSK_USER_CONFIG_HEADER=\"../../skia/config/SkUserConfig.h\" -DSK_GL -DSK_CODEC_DECODES_JPEG -DSK_ENCODE_JPEG -DSK_USE_LIBGIFCODEC -DSK_SUPPORT_GPU=1 -DSK_GPU_WORKAROUNDS_HEADER=\"gpu/config/gpu_driver_bug_workaround_autogen.h\" -DSK_BUILD_FOR_MAC -DSK_METAL -DPDF_ENABLE_V8 -DPDFIUM_PRINT_TEXT_WITH_GDI -DFT_CONFIG_MODULES_H=\"freetype-custom/freetype/config/ftmodule.h\" -DFT_CONFIG_OPTIONS_H=\"freetype-custom/freetype/config/ftoption.h\" -DPDFIUM_REQUIRED_MODULES -DCHROMIUM_RESTRICT_VISIBILITY -Igen -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/pdfium -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/perfetto/include -Igen/third_party/perfetto/build_config -Igen/third_party/perfetto -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/libwebp/src -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/libyuv/include -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/jsoncpp/source/include -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/khronos -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/gpu -Igen/third_party/dawn/src/include -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/dawn/src/include -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/abseil-cpp -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/include -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/protobuf/src -Igen/protoc_out -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/ced/src -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/icu/source/common -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/icu/source/i18n -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/v8/include -Igen/v8/include -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/protobuf/src -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/skia -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/libgifcodec -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/freetype/include -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/freetype/include/freetype-custom -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/freetype/src/include -I../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/third_party/harfbuzz-ng/src/src -fno-strict-aliasing -fstack-protector -Wno-unknown-attributes -Wno-unknown-pragmas -Wno-unknown-warning-option -fcolor-diagnostics -fmerge-all-constants -arch x86_64 -Wall -Wextra -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wimplicit-fallthrough -Wunreachable-code -Wthread-safety -Wextra-semi -Wunguarded-availability -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-unneeded-internal-declaration -Wno-undefined-var-template -Wno-psabi -Wno-ignored-pragma-optimize -Wno-implicit-int-float-conversion -Wno-final-dtor-non-final-class -Wno-builtin-assume-aligned-alignment -Wno-deprecated-copy -Wno-non-c-typedef-for-linkage -Wno-max-tokens -O2 -fno-omit-frame-pointer -g0 -isysroot ../../../../../../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk -mmacosx-version-min=10.13 -fvisibility=hidden -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Wshadow -Wno-shorten-64-to-32 -Wno-parentheses-equality -Wno-tautological-compare -Wno-thread-safety-attributes -Wno-undefined-bool-conversion -Wno-tautological-undefined-compare -std=c++14 -fno-trigraphs -Wno-trigraphs -stdlib=libc++ -fno-exceptions -fno-rtti -fvisibility-inlines-hidden -Wno-deprecated-declarations -c ../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/pdf/pdfium/pdfium_permissions.cc -o obj/pdf/internal/pdfium_permissions.o
In file included from ../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/pdf/pdfium/pdfium_permissions.cc:5:
In file included from ../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/pdf/pdfium/pdfium_permissions.h:8:
In file included from ../../../../../../../../qte00659ae73d6f/s/qt5/qtwebengine/src/3rdparty/chromium/pdf/pdf_engine.h:10:
../../../../../../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/memory:899:10: fatal error: '__memory/temporary_buffer.h' file not found
Failed single commands in proper environment never fails. Errors occur only during really big build.
I've opened a bug (https://bugreports.qt.io/browse/QTBUG-119115) in Qt bug tracker. But it seems to be more like a clang bug, because this can happen during any heavy build on 2 different machines (x64 and arm64).
There was a suggestion about reaching the limit of opened files. This shouldn't be the case, as clang opens only small amount of them (up to 20 I guess), but I can be wrong.
I am using Xcode 15.2 Beta on macOS Sonoma 14.3 Beta with the macOS Sonoma 14.2 SDK. Similarly to post 702244, I am trying to build the same exact repository, partially for my own education. The issue I am running into is that one of the files references IOKit/hid/IOHIDDevice.h, which, in turn, references IOKit/IOReporter.h. Since both of these are searched for, with #include <…>, in a base path of Kernel.framework/Versions/A/Headers, it follows that there should at least be a file somewhere in that folder called IOReporter.h, but there is not. There isn't even a copy in IOKit.framework/Versions/A/Headers, although that folder has another version of hid/IOHIDDevice.h entirely, which does not reference a IOReporter.h file. Is the lack of an IOReporter.h file deliberate, accidental, or is the mere continued existence of a kernel-space IOKit IOHIDDevice.h, containing a deprecated kernel-space IOHIDDevice symbol, an accident; possibly a simple hold-over from a previous version? Is there a way to make this compile? Am I missing anything? Should it be assumed that deprecated kernel-mode APIs will simply not compile?
I have an overloaded function, one version with a BOOL parameter and one with a bool parameter. It gives me a redefinition error when compiling for Apple Silicon but not when compiling for Intel.
Hi, I just started practicing Static Linking, and I tried to link a third party library into my code, but it kept bugging error: "The header file not found", so I believe there're some steps missing from my code, wish someone can help!
Here is the situation:
I use OpenGL as the target library, it contains two directories: "Include" directory which holds header files and "lib-arm64"directory which holds "libglfw3.a" and "libglfw.3.dylib". I believe .dylib is related to dynamic linking, so I am not gonna touch that and .a file is the source code I need. Therefore:
In Build Phase -> Linking Binary with Library, I attach "libglfw3.a".
In Build Setting -> Search Path, I include the address of header directory "Include" in "Header Search Path" and "lib-arm64" in "Library Search Path".
"#include <GLFW/glfw3.h>" is the command I copied from OpenGL website template and used in my code.
The error is: " 'GLFW/glfw3.h' file not found "
If anyone has any advice, feel free to share it, I really appreciate!
Another question I have, non-relevant to linking, but to debugging.
I declare a structure type in swift, name as CmdStruct
struct CmdStruct {
var cmd:[UInt8]
init() {
cmd = [UInt8](repeating: 0, count:16)
}
}
In the case that the connection has been obtained.
In sendCmd function, declare a variable which name as input which type of CmdStruct.
After set data to input, call a DriverKit function IOConnectCallStructMethod.
Here xcode shows a warning tip for the parameter 'input' for call IOConnectCallStructMethod:
<Forming 'UnsafeRawPointer' to a variable of type 'CmdStruct'; this is likely incorrect because 'CmdStruct' may contain an object reference.>
func sendCmd() {
var ret:kern_return_t = kIOReturnSuccess
var input = cmdStruct()
var output:[UInt8] = [UInt8](repeating:0, count: 16)
var inputSize = MemoryLayout<CmdStruct>.size // print value 8
var outputSize = output.count // print value 16
input.cmd[0] = 0x12
input.cmd[1] = 0x34
ret = IOConnectCallStructMethod(Connection, selector, &input, inputSize, &output, &outputSize)
}
In C file, driverkit function ExternalMethod will receive the parameter from swift side.
And check the value of input->cmd[0] and input->cmd[1] in console. However, the values are not the expected 0x12 and 0x34.
struct CmdStruct
{
uint8_t cmd[16];
};
kern_return_t myTest::ExternalMethod(uint64_t selector, IOUserClientMethodArguments* arguments, const IOuserClientMethodDispatch* dispatch, OSObject* target, void* reference)
{
int i = 0;
CmdStruct* input = nullptr;
if (arguments == nullptr) {
ret = KIOReturnBadArgument;
}
if (arguments->structureInput != nullptr) {
input = (CmdStruct*)arguments->structureInput->getBytestNoCopy();
}
/*
Here to print input->cmd[0] and input->cmd[1] data to console.
*/
}
I expect that the correct value of input will be show on the driverkit side. I'm not sure which part is wrong. Here, I list some factors that may lead to incorrect value.
How to fix the warning tip for parameter 'input' when call IOConnectCallStructMethod in swift.
I get the inputSize value 8 by using MemoryLayout.size. But this structure contains a 16 bytes array. How to get the correct struct size in swift
In C file side, using (CmdStruct*)arguments->structureInput->getBytestNoCopy() to transform data to C struct is correct?
We have a set of Swift Packages with dependencies from one to another, and we need to build xcframeworks out of those. We currently iterate over each package and xcodebuild archives out of them, but this is really slow. It also seems that the dependencies are rebuilt for every package, and we're looking for a way to avoid that.
More precisely, say we have the following packages
CoreFoundation
Feature1, depending on CoreFoundation
We need to turn this into corefoundation.xcframework and feature1.xcframework. The problem is that when calling xcodebuild on Feature1, it seems to be rebuilding CoreFoundation even though it's already been built when building corefoundation.xcframework.
Anyone knows of a better way to do that ? Lumping it all together in a single xcframework doesn't seem to be possible.
Thanks for any input :)
Unknown dynamically requested build input cannot be found, on Compiling GeneratedAssetSymbols.swift, Unexpected input file: /Users/myuser/Documents/ios-projects/test-app/platforms/ios/MyApp.build/Debug-iphonesimulator, on xcode 15.0.1
In C++, I can write 123457890ull to imply it's an unsigned long long integer. Does Swift provide similar language construct?
Reproduced in Xcode versions 15.0.1 and 15.1 beta 3.
If a Macro adds an enum case with an associated value, other cases are transformed at runtime. In the example below, the case foo is translated into the Macro-generated case bar(false).
There is lots of other strange behavior, such as:
Case declarations in the same file as the enum are not transformed. For example, in the code above, a function written in SimpleEnum.swift can produce SimpleEnum.foo, whereas functions in other files cannot (the declarations are transformed).
Manually-defined cases with associated values are not transformed. For example, a manually-defined case foobar(Bool) can be declared and used normally everywhere.
Additional enum cases without associated values get transformed to different cases. For example, if SimpleEnum has manual cases foo, foobar, and foobarfoo, and a Macro-generated bar(Bool), these transformations take place:
foo -> bar(false)
foobar -> bar(true)
foobarfoo -> foo
etc.
Not all associated value types in the Macro-generated case are treated the same. String associated values seems to work properly. Int yields incrementing transformations (e.g. foo -> bar(0), foobar -> bar(1), foobarfoo -> bar(2))
Radar: FB13417290