Git Product home page Git Product logo

journix's People

Contributors

ianacaburian avatar

Stargazers

 avatar

Watchers

 avatar

journix's Issues

Juce Flakes

Tasks

  • Create nix flake for a simple cmake juce project.

Learn Flakes

Tasks

Solve: CMake configuration with Xcode generator

Source: juce-flakes/flake.nix

{
  description = "juce flake";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs";
    juce-src = {
      url = "github:juce-framework/JUCE/7.0.7";
      flake = false;
    };
  };

  outputs = { self, nixpkgs, juce-src }: 
    let 
    pkgs = nixpkgs.legacyPackages.x86_64-darwin;
    juce = pkgs.darwin.apple_sdk_11_0.stdenv.mkDerivation {
      name = "juce";
      src = juce-src;
      nativeBuildInputs = [ pkgs.cmake ];
      buildInputs = with pkgs.darwin.apple_sdk_11_0.frameworks; [
        Cocoa 
        MetalKit
        WebKit
      ];
      configurePhase = ''
        runHook preConfigure
        cmake -B cmake-build-install -DCMAKE_INSTALL_PREFIX=$out
        runHook postConfigure
      '';
      buildPhase = ''
        runHook preBuild
        cmake --build cmake-build-install --target install
        runHook postBuild
      '';
    };
    in {
      devShell.x86_64-darwin = pkgs.mkShell { 
        name = "juce-flakes shell";
        buildInputs = [
          pkgs.cmake
          juce
        ];
      };
    };
}

Environment

  • Working in "juce-flakes" dir with "juce-flakes/flake.nix" file.
  • Ran following in nix develop shell.
  • CMake configuration with default generator works fine:
iancaburian@Ians-iMac juce-flakes % nix develop
warning: Git tree '/Users/iancaburian/Repos/journix' is dirty
(nix:juce-flakes-shell-env) Ians-iMac:juce-flakes iancaburian$ cmake -B builds
CPP: /Users/iancaburian/repos/journix/juce-flakes/result/Build/CMake
-- Configuring done (0.2s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/iancaburian/repos/journix/juce-flakes/builds

Problem

  • CMake configuration with Xcode generator does not work:
(nix:juce-flakes-shell-env) Ians-iMac:juce-flakes iancaburian$ rm -rf builds
(nix:juce-flakes-shell-env) Ians-iMac:juce-flakes iancaburian$ cmake -G Xcode -B builds
-- The C compiler identification is unknown
-- The CXX compiler identification is Clang 11.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld - broken
CMake Error at /nix/store/24s6vjb6prbysn2a26myhcyx9zzck9kz-cmake-3.26.4/share/cmake-3.26/Modules/CMakeTestCCompiler.cmake:67 (message):
  The C compiler

    "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /Users/iancaburian/repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i
    
    Run Build Command(s):/usr/bin/xcodebuild -project CMAKE_TRY_COMPILE.xcodeproj build -target cmTC_8af3a -parallelizeTargets -configuration Debug -hideShellScriptEnvironment && 2023-08-29 03:27:29.942 xcodebuild[56843:14398090] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)
    Command line invocation:
        /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -project CMAKE_TRY_COMPILE.xcodeproj build -target cmTC_8af3a -parallelizeTargets -configuration Debug -hideShellScriptEnvironment
    
    User defaults from command line:
        HideShellScriptEnvironment = YES
        IDEPackageSupportUseBuiltinSCM = YES
    
    Computing target dependency graph and provisioning inputs
    
    Create build description
    Build description signature: 933e06fe4cff6730bc71e78ad1f7dac5
    Build description path: /Users/iancaburian/repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/build/XCBuildData/933e06fe4cff6730bc71e78ad1f7dac5.xcbuilddata
    
    note: Building targets in dependency order
    warning: The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.12, but the range of supported deployment target versions is 10.13 to 13.3.99.
    CreateBuildDirectory /Users/iancaburian/repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/build
        cd /Users/iancaburian/Repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/CMAKE_TRY_COMPILE.xcodeproj
        builtin-create-build-directory /Users/iancaburian/repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/build
    
    CreateBuildDirectory /Users/iancaburian/repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/Debug
        cd /Users/iancaburian/Repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/CMAKE_TRY_COMPILE.xcodeproj
        builtin-create-build-directory /Users/iancaburian/repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/Debug
    
    CreateBuildDirectory /Users/iancaburian/repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/build/EagerLinkingTBDs/Debug
        cd /Users/iancaburian/Repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/CMAKE_TRY_COMPILE.xcodeproj
        builtin-create-build-directory /Users/iancaburian/repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/build/EagerLinkingTBDs/Debug
    
    /Users/iancaburian/Repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/CMAKE_TRY_COMPILE.xcodeproj: warning: The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.12, but the range of supported deployment target versions is 10.13 to 13.3.99. (in target 'cmTC_8af3a' from project 'CMAKE_TRY_COMPILE')
    WriteAuxiliaryFile /Users/iancaburian/repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/build/cmTC_8af3a.build/Debug/Objects-normal/x86_64/cmTC_8af3a.LinkFileList (in target 'cmTC_8af3a' from project 'CMAKE_TRY_COMPILE')
        cd /Users/iancaburian/Repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i
        write-file /Users/iancaburian/repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/build/cmTC_8af3a.build/Debug/Objects-normal/x86_64/cmTC_8af3a.LinkFileList
    
    CompileC /Users/iancaburian/repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/build/cmTC_8af3a.build/Debug/Objects-normal/x86_64/testCCompiler.o /Users/iancaburian/Repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/testCCompiler.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler (in target 'cmTC_8af3a' from project 'CMAKE_TRY_COMPILE')
        cd /Users/iancaburian/Repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i
        clang -x c -target x86_64-apple-macos10.12 -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-implicit-fallthrough -DCMAKE_INTDIR\=\"Debug\" -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -Wno-sign-conversion -Wno-infinite-recursion -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-semicolon-before-method-body -I/Users/iancaburian/repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/Debug/include -I/Users/iancaburian/repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/build/cmTC_8af3a.build/Debug/DerivedSources-normal/x86_64 -I/Users/iancaburian/repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/build/cmTC_8af3a.build/Debug/DerivedSources/x86_64 -I/Users/iancaburian/repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/build/cmTC_8af3a.build/Debug/DerivedSources -F/Users/iancaburian/repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/Debug -MMD -MT dependencies -MF /Users/iancaburian/repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/build/cmTC_8af3a.build/Debug/Objects-normal/x86_64/testCCompiler.d --serialize-diagnostics /Users/iancaburian/repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/build/cmTC_8af3a.build/Debug/Objects-normal/x86_64/testCCompiler.dia -c /Users/iancaburian/Repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/testCCompiler.c -o /Users/iancaburian/repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/build/cmTC_8af3a.build/Debug/Objects-normal/x86_64/testCCompiler.o
    
    Ld /Users/iancaburian/repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/Debug/cmTC_8af3a normal (in target 'cmTC_8af3a' from project 'CMAKE_TRY_COMPILE')
        cd /Users/iancaburian/Repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld -Xlinker -reproducible -target x86_64-apple-macos10.12 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -L/Users/iancaburian/repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/build/EagerLinkingTBDs/Debug -L/Users/iancaburian/repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/Debug -F/Users/iancaburian/repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/build/EagerLinkingTBDs/Debug -F/Users/iancaburian/repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/Debug -filelist /Users/iancaburian/repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/build/cmTC_8af3a.build/Debug/Objects-normal/x86_64/cmTC_8af3a.LinkFileList -Xlinker -no_deduplicate -Wl,-search_paths_first -Wl,-headerpad_max_install_names -Xlinker -dependency_info -Xlinker /Users/iancaburian/repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/build/cmTC_8af3a.build/Debug/Objects-normal/x86_64/cmTC_8af3a_dependency_info.dat -o /Users/iancaburian/repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/Debug/cmTC_8af3a
    ld: unknown option: -Xlinker
    
    ** BUILD FAILED **
    
    
    The following build commands failed:
        Ld /Users/iancaburian/repos/journix/juce-flakes/builds/CMakeFiles/CMakeScratch/TryCompile-Osfo2i/Debug/cmTC_8af3a normal (in target 'cmTC_8af3a' from project 'CMAKE_TRY_COMPILE')
    (1 failure)
    
    

  

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


-- Configuring incomplete, errors occurred!
  • Solution should not have to involve custom toolchain file/config in CMake.
  • Including pkgs.xcodebuild6 does not work.
  • Possible lead: reference Xcode.app in nix store as a nativeBuildInput (see 0.3 Add Xcode to nix store).
  • Possible lead: find if there is an alternative pkgs.mkShell function that includes the necessary environment (similar to how apple_sdk_11_0 has its own stdenv).

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.