SerenityOS / jakt

The Jakt Programming Language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build fails after AK const-laundering changes

donelli opened this issue · comments

I'm trying to build stage0 on macos, but i'm getting an error.

Here are the steps that I have made:

  • Cloned the repo
  • Runned: cmake -B build -GNinja -DCMAKE_CXX_COMPILER=clang++
  • Runned: ninja -C build

Then this error happens:

➜  jakt git:(main) ✗ ninja -C build                                     
ninja: Entering directory `build'
[0/2] Re-checking globbed directories...
[1/71] Building CXX object runtime/CMakeFiles/jakt_main.dir/Main.cpp.o
FAILED: runtime/CMakeFiles/jakt_main.dir/Main.cpp.o 
/usr/bin/clang++  -I/Users/user/Desktop/jakt/runtime -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk -fPIC -Wno-unused-local-typedefs -Wno-unused-function -Wno-unused-variable -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-unused-result -Wno-implicit-fallthrough -Wno-trigraphs -Wno-parentheses-equality -Wno-unqualified-std-cast-call -Wno-user-defined-literals -Wno-literal-suffix -Wno-return-type -Wno-deprecated-declarations -Wno-unknown-warning-option -Wno-unused-command-line-argument -fdiagnostics-color=always -Wno-unknown-attributes -fno-exceptions -std=gnu++20 -MD -MT runtime/CMakeFiles/jakt_main.dir/Main.cpp.o -MF runtime/CMakeFiles/jakt_main.dir/Main.cpp.o.d -o runtime/CMakeFiles/jakt_main.dir/Main.cpp.o -c /Users/user/Desktop/jakt/runtime/Main.cpp
In file included from /Users/user/Desktop/jakt/runtime/Main.cpp:1:
In file included from /Users/user/Desktop/jakt/runtime/lib.h:65:
/Users/user/Desktop/jakt/runtime/Jakt/DeprecatedString.h:22:40: error: no viable overloaded '='
    *bit_cast<RefPtr<StringImpl>*>(&a) = result.impl(); // I'm sorry.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~
/Users/user/Desktop/jakt/runtime/AK/RefPtr.h:113:13: note: candidate template ignored: could not match 'OwnPtr<type-parameter-0-0, DefaultDelete<type-parameter-0-0>>' against 'const AK::StringImpl *'
    RefPtr& operator=(OwnPtr<U> const&) = delete;
            ^
/Users/user/Desktop/jakt/runtime/AK/RefPtr.h:127:27: note: candidate function not viable: no known conversion from 'const AK::StringImpl *' to 'AK::RefPtr<AK::StringImpl>' for 1st argument
    ALWAYS_INLINE RefPtr& operator=(RefPtr&& other)
                          ^
/Users/user/Desktop/jakt/runtime/AK/RefPtr.h:135:27: note: candidate template ignored: could not match 'RefPtr<type-parameter-0-0>' against 'const AK::StringImpl *'
    ALWAYS_INLINE RefPtr& operator=(RefPtr<U>&& other)
                          ^
/Users/user/Desktop/jakt/runtime/AK/RefPtr.h:144:27: note: candidate template ignored: could not match 'NonnullRefPtr<type-parameter-0-0>' against 'const AK::StringImpl *'
    ALWAYS_INLINE RefPtr& operator=(NonnullRefPtr<U>&& other)
                          ^
/Users/user/Desktop/jakt/runtime/AK/RefPtr.h:152:27: note: candidate function not viable: no known conversion from 'const AK::StringImpl *' to 'const NonnullRefPtr<AK::StringImpl>' for 1st argument
    ALWAYS_INLINE RefPtr& operator=(NonnullRefPtr<T> const& other)
                          ^
/Users/user/Desktop/jakt/runtime/AK/RefPtr.h:160:27: note: candidate template ignored: could not match 'NonnullRefPtr<type-parameter-0-0>' against 'const AK::StringImpl *'
    ALWAYS_INLINE RefPtr& operator=(NonnullRefPtr<U> const& other)
                          ^
/Users/user/Desktop/jakt/runtime/AK/RefPtr.h:168:27: note: candidate function not viable: no known conversion from 'const AK::StringImpl *' to 'const AK::RefPtr<AK::StringImpl>' for 1st argument
    ALWAYS_INLINE RefPtr& operator=(RefPtr const& other)
                          ^
/Users/user/Desktop/jakt/runtime/AK/RefPtr.h:176:27: note: candidate template ignored: could not match 'RefPtr<type-parameter-0-0>' against 'const AK::StringImpl *'
    ALWAYS_INLINE RefPtr& operator=(RefPtr<U> const& other)
                          ^
/Users/user/Desktop/jakt/runtime/AK/RefPtr.h:184:27: note: candidate function not viable: 1st argument ('const AK::StringImpl *') would lose const qualifier
    ALWAYS_INLINE RefPtr& operator=(T* ptr)
                          ^
/Users/user/Desktop/jakt/runtime/AK/RefPtr.h:191:27: note: candidate function not viable: no known conversion from 'const AK::StringImpl *' to 'AK::StringImpl &' for 1st argument
    ALWAYS_INLINE RefPtr& operator=(T& object)
                          ^
/Users/user/Desktop/jakt/runtime/AK/RefPtr.h:198:13: note: candidate function not viable: no known conversion from 'const AK::StringImpl *' to 'AK::nullptr_t' (aka 'std::nullptr_t') for 1st argument
    RefPtr& operator=(nullptr_t)
            ^
1 error generated.
[5/71] Building jakt file selfhost/main.jakt with jakt_stage0
ninja: build stopped: subcommand failed.
  • clang version
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: x86_64-apple-darwin22.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Recent upstream changes to serenity surrounding const-correctness for RefPtrs caused some of the Jakt runtime to be left now incorrect

Fixed by reverting the strictness change in AK:
SerenityOS/serenity@7ac7a73