Skip to content

./lib/std/Thread/Futex.zig:724:33: error: expected integer type, found 'comptime_int' #13673

@nikkicoon

Description

@nikkicoon

I'm trying to fix the build of zig 0.10.0 in pkgsrc on NetBSD.

I keep running into this error even for builds from git outside of pkgsrc:

[ 99%] Building stage2 object /home/nikita/re-src/zig/build/zig2.o
./lib/std/Thread/Futex.zig:724:33: error: expected integer type, found 'comptime_int'
            return addr >> @ctz(alignment);
                                ^
./lib/std/os.zig:5304:17: error: querying for canonical path of a handle is unsupported on this host
        else => @compileError("querying for canonical path of a handle is unsupported on this host"),
                ^
./lib/std/fs.zig:60:38: error: container 'std.os' has no member called 'MAXNAMLEN'
    .netbsd, .openbsd, .solaris => os.MAXNAMLEN,
                                     ^
*** Error code 1

Stop.

build in pkgsrc looks similar:

[ 98%] Built target zig1
[ 99%] Building stage2 object /tmp/work/zig-0.10.0/zig2.o
./lib/std/Thread/Futex.zig:724:33: error: expected integer type, found 'comptime_int'
            return addr >> @ctz(alignment);
                                ^
./lib/std/os.zig:5300:17: error: querying for canonical path of a handle is unsupported on this host
        else => @compileError("querying for canonical path of a handle is unsupported on this host"),
                ^
./lib/std/fs.zig:60:38: error: container 'std.os' has no member called 'MAXNAMLEN'
    .netbsd, .openbsd, .solaris => os.MAXNAMLEN,
                                     ^
--- zig2.o ---
*** [zig2.o] Error code 1

make[2]: stopped in /tmp/work/zig-0.10.0
1 error

make[2]: stopped in /tmp/work/zig-0.10.0
--- CMakeFiles/zig2.dir/all ---
*** [CMakeFiles/zig2.dir/all] Error code 2

make[1]: stopped in /tmp/work/zig-0.10.0
1 error

make[1]: stopped in /tmp/work/zig-0.10.0
*** [all] Error code 2

make: stopped in /tmp/work/zig-0.10.0
1 error

make: stopped in /tmp/work/zig-0.10.0
*** Error code 2

Stop.

pkgsrc build gets passed:
CMAKE_ARGS+= -DCMAKE_BUILD_TYPE=Release
CMAKE_ARGS+= -DDESTDIR=${DESTDIR}

locally in my pkgsrc, not commited, additionally these:
CMAKE_ARGS+= -DZIG_USE_CACHE=OFF
CMAKE_ARGS+= -DZIG_SHARED_LLVM=ON
CMAKE_ARGS+= -DCMAKE_PREFIX_PATH=${BUILDLINK_PREFIX.llvm}
CMAKE_ARGS+= -DZIG_PREFER_CLANG_CPP_DYLIB=ON

both produce equal results.

dependencies are all the required versions, I can include the exact version when required.

local build log:

-- The C compiler identification is GNU 10.4.0
-- The CXX compiler identification is GNU 10.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring zig version 0.11.0-dev.337+609716524
-- Found llvm: -lLLVM-15;-lrt;-lexecinfo;-lpthread;-lm;-lz;-lzstd;-lterminfo;-lxml2 (Required is at least version "15") 
-- Found clang: /usr/pkg/lib/libclang-cpp.so.15 (Required is at least version "15") 
-- Found lld: /usr/pkg/lib/liblldMinGW.a;/usr/pkg/lib/liblldELF.a;/usr/pkg/lib/liblldCOFF.a;/usr/pkg/lib/liblldWasm.a;/usr/pkg/lib/liblldMachO.a;/usr/pkg/lib/liblldCommon.a (Required is at least version "15") 
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Configuring done
-- Generating done
-- Build files have been written to: /home/nikita/re-src/zig/build
hex$ make install
....
[ 97%] Linking CXX static library zigcpp/libzigstage1.a
[ 97%] Built target zigstage1
[ 98%] Building CXX object CMakeFiles/zig1.dir/src/stage1/zig0.cpp.o
[ 98%] Linking CXX executable zig1
[ 98%] Built target zig1
[ 99%] Building stage2 object /home/nikita/re-src/zig/build/zig2.o
./lib/std/Thread/Futex.zig:724:33: error: expected integer type, found 'comptime_int'
            return addr >> @ctz(alignment);
                                ^
./lib/std/os.zig:5304:17: error: querying for canonical path of a handle is unsupported on this host
        else => @compileError("querying for canonical path of a handle is unsupported on this host"),
                ^
./lib/std/fs.zig:60:38: error: container 'std.os' has no member called 'MAXNAMLEN'
    .netbsd, .openbsd, .solaris => os.MAXNAMLEN,

how can I solve this? has there been a patch which I can cherry-pick?

thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.standard libraryThis issue involves writing Zig code for the standard library.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions