Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Darwin target: triple conflicts #1

Closed
Tracked by #3
kassane opened this issue Dec 18, 2023 · 9 comments
Closed
Tracked by #3

Darwin target: triple conflicts #1

kassane opened this issue Dec 18, 2023 · 9 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@kassane
Copy link
Owner

kassane commented Dec 18, 2023

During the last commit it is noticed that ldc2 passes its triple target to the compiler attached to the --gcc=$PWD/scripts/zcc.sh flag, returning an unknown architecture to zig cc.

In CI/CD using Linux the issue does not occur.
On Windows not yet tested, being aware that there is better ldc2 support for the msvc target.

.zig_cc = true, // use zig as cc and linker

cc: @kinke

Note: on MacOS, zig toolchain replace LLD to zld!!!

Reference

@kassane kassane mentioned this issue Dec 18, 2023
13 tasks
@kassane
Copy link
Owner Author

kassane commented Dec 19, 2023

On Windows not yet tested, being aware that there is better ldc2 support for the msvc target.

Tested and works: https://github.com/kassane/sokol-d/actions/runs/7262183956/job/19784820808

@kassane kassane added bug Something isn't working good first issue Good for newcomers labels Dec 19, 2023
@kassane
Copy link
Owner Author

kassane commented Dec 24, 2023

Today, replaced shell scripts to new zigcc wrapper:
https://github.com/kassane/sokol-d/actions/runs/7315489869/job/19929196750#step:6:10

zig cc -lunwind /Users/runner/work/sokol-d/sokol-d/zig-cache/o/dba65f0ce2102f5ffacdbe1efd2dde0b/debugtext_print.o -o /Users/runner/work/sokol-d/sokol-d/zig-out/bin/debugtext_print /Users/runner/hostedtoolcache/dc/ldc2-dc393dcf/x64/ldc2-dc393dcf-osx-universal/bin/../lib-x86_64/libldc_rt.asan.dylib -rpath @executable_path -rpath /Users/runner/hostedtoolcache/dc/ldc2-dc393dcf/x64/ldc2-dc393dcf-osx-universal/bin/../lib-x86_64 -fuse-ld=/Users/runner/work/sokol-d/sokol-d/zig-out/bin/zcc -target x86_64-apple-macos -L/Users/runner/work/sokol-d/sokol-d/zig-out/lib -lsokol -ObjC -DIMPL -DSOKOL_METAL -Xlinker -framework -Xlinker QuartzCore -Xlinker -framework -Xlinker MetalKit -Xlinker -framework -Xlinker Metal -Xlinker -framework -Xlinker Cocoa -Xlinker -framework -Xlinker Foundation -Xlinker -framework -Xlinker AudioToolbox -L/Users/runner/hostedtoolcache/dc/ldc2-dc393dcf/x64/ldc2-dc393dcf-osx-universal/bin/../lib-x86_64 -lphobos2-ldc -ldruntime-ldc -Wl,-dead_strip -lpthread -lm -m64

error: UnknownOperatingSystem

zigcc get from ldc -target x86_64-apple-macos!!!

@kassane
Copy link
Owner Author

kassane commented Dec 24, 2023

Tried fix: ff14c99

sokol-d/tools/zigcc.zig

Lines 24 to 28 in ff14c99

