vapor / toolbox

Simplifies common command line tasks when using Vapor
MIT License
283 stars 85 forks source link

Failed to install with make install #445

Closed ValorKand closed 5 months ago

ValorKand commented 5 months ago

Describe the bug

Hello :D, i'm trying to install the toolbox from the source, because i'm using Fedora Linux, i've Swift already installing and correctly working. But when I'm trying to install the toolbox i receive a error message.

To Reproduce

I downloaded the latest version of the source code from the releases section Extracted the file into my download folder Into the folder in run the make install command from terminal And i receive the next error output:

swiftc ./scripts/build.swift warning: direct reference to protected function $sSJ12isWhitespaceSbvg' in/usr/libexec/swift/5.8.1/bin/../lib/swift/linux/libswiftCore.so' may break pointer equality ./build Swift/ErrorType.swift:200: Fatal error: Error raised at top level: build.ShellError(terminationStatus: 128) Current stack trace: 0 libswiftCore.so 0x00007f5ba6e6f150 _swift_stdlib_reportFatalErrorInFile + 112 1 libswiftCore.so 0x00007f5ba6b603bf + 1442751 2 libswiftCore.so 0x00007f5ba6b601d7 + 1442263 3 libswiftCore.so 0x00007f5ba6b5efe0 assertionFailure(:_:file:line:flags:) + 364 4 libswiftCore.so 0x00007f5ba6bbde46 + 1826374 5 build 0x00005583e6c65137 + 8503 6 libc.so.6 0x00007f5ba684614a + 164170 7 libc.so.6 0x00007f5ba6846180 __libc_start_main + 139 8 build 0x00005583e6c64e65 + 7781 make: [Makefile:5: build] Instrucción ilegal (core dumped) [Núcleo vaciado a un archivo] make: Se borra el archivo 'build'

Steps to reproduce the behavior:

  1. Add package with configuration '...'
  2. Send request with options '...'
  3. See error

Expected behavior

I expected to run correctly the vapor toolbox, so, I follow correctly all the described steps in the installation documentation.

Environment

Additional context

Add any other context about the problem here.

0xTim commented 5 months ago

Can you try with Swift 5.9.2? And if that doesn't work, what's the output of swift build -c release

ValorKand commented 5 months ago

Can you try with Swift 5.9.2? And if that doesn't work, what's the output of swift build -c release

I tried with the 5.9.2 version, and it doesn't work, the output of swift build -c release is:

