vapor/toolbox

Make script fails if no version number found

BinaryHammer opened this issue · 5 comments

Thank you for making it possible to use the toolbox CLI without homebrew.

Defect

I found the problem: Your release .zip-file is not a git repository, so the currentVersion() function in scripts/build.swift can not create a version number.

In directory toolbox-18.2.2 I used the following command.

% git describe --tags --exact-match
fatal: not a git repository (or any of the parent directories): .git

Workaround

Just clone the repository, do not use the release.
If you want to use the release you can just change the scripts/build.swift's currentVersion() function to return the current version like the following code.

func currentVersion() throws -> String {
    return "18.2.2"
}

Error message

Downloaded the release 18.2.2 and unzipped it.

Using Catalina 10.15.6 and Xcode 11.7 .

In directory toolbox-18.2.2 I used the following commands.

% ls
Dockerfile	Makefile	README.md	Tests
LICENSE.txt	Package.swift	Sources		scripts

% swift --version
Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)
Target: x86_64-apple-darwin19.6.0

% make build
swiftc ./scripts/build.swift
./build
Fatal error: Error raised at top level: build.ShellError(terminationStatus: 128): file /AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-1103.8.25.8/swift/stdlib/public/core/ErrorType.swift, line 200
make: *** [build] Illegal instruction: 4
make: *** Deleting file `build'

% cd scripts
% swift build.swift 
Fatal error: Error raised at top level: build.ShellError(terminationStatus: 128): file /AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-1103.8.25.8/swift/stdlib/public/core/ErrorType.swift, line 200
Stack dump:
0.	Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -interpret build.swift -enable-objc-interop -stack-check -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -color-diagnostics -module-name build 
1.	Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)
2.	While running user code "build.swift"
0  swift                    0x00000001070db4ea PrintStackTraceSignalHandler(void*) + 42
1  swift                    0x00000001070dacc0 SignalHandler(int) + 352
2  libsystem_platform.dylib 0x00007fff739745fd _sigtramp + 29
3  libsystem_platform.dylib 0x00007ffeece76080 _sigtramp + 2035292832
4  libswiftCore.dylib       0x00007fff72e33edf swift_errorInMain + 543
5  libswiftCore.dylib       0x000000010b7fa040 swift_errorInMain + 2560385920
6  swift                    0x0000000102e5e0aa llvm::MCJIT::runFunction(llvm::Function*, llvm::ArrayRef<llvm::GenericValue>) + 458
7  swift                    0x0000000102e6511b llvm::ExecutionEngine::runFunctionAsMain(llvm::Function*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, char const* const*) + 2011
8  swift                    0x0000000102e3a1da performCompileStepsPostSILGen(swift::CompilerInstance&, swift::CompilerInvocation&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, bool, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, bool, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 14362
9  swift                    0x0000000102e2eb95 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 55813
10 swift                    0x0000000102da4b73 main + 1283
11 libdyld.dylib            0x00007fff7377bcc9 start + 1
zsh: illegal hardware instruction  swift build.swift

I'll be looking into this now :)

0xTim commented

@linus-hologram there's also #393 that could be good to finish off at the same time if you're interested

@0xTim alright, i'll look into this too :)

@linus-hologram there's also #393 that could be good to finish off at the same time if you're interested

Also with this one, what work is left to do? What is the overall goal of this PR? Is there an issue it refers to? Kinda tapping in the dark what I'm supposed to do here...

0xTim commented

Just to have it here as well as Discord, #393 does not pass CI for some reason. I don't think it's related to this one, but if it is and you can merge them together then even better