while (args.next()) |arg| {
if (std.mem.eql(u8, arg, std.fmt.comptimePrint("{s}-apple-{s}", .{ @tagName(builtin.cpu.arch), @tagName(builtin.os.tag) })))
try cmds.append(std.fmt.comptimePrint("{s}-{s}-{s}", .{ @tagName(builtin.cpu.arch), @tagName(builtin.os.tag), @tagName(builtin.abi) }))
else
try cmds.append(arg);

Whats?? No detect apple frameworks? (Linked to target/mtriple? maybe)

error: unable to find framework 'QuartzCore'. searched paths:  none
error: unable to find framework 'MetalKit'. searched paths:  none
error: unable to find framework 'Metal'. searched paths:  none
error: unable to find framework 'Cocoa'. searched paths:  none
error: unable to find framework 'Foundation'. searched paths:  none
error: unable to find framework 'AudioToolbox'. searched paths:  none
Build Summary: 13/13 steps succeeded
debugtext_print success
 +- ldc2 success 2s MaxRSS:243M
   +- sokol library success
      +- install sokol success
      |  +- zig build-lib sokol Debug native success 6s MaxRSS:148M
      +- install zcc cached
      |  +- zig build-exe zcc Debug native cached 2s MaxRSS:13M
      +- install zcc cached
      |  +- zig build-exe zcc Debug native success 2s MaxRSS:159M
      +- install zcc success
      |  +- zig build-exe zcc Debug native cached 2s MaxRSS:13M
      +- install zcc cached
         +- zig build-exe zcc Debug native cached 34ms MaxRSS:13M

full log: https://github.com/kassane/sokol-d/actions/runs/7315549427/job/19929317220#step:6:1

@kassane
Copy link
Owner Author

kassane commented Dec 26, 2023

error: unable to find framework 'QuartzCore'. searched paths: none
error: unable to find framework 'MetalKit'. searched paths: none
error: unable to find framework 'Metal'. searched paths: none
error: unable to find framework 'Cocoa'. searched paths: none
error: unable to find framework 'Foundation'. searched paths: none
error: unable to find framework 'AudioToolbox'. searched paths: none

Zig toolchain get system-deps only for native (host) target.

fixed: b235f83

https://github.com/kassane/sokol-d/actions/runs/7329902380/job/19960178646#step:6:26
But,

error: undefined reference to symbol section$end$__DATA$.minfo
    note: referenced in /Users/runner/hostedtoolcache/dc/ldc2-dc393dcf/x64/ldc2-dc393dcf-osx-universal/lib-x86_64/libdruntime-ldc.a(dso.o)

@kassane
Copy link
Owner Author

kassane commented Dec 26, 2023

error: undefined reference to symbol section$end$__DATA$.minfo
    note: referenced in /Users/runner/hostedtoolcache/dc/ldc2-dc393dcf/x64/ldc2-dc393dcf-osx-universal/lib-x86_64/libdruntime-ldc.a(dso.o)

Tried static-linking from ldc libs... zig preference!!

@kassane
Copy link
Owner Author

kassane commented Jan 6, 2024

Similar warnings tested by @floooh on macOS M1:

'apple_a14' is not a recognized processor for this target (ignoring processor)
ld: warning: no platform load command found in... debugtext_print.o', assuming: macOS
ld: warning: object file ... was built for newer 'macOS' version (14.1.2) than being linked (12.0)

Need more details...

latest commit test: https://github.com/kassane/sokol-d/actions/runs/7432776307/job/20224966588#step:6:1

ld: warning: object file (/Users/runner/work/sokol-d/sokol-d/zig-out/lib/libsokol.a(/Users/runner/work/sokol-d/sokol-d/zig-cache/o/bd614abb9849c8b09f2f013f01f1d2eb/sokol_log.o)) was built for newer macOS version (12.7.2) than being linked (12.0)
ld: warning: object file (/Users/runner/work/sokol-d/sokol-d/zig-out/lib/libsokol.a(/Users/runner/work/sokol-d/sokol-d/zig-cache/o/fc3b843499b8f3a388854c6ef14ddd2e/sokol_app.o)) was built for newer macOS version (12.7.2) than being linked (12.0)
ld: warning: object file (/Users/runner/work/sokol-d/sokol-d/zig-out/lib/libsokol.a(/Users/runner/work/sokol-d/sokol-d/zig-cache/o/a5760ab9544cd1ab43e220d627b08c76/sokol_gfx.o)) was built for newer macOS version (12.7.2) than being linked (12.0)
ld: warning: object file (/Users/runner/work/sokol-d/sokol-d/zig-out/lib/libsokol.a(/Users/runner/work/sokol-d/sokol-d/zig-cache/o/59a41ba45ab7003059cc6442c30d5448/sokol_glue.o)) was built for newer macOS version (12.7.2) than being linked (12.0)

Edit

@kassane kassane reopened this Jan 6, 2024
@kassane
Copy link
Owner Author

kassane commented Jan 6, 2024

on intel MacOS (CI/CD) verbose build:

[test] commit: 60d7e5f
zig linker:
https://github.com/kassane/sokol-d/actions/runs/7432883556/job/20225206729#step:6:16

zig ld -dynamic -platform_version macos 12.7.2 13.1 -syslibroot /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -pagezero_size 0x100000000 -headerpad_size 0x1000 -dead_strip -e _main /Users/runner/work/sokol-d/sokol-d/zig-cache/o/8441520852fd3bf30fcee699975c9b06/debugtext_print.o /Users/runner/work/sokol-d/sokol-d/zig-out/lib/libsokol.a /Users/runner/.cache/zig/o/3a98447431f97e1c3072e126d6b01152/libcompiler_rt.a -o /Users/runner/work/sokol-d/sokol-d/zig-out/bin/debugtext_print -lSystem -framework Foundation -framework AudioToolbox -framework MetalKit -framework Metal -framework Cocoa -framework QuartzCore

Change zld flag? -platform_version macos 12.7.2 13.1 - not working clang/lld -mmacos-version-min=12 flag on zld!!

@kassane

This comment has been minimized.

@kassane
Copy link
Owner Author

kassane commented Jan 7, 2024

Fix warnings in AppleClang LLD: d3f15ec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant