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

Error with windows linking when compiling with zig 0.11.0-dev.750+25d3713b0 #104

Open
jblumie opened this issue Dec 14, 2022 · 2 comments
Open

Comments

@jblumie
Copy link

jblumie commented Dec 14, 2022

When trying to compile the example I get the following error:

/usr/lib/zig/lib/std/build/LibExeObjStep.zig:22:28: error: 'VcpkgRoot' is not marked 'pub'
const VcpkgRoot = std.build.VcpkgRoot;
                  ~~~~~~~~~^~~~~~~~~~
/usr/lib/zig/lib/std/build.zig:1472:1: note: declared here
const VcpkgRoot = union(VcpkgRootStatus) {
^~~~~
referenced by:
    addVcpkgPaths: /usr/lib/zig/lib/std/build/LibExeObjStep.zig:972:17
    link: /strg/prgm/zig/usg/lib/SDL.zig/Sdk.zig:168:12
    remaining reference traces hidden; use '-freference-trace' to see all reference traces

Looking at the source code I see that it is a Windows related error and I'm on Linux, the target os tag says so. Commenting from line 165 to 306 (windows SDL2 linking) makes the error go away and the program runs just fine

@jblumie jblumie changed the title Error compiling with zig 0.11.0-dev.750+25d3713b0 Error with SDL linking for findows when compiling with zig 0.11.0-dev.750+25d3713b0 Dec 14, 2022
@jblumie jblumie changed the title Error with SDL linking for findows when compiling with zig 0.11.0-dev.750+25d3713b0 Error with windows linking when compiling with zig 0.11.0-dev.750+25d3713b0 Dec 14, 2022
@ikskuh
Copy link
Owner

ikskuh commented Dec 14, 2022

The patch here is to make the following section only be available on a windows build host:
https://github.com/MasterQ32/SDL.zig/blob/2fbd4b228516bf08348a3173f1446c7e8d75540a/Sdk.zig#L165-L179

Feel free to submit a PR, i can't test on windows right now

@kassane
Copy link

kassane commented Dec 14, 2022

However, it is now affecting other targets.

/Users/runner/hostedtoolcache/zig/zig-macos-x86_64-0.11.0-dev.771+5d3adc568/x64/lib/std/build/LibExeObjStep.zig:22:28: error: 'VcpkgRoot' is not marked 'pub'
const VcpkgRoot = std.build.VcpkgRoot;
                  ~~~~~~~~~^~~~~~~~~~
/Users/runner/hostedtoolcache/zig/zig-macos-x86_64-0.11.0-dev.771+5d3adc568/x64/lib/std/build.zig:1472:1: note: declared here
const VcpkgRoot = union(VcpkgRootStatus) {
^~~~~

Code:

// falsed (default)
if (option.sdl_enabled) {
        // import SDL bindings
        const sdl = @import("vendor/SDL2-zig/Sdk.zig");

        const sdk = sdl.init(b);
        example.addPackage(sdk.getNativePackage("sdl2"));
        sdk.link(example, .dynamic);
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants