swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.54k stars 10.35k forks source link

SwiftUtils.cmake:116 (get_filename_component): get_filename_component called with incorrect number of arguments #69802

Open soloturn opened 11 months ago

soloturn commented 11 months ago

on arch linux, swift-language-git, we get the following cmake error. for the released swift, we do not have reports of such an error.

the relevant section in SwiftUtils.cmake

      # For building stdlib, use stdlib in the builder's resource directory
      # because the runtime may not be built yet.
      # FIXME: This assumes the ABI hasn't changed since the builder.
      get_filename_component(swift_bin_dir ${CMAKE_Swift_COMPILER} DIRECTORY)

the error:

$ cmake --version
cmake version 3.27.7

$ makepkg
-- CMark Version: cmark 0.29.0 - CommonMark converter
(C) 2014-2016 John MacFarlane
-- 
-- Building with -fPIC
CMake Warning at CMakeLists.txt:868 (message):
  Force setting BOOTSTRAPPING=HOSTTOOLS because Swift parser integration is
  enabled

-- Linux SDK:
--   Object File Format: ELF
--   Swift Standard Library Path: linux
--   Threading Package: linux
--   Architectures: x86_64
--   x86_64 triple: x86_64-unknown-linux-gnu
--   Module triple: x86_64-unknown-linux-gnu
--   x86_64 Path: /
-- 
-- Building host Swift tools for LINUX x86_64
--   Build type:     Release
--   Assertions:     TRUE
--   LTO:            
--   Bootstrapping:  HOSTTOOLS
--   Swift parser:   TRUE
-- 
-- Building Swift standard library and overlays for SDKs: LINUX
--   Build type:       Release
--   Assertions:       FALSE
-- 
-- Building Swift runtime with:
--   Leak Detection Checker Entrypoints: FALSE
-- 
-- Differentiable Programming Support: TRUE
-- Concurrency Support:                TRUE
-- Distributed Support:                TRUE
-- String Processing Support:          TRUE
-- Backtracing Support:                TRUE
-- Unicode Support:                    TRUE
-- Observation Support:                TRUE
-- 
-- Building Swift auxiliary executables for SDKs: LINUX
-- 
-- Building Swift Remote Mirror for SDKs: LINUX
-- 
CMake Error at cmake/modules/SwiftUtils.cmake:116 (get_filename_component):
  get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
  stdlib/cmake/modules/SwiftSource.cmake:857 (get_bootstrapping_swift_lib_dir)
  stdlib/cmake/modules/SwiftSource.cmake:137 (_compile_swift_files)
  stdlib/cmake/modules/AddSwiftStdlib.cmake:968 (handle_swift_sources)
  stdlib/cmake/modules/AddSwiftStdlib.cmake:2259 (add_swift_target_library_single)
  stdlib/public/Cxx/CMakeLists.txt:9 (add_swift_target_library)

-- Configuring incomplete, errors occurred!
ERROR: command terminated with a non-zero exit status 1, aborting

ERROR: command terminated with a non-zero exit status 1, aborting

==> ERROR: A failure occurred in build().
    Aborting...
compnerd commented 11 months ago

Bootstrapping requires that a swift compiler is available at configure time. This looks like that was not provided.

tachoknight commented 11 months ago

I get a similar error on Fedora when Swift is already installed. It works properly for me when an existing Swift installation is not present.

areuu commented 10 months ago

I also meet this error in gentoo linux. Is there any way to fix it?

vpzomtrrfrt commented 8 months ago

Bootstrapping requires that a swift compiler is available at configure time. This looks like that was not provided.

How does one bootstrap swift in that case? Is there an older version that doesn't have this requirement?

compnerd commented 8 months ago

Bootstrapping requires that a swift compiler is available at configure time. This looks like that was not provided.

How does one bootstrap swift in that case? Is there an older version that doesn't have this requirement?

Yes, the 5.8 compiler does not have the requirement, and you can build 5.8, 5.9, and then main. Alternatively, you could cross-compile from another platform.