tpoechtrager / osxcross

Mac OS X cross toolchain for Linux, FreeBSD, OpenBSD and Android (Termux)
GNU General Public License v2.0
2.92k stars 329 forks source link

build.sh fails trying to build cctools #436

Open Nibroc00 opened 2 weeks ago

Nibroc00 commented 2 weeks ago

I have been trying everything I can think of to build osxcross the last couple days, but any issue I resolve another takes its place.

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.5 LTS
Release:        22.04
Codename:       jammy

This is specifically through WSL currently for testing.

Steps I've taken:

  1. ./tools/gen_sdk_package.sh on a Mac to package the SDK (15.1) and copied to /tarballs
  2. ./tools/get_dependencies.sh to install dependencies
  3. OCDEBUG=1 UNATTENDED=1 ./build.sh > output.txt 2>&1 to output errors to the attached file.

I get the following errors:

libcodedirectory.c:242:56: error: use of undeclared identifier 'DISPATCH_QUEUE_SERIAL'
        log_queue = dispatch_queue_create("libcd_log", DISPATCH_QUEUE_SERIAL);
                                                       ^
libcodedirectory.c:948:40: error: use of undeclared identifier 'DISPATCH_APPLY_AUTO'
            dispatch_apply(page_count, DISPATCH_APPLY_AUTO, ^(size_t page_no) {
                                       ^
libcodedirectory.c:951:58: error: reference to local variable 'local_ret' declared in enclosing block literal
                ret = (ret == LIBCD_SERIALIZE_SUCCESS) ? local_ret : ret;
                                                         ^
libcodedirectory.c:950:42: note: 'local_ret' declared here
                enum libcd_serialize_ret local_ret = _libcd_hash_page(s, page_no, page_count, hi, destination);
                                         ^
3 errors generated.
make[4]: *** [Makefile:578: ld-libcodedirectory.o] Error 1
make[4]: *** Waiting for unfinished jobs....
make[4]: Leaving directory '/home/nibroc/osxcross/build/cctools-port/cctools/ld64/src/ld'
make[3]: *** [Makefile:665: all-recursive] Error 1
make[3]: Leaving directory '/home/nibroc/osxcross/build/cctools-port/cctools/ld64/src/ld'
make[2]: *** [Makefile:387: all-recursive] Error 1
make[2]: Leaving directory '/home/nibroc/osxcross/build/cctools-port/cctools/ld64/src'
make[1]: *** [Makefile:388: all-recursive] Error 1
make[1]: Leaving directory '/home/nibroc/osxcross/build/cctools-port/cctools/ld64'
make: *** [Makefile:422: all-recursive] Error 1

Apologies if I am missing something obvious. Any help is appreciated and I can provide more details if needed.

output.txt

tpoechtrager commented 2 weeks ago

I think you might have a broken libdispatch installation in your system.

Can you try what happens when you build the testing branch?

Nibroc00 commented 2 weeks ago

I believe you are right @tpoechtrager I have tried a myriad of different things trying to build osxcross and probably messed up something along the way. I get a new failure though that I have seen before but thought I had fixed (Apparently not).

Re-cloning osxcross and rerunning on the test branch just to make sure we have a clean slate. We get:

In file included from /home/nibroc/osxcross/oclang/test.cpp:1:
In file included from /home/nibroc/osxcross/target/bin/../SDK/MacOSX15.1.sdk/usr/include/c++/v1/iostream:43:
In file included from /home/nibroc/osxcross/target/bin/../SDK/MacOSX15.1.sdk/usr/include/c++/v1/ios:223:
In file included from /home/nibroc/osxcross/target/bin/../SDK/MacOSX15.1.sdk/usr/include/c++/v1/__locale:15:
In file included from /home/nibroc/osxcross/target/bin/../SDK/MacOSX15.1.sdk/usr/include/c++/v1/__memory/shared_ptr.h:24:
In file included from /home/nibroc/osxcross/target/bin/../SDK/MacOSX15.1.sdk/usr/include/c++/v1/__memory/allocation_guard.h:15:
In file included from /home/nibroc/osxcross/target/bin/../SDK/MacOSX15.1.sdk/usr/include/c++/v1/__memory/allocator_traits.h:14:
In file included from /home/nibroc/osxcross/target/bin/../SDK/MacOSX15.1.sdk/usr/include/c++/v1/__memory/construct_at.h:23:
/home/nibroc/osxcross/target/bin/../SDK/MacOSX15.1.sdk/usr/include/c++/v1/new:250:16: error: no type named 'size_t' in namespace 'std'; did you mean simply 'size_t'?
operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
               ^~~~~
/usr/lib/llvm-14/bin/../lib/clang/14.0.0/include/stddef.h:46:23: note: 'size_t' declared here
typedef __SIZE_TYPE__ size_t;
                      ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
+ _exit
+ EC=1
+ '[' 1 -ne 0 ']'
+ test -z build.sh
+ echo ''

+ echo 'exiting with abnormal exit code (1)'
exiting with abnormal exit code (1)
+ test -n 1
+ '[' -n cctools-port ']'
+ rm -f 'build/*_built_successfully'
+ echo ''

+ test build.sh = build.sh
+ check_for_bug_1242300
+ '[' -e /etc/issue ']'
++ grep -i ubuntu.13.10 /etc/issue
+ '[' '' ']'

output.txt

tpoechtrager commented 2 weeks ago

Now it seems there is something wrong with your LLVM installation, or the used SDK is broken. Can't say for sure.

I'd suggest to reinstall your WSL image. Should be a quick and easy process.

Nibroc00 commented 1 week ago

I did get a different sdk version and it worked for WSL. Compiling on alpine still has problems, but I believe that is beyond the scope of this issue. Thank you for your help!