/home/davidvales/Descargas/toolbox/.build/checkouts/swift-log/Sources/Logging/Logging.swift:1392:64: error: value of optional type 'UnsafeMutablePointer?' must be unwrapped to a value of type 'UnsafeMutablePointer' strftime(&buffer, buffer.count, "%Y-%m-%dT%H:%M:%S%z", localTime) ^ /home/davidvales/Descargas/toolbox/.build/checkouts/swift-log/Sources/Logging/Logging.swift:1391:13: note: short-circuit using 'guard' to exit this function early if the optional value contains 'nil' let localTime = localtime(&timestamp) ^ guard else { return <#default value#> } /home/davidvales/Descargas/toolbox/.build/checkouts/swift-log/Sources/Logging/Logging.swift:1391:25: note: coalesce using '??' to provide a default when the optional value contains 'nil' let localTime = localtime(&timestamp) ^ ?? <#default value#> /home/davidvales/Descargas/toolbox/.build/checkouts/swift-log/Sources/Logging/Logging.swift:1391:25: note: force-unwrap using '!' to abort execution if the optional value contains 'nil' let localTime = localtime(&timestamp) ^ ! /home/davidvales/Descargas/toolbox/.build/checkouts/swift-log/Sources/Logging/Logging.swift:1392:64: note: coalesce using '??' to provide a default when the optional value contains 'nil' strftime(&buffer, buffer.count, "%Y-%m-%dT%H:%M:%S%z", localTime) ^ ?? <#default value#> /home/davidvales/Descargas/toolbox/.build/checkouts/swift-log/Sources/Logging/Logging.swift:1392:64: note: force-unwrap using '!' to abort execution if the optional value contains 'nil' strftime(&buffer, buffer.count, "%Y-%m-%dT%H:%M:%S%z", localTime) ^ ! error: fatalError [1/9] Compiling c-nioatomics.c

0xTim commented 5 months ago

@ValorKand ah this was due to Swift Log not working on musl. Can you pull down the latest changes from main and try again? #444 should have fixed it

ValorKand commented 5 months ago

@ValorKand ah this was due to Swift Log not working on musl. Can you pull down the latest changes from main and try again? #444 should have fixed it

@0xTim hi, I tried pull the main again. with the swift build -c release the output is:

Updating https://github.com/apple/swift-log.git Updating https://github.com/jpsim/Yams.git Updating https://github.com/apple/swift-collections.git Updated https://github.com/apple/swift-collections.git (0.67s) Updated https://github.com/apple/swift-log.git (0.67s) Updated https://github.com/jpsim/Yams.git (0.67s) Updating https://github.com/tanner0101/mustache.git Updating https://github.com/apple/swift-atomics.git Updating https://github.com/vapor/console-kit.git Updated https://github.com/tanner0101/mustache.git (0.70s) Updated https://github.com/apple/swift-atomics.git (0.70s) Updated https://github.com/vapor/console-kit.git (0.70s) Fetching https://github.com/apple/swift-system.git Updating https://github.com/apple/swift-nio.git Updated https://github.com/apple/swift-nio.git (1.00s) Computing version for https://github.com/vapor/console-kit.git Fetched https://github.com/apple/swift-system.git (1.40s) Computed https://github.com/vapor/console-kit.git at 4.14.1 (0.40s) Computing version for https://github.com/tanner0101/mustache.git Computed https://github.com/tanner0101/mustache.git at 0.1.1 (0.35s) Computing version for https://github.com/jpsim/Yams.git Computed https://github.com/jpsim/Yams.git at 5.0.6 (0.34s) Computing version for https://github.com/apple/swift-nio.git Computed https://github.com/apple/swift-nio.git at 2.63.0 (0.47s) Computing version for https://github.com/apple/swift-log.git Computed https://github.com/apple/swift-log.git at 1.5.4 (0.38s) Computing version for https://github.com/apple/swift-system.git Computed https://github.com/apple/swift-system.git at 1.2.1 (0.35s) Computing version for https://github.com/apple/swift-collections.git Computed https://github.com/apple/swift-collections.git at 1.0.6 (0.37s) Computing version for https://github.com/apple/swift-atomics.git Computed https://github.com/apple/swift-atomics.git at 1.2.0 (0.32s) Working copy of https://github.com/vapor/console-kit.git resolved at 4.14.1 Creating working copy for https://github.com/apple/swift-system.git Working copy of https://github.com/apple/swift-system.git resolved at 1.2.1 Working copy of https://github.com/apple/swift-log.git resolved at 1.5.4 Working copy of https://github.com/apple/swift-collections.git resolved at 1.0.6 Working copy of https://github.com/apple/swift-nio.git resolved at 2.63.0 Building for production... /home/davidvales/Descargas/toolbox/.build/checkouts/swift-nio/Sources/CNIOLinux/shim.c:203:9: warning: 'RENAME_NOREPLACE' macro redefined [-Wmacro-redefined]

define RENAME_NOREPLACE 1

    ^

/usr/include/stdio.h:169:10: note: previous definition is here

define RENAME_NOREPLACE (1 << 0)

     ^

/home/davidvales/Descargas/toolbox/.build/checkouts/swift-nio/Sources/CNIOLinux/shim.c:204:9: warning: 'RENAME_EXCHANGE' macro redefined [-Wmacro-redefined]

define RENAME_EXCHANGE 2

    ^

/usr/include/stdio.h:170:10: note: previous definition is here

define RENAME_EXCHANGE (1 << 1)

     ^

2 warnings generated. [44/44] Linking vapor Build complete! (76.86s)

it seems that is all ok, so, i run the make install and i got the next error:

swiftc ./scripts/build.swift ./build Swift/ErrorType.swift:200: Fatal error: Error raised at top level: build.ShellError(terminationStatus: 1)

💣 Program crashed: Illegal instruction at 0x00007f52aa763d12

Thread 0 "build" crashed:

0 0x00007f52aa763d12 assertionFailure(:_:file:line:flags:) + 354 in libswiftCore.so 1 0x00007f52aa7cacfc swift_errorInMain + 619 in libswiftCore.so 2 0x00005607000e5167 main + 54 in build 3 0x00007f52a976514a __libc_start_call_main + 121 in libc.so.6 4 0x00007f52a976520b __libc_start_main@GLIBC_2.2.5 + 138 in libc.so.6

Backtrace took 0.05s

make: [Makefile:5: build] Instrucción ilegal (core dumped) [Núcleo vaciado a un archivo] make: Se borra el archivo 'build'

😭

0xTim commented 5 months ago

Ok so something is likely different on Fedora to what the toolbox supports. We (and Swift) don't officially support Fedora so you probably are going to struggle.

What I would say is that if you're developing a Vapor app, you might want to use a supported platform. If this is for deployment, consider Docker. And if you want to preserve you can try manually running the steps in the Makefile to see what is failing and to install it manually. We could accept a patch to make it work on Fedora but I suspect that it will be more involved than that

ValorKand commented 5 months ago

Okay, i see, so, i will try it in a supported platform, thanks for the help and the attention :3

ValorKand commented 5 months ago

Ok so something is likely different on Fedora to what the toolbox supports. We (and Swift) don't officially support Fedora so you probably are going to struggle.

What I would say is that if you're developing a Vapor app, you might want to use a supported platform. If this is for deployment, consider Docker. And if you want to preserve you can try manually running the steps in the Makefile to see what is failing and to install it manually. We could accept a patch to make it work on Fedora but I suspect that it will be more involved than that

I resolve the problem.

  1. I erase all of vapor firstly.
  2. clone the vapor repo again and git pull origin main
  3. then, swift build -c release --disable-sandbox, the build finished successfully.
  4. Finally, sudo cp .build/release/vapor /usr/local/bin (manually copy the compiled program to path)