jiacai2050/zig-curl

cimport has no member named 'struct_curl_version_info_data'

Closed this issue · 2 comments

Hi, I've overcome a silly compilation problem with dependencies below:

zig version: 0.12.0-dev
detailed version:
zig-linux-x86_64-0.12.0-dev.415+5af5d87ad

libcurl version:
libcurl3/xenial-security,xenial-updates,now 7.47.0-1ubuntu2.19 amd64 [installed]
libcurl3-gnutls/now 7.47.0-1ubuntu2.1 amd64 [installed,upgradable to: 7.47.0-1ubuntu2.19]
libcurl3-nss/xenial-security,xenial-updates,now 7.47.0-1ubuntu2.19 amd64 [installed,automatic]
libcurl4-nss-dev/xenial-security,xenial-updates,now 7.47.0-1ubuntu2.19 amd64 [installed]

distro version: "Ubuntu 16.04 LTS"
kernel version: 4.9.0-141-custom

zig build-exe advanced Debug native: error: the following command failed with 1 compilation errors:
/usr/lib/zig-linux-x86_64-0.12.0-dev.415+5af5d87ad/zig build-exe -freference-trace=256 /tmp/test/zig-curl/examples/advanced.zig -lcurl -lc --cache-dir /tmp/test/zig-curl/zig-cache --global-cache-dir /home/hetingyao/.cache/zig --name advanced --mod curl::/tmp/test/zig-curl/src/main.zig --deps curl --listen=- 
Build Summary: 0/3 steps succeeded; 1 failed (disable with --summary none)
run-advanced transitive failure
└─ run advanced transitive failure
   └─ zig build-exe advanced Debug native 1 errors
src/c.zig:32:20: error: root struct of file '.tmp.test.zig-curl.zig-cache.o.08f1cd180643c9b6d1ed4f4fab50a6f9.cimport' has no member named 'struct_curl_version_info_data'
    if (@hasField(c.struct_curl_version_info_data, "feature_names")) {
                  ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
referenced by:
    print_libcurl_version: src/main.zig:7:51
    main: examples/advanced.zig:92:9
    callMain: /usr/lib/zig-linux-x86_64-0.12.0-dev.415+5af5d87ad/lib/std/start.zig:574:32
    initEventLoopAndCallMain: /usr/lib/zig-linux-x86_64-0.12.0-dev.415+5af5d87ad/lib/std/start.zig:508:34
    callMainWithArgs: /usr/lib/zig-linux-x86_64-0.12.0-dev.415+5af5d87ad/lib/std/start.zig:458:12
    main: /usr/lib/zig-linux-x86_64-0.12.0-dev.415+5af5d87ad/lib/std/start.zig:473:34
Makefile:3: recipe for target 'run-examples' failed
make: *** [run-examples] Error 2

I've tried serval times for reinstalling different versions of libcurl and libcurl-dev, but it always shows that the struct_curl_version_info_data is missing, or did I miss something fatal to make it build through? please kindly help to give me some clues.

Hi, curl_version_info_data is added in 7.10 according to this.

It seems you are running with libcurl 7.47.0, which should contains this structure.

You can try comment L92 in advanced.zig, it only print libcurl version, not required for actual work.

Feel free to comment if you still have issues.