Git Product home page Git Product logo

Comments (9)

PseudonymPatel avatar PseudonymPatel commented on August 23, 2024 1

Guess what? It worked! Funnily enough, I did try that, just without the quotes and that didn't work, for obvious reasons.
As a side note, I forgot to remove the build directory but it still worked fine.

Thank you!

from swift-cmake-examples.

PseudonymPatel avatar PseudonymPatel commented on August 23, 2024

After taking a look at #24 (how did I miss that?), I am now getting the following error:

C:\Users\Sheen\Swift\swift-cmake-examples\HelloWorld>cmake -B build -D CMAKE_BUILD_TYPE=Release -D BUILD_TESTING=YES -D CMAKE_Swift_FLAGS=%SWIFTFLAGS% -G Ninja -S .
-- The C compiler identification is MSVC 19.27.29111.0
-- The Swift compiler identification is Apple 5.4
-- Check for working C compiler: C:/Applications/Visual Studio 2019/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Applications/Visual Studio 2019/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working Swift compiler: C:/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe
-- Check for working Swift compiler: C:/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe -- broken
CMake Error at C:/Applications/cmake/share/cmake-3.16/Modules/CMakeTestSwiftCompiler.cmake:41 (message):
  The Swift compiler

    "C:/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/swiftc.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: C:/Users/Sheen/Swift/swift-cmake-examples/HelloWorld/build/CMakeFiles/CMakeTmp

    Run Build Command(s):C:/APPLIC~1/VISUAL~1/Common7/IDE/COMMON~1/MICROS~1/CMake/Ninja/ninja.exe cmTC_cb24b && [1/1] Linking Swift executable cmTC_cb24b.exe
    FAILED: cmTC_cb24b.exe CMakeFiles/cmTC_cb24b.dir/main.swift.obj cmTC_cb24b.swiftmodule
    cmd.exe /C "cd . && C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe -output-file-map CMakeFiles\cmTC_cb24b.dir\output-file-map.json -incremental -j 12 -emit-executable -o cmTC_cb24b.exe -emit-module -emit-module-path cmTC_cb24b.swiftmodule -emit-dependencies  -sdk    -sdk  main.swift  -Xlinker -implib:cmTC_cb24b.lib   && cd ."
    <unknown>:0: warning: no such SDK: '-sdk'
    <unknown>:0: error: unable to load standard library for target 'x86_64-unknown-windows-msvc'
    ninja: build stopped: subcommand failed.





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:4 (project)


-- Configuring incomplete, errors occurred!
See also "C:/Users/Sheen/Swift/swift-cmake-examples/HelloWorld/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Sheen/Swift/swift-cmake-examples/HelloWorld/build/CMakeFiles/CMakeError.log".

C:\Users\Sheen\Swift\swift-cmake-examples\HelloWorld>

from swift-cmake-examples.

compnerd avatar compnerd commented on August 23, 2024

I believe that the value that you have set SWIFTFLAGS to is incorrect. Namely, it is set to -sdk without the the actual path to the SDK. Ut is likely that there was a typo. Could you provide the output of:

echo %SDKROOT%
echo %SWIFTFLAGS%

from swift-cmake-examples.

PseudonymPatel avatar PseudonymPatel commented on August 23, 2024
C:\Users\Sheen\Swift\swift-cmake-examples\HelloWorld>echo %SDKROOT%
C:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk

C:\Users\Sheen\Swift\swift-cmake-examples\HelloWorld>echo %SWIFTFLAGS%
-sdk C:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk

Edit: updated cmake, no changes

from swift-cmake-examples.

compnerd avatar compnerd commented on August 23, 2024

You might need to remove the build directory and reconfigure (the cached variables can persist across configures)

from swift-cmake-examples.

PseudonymPatel avatar PseudonymPatel commented on August 23, 2024

I make sure to delete the build directory before each build, but to no avail.
What do you mean by reconfigure?

from swift-cmake-examples.

compnerd avatar compnerd commented on August 23, 2024

Re-running cmake is a "reconfigure". CMake based builds have two phases:

  • configuration
  • building
    The configuration part is what CMake does, the building part is what the build tool does (in this case Ninja)

I think that it might be the fact that the parameter is unquoted (%SWIFTFLAGS)

Does the following work any better? (note the quoting of the value passed to CMAKE_Swift_FLAGS).

cmake -B build -D CMAKE_BUILD_TYPE=Release -D BUILD_TESTING=YES -D CMAKE_Swift_FLAGS="%SWIFTFLAGS%" -G Ninja -S .

from swift-cmake-examples.

PseudonymPatel avatar PseudonymPatel commented on August 23, 2024

Still doesn't work, but a different error:

C:\Users\Sheen\Swift\swift-cmake-examples\HelloWorld>echo %SWIFTFLAGS%
-sdk C:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk

C:\Users\Sheen\Swift\swift-cmake-examples\HelloWorld>cmake -B build -D CMAKE_BUILD_TYPE=Release -D BUILD_TESTING=YES -D CMAKE_Swift_FLAGS="%SWIFTFLAGS%" -G Ninja -S .
CMake Error at C:/Applications/cmake/share/cmake-3.20/Modules/CMakeDetermineCompilerId.cmake:6 (CMAKE_DETERMINE_COMPILER_ID_BUILD):
  Syntax error in cmake code at

    C:/Applications/cmake/share/cmake-3.20/Modules/CMakeDetermineCompilerId.cmake:6

  when parsing string

    -sdk;C:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk

  Invalid character escape '\L'.
Call Stack (most recent call first):
  C:/Applications/cmake/share/cmake-3.20/Modules/CMakeDetermineCompilerId.cmake:58 (__determine_compiler_id_test)
  C:/Applications/cmake/share/cmake-3.20/Modules/CMakeDetermineSwiftCompiler.cmake:63 (CMAKE_DETERMINE_COMPILER_ID)
  CMakeLists.txt:4 (project)


-- Configuring incomplete, errors occurred!
See also "C:/Users/Sheen/Swift/swift-cmake-examples/HelloWorld/build/CMakeFiles/CMakeOutput.log".

CMakeOutput.log contains:

The system is: Windows - 10.0.19042 - AMD64
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler: C:/Applications/Visual Studio 2019/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe 
Build flags: 
Id flags:  

The output was:
0
Microsoft (R) C/C++ Optimizing Compiler Version 19.27.29111 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

CMakeCCompilerId.c
Microsoft (R) Incremental Linker Version 14.27.29111.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:CMakeCCompilerId.exe 
CMakeCCompilerId.obj 


Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "CMakeCCompilerId.exe"

Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "CMakeCCompilerId.obj"

The C compiler identification is MSVC, found in "C:/Users/Sheen/Swift/swift-cmake-examples/HelloWorld/build/CMakeFiles/3.20.0-rc3/CompilerIdC/CMakeCCompilerId.exe"

I have a custom install location for VS, which includes spaces. I am also on an AMD processor

from swift-cmake-examples.

compnerd avatar compnerd commented on August 23, 2024

Ah, interesting. Okay, so, the question is why does it fail to configure without the quotes? With the quotes, you cannot use the %SDKROOT% variable unfortunately, since you need the path separator to be /. So you could do:

cmake -B build -D CMAKE_BUILD_TYPE=Release -D BUILD_TESTING=YES -D CMAKE_Swift_FLAGS="-sdk C:/Library/Developer/Platforms/Windows.platform/Developer/SDKs/Windows.sdk" -G Ninja -S .

from swift-cmake-examples.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.