yonaskolb / XcodeGen

A Swift command line tool for generating your Xcode project
MIT License
6.99k stars 816 forks source link

Error building XcodeGen #1495

Open jpx40 opened 4 weeks ago

jpx40 commented 4 weeks ago

Creating working copy for https://github.com/jpsim/Yams.git Working copy of https://github.com/jpsim/Yams.git resolved at 5.0.1 /home/jonas/repo/XcodeGen/.build/checkouts/ArtifactBundleGen/Plugins/ArtifactBundleGenPluginCommand/Symbolic Links/ArtifactBundleGen/Utils/LipoRunnner.swift:11:14: warning: 'launchPath' is deprecated: renamed to 'executableURL' task.launchPath = "/bin/zsh" ^ /home/jonas/repo/XcodeGen/.build/checkouts/ArtifactBundleGen/Plugins/ArtifactBundleGenPluginCommand/Symbolic Links/ArtifactBundleGen/Utils/LipoRunnner.swift:11:14: note: use 'executableURL' instead task.launchPath = "/bin/zsh" ^~~~~~ executableURL /home/jonas/repo/XcodeGen/.build/checkouts/ArtifactBundleGen/Plugins/ArtifactBundleGenPluginCommand/Symbolic Links/ArtifactBundleGen/Utils/ZipComposer.swift:7:29: warning: result of call to 'run(:arguments:terminationHandler:)' is unused try Process.run(URL(fileURLWithPath: "/usr/bin/zip"), arguments: ["-r", "(bundlePath.relativePath).zip", "(bundlePath.relativePath)"]) { in ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Building for production... /home/jonas/repo/XcodeGen/.build/checkouts/XcodeProj/Sources/XcodeProj/Extensions/String+Utils.swift:25:31: error: ambiguous use of 'arc4random_uniform' let randomValue = arc4random_uniform(UInt32(base.count)) ^ /home/jonas/repo/XcodeGen/.build/checkouts/XcodeProj/Sources/XcodeProj/Extensions/String+Utils.swift:6:17: note: found this candidate public func arc4randomuniform( max: UInt32) -> Int32 { ^ SwiftGlibc.arc4random_uniform:1:13: note: found this candidate public func arc4randomuniform( upper_bound: __uint32_t) -> uint32_t ^ error: fatalError [32/35] Compiling XcodeProj Errors.swift make: *** [Makefile:23: build] Error 1

giginet commented 4 weeks ago

Did you try to build this product on Linux? Could you explain your environment

jpx40 commented 4 weeks ago

Did you try to build this product on Linux? Could you explain your environment

yes i did i use Fedora 40 currently

Howler4695 commented 3 weeks ago

I'm having the same issue trying to build on Ubuntu 24.04 with swift 5.10.1 installed

Working copy of https://github.com/yonaskolb/JSONUtilities.git resolved at 4.2.0
/path/XcodeGen/.build/checkouts/ArtifactBundleGen/Plugins/ArtifactBundleGenPluginCommand/Symbolic Links/ArtifactBundleGen/Utils/LipoRunnner.swift:11:14: warning: 'launchPath' is deprecated: renamed to 'executableURL'
        task.launchPath = "/bin/zsh"
             ^
/path/XcodeGen/.build/checkouts/ArtifactBundleGen/Plugins/ArtifactBundleGenPluginCommand/Symbolic Links/ArtifactBundleGen/Utils/LipoRunnner.swift:11:14: note: use 'executableURL' instead
        task.launchPath = "/bin/zsh"
             ^~~~~~~~~~
             executableURL
/path/XcodeGen/.build/checkouts/ArtifactBundleGen/Plugins/ArtifactBundleGenPluginCommand/Symbolic Links/ArtifactBundleGen/Utils/ZipComposer.swift:7:29: warning: result of call to 'run(_:arguments:terminationHandler:)' is unused
                try Process.run(URL(fileURLWithPath: "/usr/bin/zip"), arguments: ["-r", "\(bundlePath.relativePath).zip", "\(bundlePath.relativePath)"]) { _ in
                            ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[1/1] Compiling plugin ArtifactBundleGenPluginCommand
Building for production...
[1/26] Write sources
[3/26] Copying SettingPresets
[3/26] Write sources
[16/26] Compiling writer.c
[17/26] Write swift-version--470A62AB4DA177DF.txt
[18/26] Compiling reader.c
[19/27] Compiling parser.c
[20/28] Compiling emitter.c
[21/29] Compiling scanner.c
[23/30] Compiling Version Version+Codable.swift
[24/31] Compiling Spectre Case.swift
[25/32] Compiling PathKit PathKit.swift
[26/32] Compiling Rainbow BackgroundColor.swift
[26/32] Write sources
[27/33] Compiling api.c
[29/34] Compiling JSONUtilities DecodingError.swift
[30/34] Compiling AEXML Document.swift
[31/35] Compiling SwiftCLI ArgumentList.swift
[32/35] Compiling XcodeProj Errors.swift
/path/XcodeGen/.build/checkouts/XcodeProj/Sources/XcodeProj/Extensions/String+Utils.swift:25:31: error: ambiguous use of 'arc4random_uniform'
            let randomValue = arc4random_uniform(UInt32(base.count))
                              ^
/path/builds/mdaas/active/cantina/pipeline/XcodeGen/.build/checkouts/XcodeProj/Sources/XcodeProj/Extensions/String+Utils.swift:6:17: note: found this candidate
    public func arc4random_uniform(_ max: UInt32) -> Int32 {
                ^
SwiftGlibc.arc4random_uniform:1:13: note: found this candidate
public func arc4random_uniform(_ __upper_bound: __uint32_t) -> __uint32_t
            ^
error: fatalError
make: *** [Makefile:23: build] Error 1
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 2
Howler4695 commented 3 weeks ago

Fixed the issue locally, it looks like an extension for xcodeproj is using some outdated syntax to try and fix a random number generation bug on Linux. I updated the the random number syntax to a more modern standard and deleted the linux if conditional and am having no more problems. going to do some more testing then try and get the fix pulled into xcodeproj and then update the xcodeproj version for xcodegen

Howler4695 commented 3 weeks ago

https://github.com/tuist/XcodeProj/issues/845