Skip to content

Changes required for > v0.14.0? #8

@Always-Self-Hosted

Description

@Always-Self-Hosted

I want to pull in this dependency in my project so my program can ingest python scripts and run them with some behaviour added. But just trying to get a basic version of this dependency pulled in on zig v0.15.1 doesn't work. Here is the basic and relevant examples:

build.zig.zon:

.{
    .minimum_zig_version = "0.15.1",
    .dependencies = .{
        .cpython = .{
            .url = "git+https://github.com/allyourcodebase/cpython.git#b9871b745dd11dd9b08e7ad1c8493403149a6f08",
            .hash = "cpython-0.0.0-FN2rG3bEAQBfgfSVEVG1RkY4uwykTHwl6wM2gOD9xHMD",
        },
    },
}

build.zig:

const std = @import("std");

pub fn build(b: *std.Build) void {
    const target = b.standardTargetOptions(.{});
    const optimize = b.standardOptimizeOption(.{});

    const cpython_dep = b.dependency("cpython", .{
        .target = target,
        .optimize = optimize,
    });
    const cpython_module = cpython_dep.module("cpython");

    const exe = b.addExecutable(.{
        .name = "testing",
        .root_module = b.createModule(.{
            .root_source_file = b.path("src/main.zig"),
            .target = target,
            .optimize = optimize,
        }),
    });

    exe.root_module.addImport("cpython", cpython_module);

    b.installArtifact(exe);
}

the command im running and zig version:

ash@minty:~/git/personal/testing$ zig version
0.15.1
ash@minty:~/git/personal/testing$ zig build -Dtarget=x86_64-linux-musl
/home/ash/.cache/zig/p/cpython-0.0.0-FN2rG3bEAQBfgfSVEVG1RkY4uwykTHwl6wM2gOD9xHMD/build.zig:1238:22: error: no field named 'autoconf' in union 'Build.Step.ConfigHeader.Style'
        .style = .{ .autoconf = upstream.path("pyconfig.h.in") },
                     ^~~~~~~~
/usr/local/zig/lib/std/Build/Step/ConfigHeader.zig:7:19: note: union declared here
pub const Style = union(enum) {
                  ^~~~~
referenced by:
    build: /home/ash/.cache/zig/p/cpython-0.0.0-FN2rG3bEAQBfgfSVEVG1RkY4uwykTHwl6wM2gOD9xHMD/build.zig:96:42
    runBuild__anon_76637: /usr/local/zig/lib/std/Build.zig:2215:44
    10 reference(s) hidden; use '-freference-trace=12' to see all references
/home/ash/.cache/zig/p/zlib-1.3.1-ZZQ7lVgMAACwO4nUUd8GLhsuQ5JQq_VAhlEiENJTUv6h/build.zig:5:18: error: no field or member function named 'addStaticLibrary' in 'Build'
    const lib = b.addStaticLibrary(.{
                ~^~~~~~~~~~~~~~~~~
/usr/local/zig/lib/std/Build.zig:1:1: note: struct declared here
const std = @import("std.zig");
^~~~~
/home/ash/.cache/zig/p/zlib-1.3.1-ZZQ7lVgMAACwO4nUUd8GLhsuQ5JQq_VAhlEiENJTUv6h/build.zig:5:18: note: method invocation only supports up to one level of implicit pointer dereferencing
/home/ash/.cache/zig/p/zlib-1.3.1-ZZQ7lVgMAACwO4nUUd8GLhsuQ5JQq_VAhlEiENJTUv6h/build.zig:5:18: note: use '.*' to dereference pointer

If this is something different and this is actually a me problem i apologise but would very much appreciate you pointing me in the right direction. I have not been able to figure this out and grok is suggesting is incompatibility with my zig version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions