Hello! This has been discussed previously, but my question isn’t related to adding SPM capabilities. I’m having issues creating an executable target that uses libfuzzer to fuzz test some things I’m building.
I have this in a main.swiftfile:
import MyLibToFuzz
import Foundation
@_cdecl("LLVMFuzzerTestOneInput")
public func fuzz(_ start: UnsafeRawPointer, _ count: Int) -> CInt {
let bytes = UnsafeRawBufferPointer(start: start, count: count)
let data = Data(bytes)
// do fuzzing
return 0
}
And my project is set up like:
Package.swift
Sources/Fuzzing/main.swift
With Fuzzing set up a an executable target with one local dependency that’s outside this directory.
I’m compiling it with:
swift build -c release -Xswiftc -sanitize=fuzzer -Xswiftc -parse-as-library --target Fuzzing
Which compiles successfully, but doesn’t result in an executable in the .build/release/ folder. I get a few object files but no final binary. Some other example projects seem to do the exact same thing and get an executable binary to run with libfuzzer. I am using the open source build of Swift, not Xcode so I know I have libfuzzer in my toolchain.