Opened 12 months ago

Last modified 12 months ago

#67348 new defect

clang-11-bootstrap @11.1.0_4: Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being set

Reported by: Cebtenzzre Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: tiger Cc: catap (Kirill A. Korinsky)
Port: clang-11-bootstrap

Description

The clang-11-bootstrap port, which seems to be required to build libcxx and any version of clang newer than 3.4, still doesn't build on Tiger. Here's the current failure:

:info:configure -- Configuring done
:info:configure CMake Error at cmake/modules/AddLLVM.cmake:525 (add_library):
:info:configure   Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being
:info:configure   set.  This could be because you are using a Mac OS X version less than 10.5
:info:configure   or because CMake's platform configuration is corrupt.
:info:configure Call Stack (most recent call first):
:info:configure   tools/clang/cmake/modules/AddClang.cmake:103 (llvm_add_library)
:info:configure   tools/clang/tools/libclang/CMakeLists.txt:113 (add_clang_library)
:info:configure -- Generating done
:info:configure CMake Warning:
:info:configure   Manually-specified variables were not used by the project:
:info:configure     CLANGD_BUILD_XPC
:info:configure     CLANG_ENABLE_CLANGD
:info:configure     CMAKE_OBJCXX_COMPILER
:info:configure     CMAKE_OBJC_COMPILER
:info:configure     CMAKE_POLICY_DEFAULT_CMP0025
:info:configure     CMAKE_POLICY_DEFAULT_CMP0060
:info:configure -- Build files have been written to: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_clang-11-bootstrap/clang-11-bootstrap/work/build
:info:configure Command failed: [...]
:info:configure Exit code: 1
:error:configure Failed to configure clang-11-bootstrap: consult /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_clang-11-bootstrap/clang-11-bootstrap/work/build/CMakeFiles/CMakeError.log
:error:configure Failed to configure clang-11-bootstrap: configure failure: command execution failed

Attachments (3)

main.log (105.2 KB) - added by Cebtenzzre 12 months ago.
main.2.log (90.5 KB) - added by Cebtenzzre 12 months ago.
main log from port configure clang-11-bootstrap
CMakeError.log (209.1 KB) - added by Cebtenzzre 12 months ago.
CMake error log from port configure clang-11-bootstrap

Download all attachments as: .zip

Change History (21)

comment:1 Changed 12 months ago by catap (Kirill A. Korinsky)

Cebtenzzre, I've supprised that it tries to use rpath.

May I ask you to share with me the whole cmake configuration output which includes its call by line like

clang-11-bootstrap/clang-11-bootstrap/work/build" && /opt/local/libexec/cmake-bootstrap/bin/cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/opt/loca...

comment:2 Changed 12 months ago by kencu (Ken)

clang-11-bootstrap will probably never build on Tiger.

It will take some serious effort to get it to do so, and nobody has done that as yet.

comment:3 Changed 12 months ago by kencu (Ken)

Even then, it is completely useless on Tiger PPC, and we are talking about a long shot at getting it build on Tiger Intel (which almost nobody cares about anyway, to be honest).

comment:4 Changed 12 months ago by kencu (Ken)

libcxx doesn't build on Tiger, and (I believe) no clang newer than clang-3.4 builds on Tiger either using MacPorts current Ports tree.

(Now -- it is possible to get farther. I have libcxx 5.0 built for Tiger, and clang-3.7, 3.8, 5.0, and 7.0 on my Tiger i386 system. But it took ungodly serious hacking to get it to build, and as it only worked on i386, and imperfectly there, and is useless for both building on PPC or building PPC software that might run on PPC, I never pushed it to MacPorts as there would just be 1,000 tickets about all the imperfections).

Changed 12 months ago by Cebtenzzre

Attachment: main.log added

comment:5 Changed 12 months ago by catap (Kirill A. Korinsky)

May I ask you to test https://github.com/catap/macports-ports/tree/clang-11-bootstrap ? It is a kind of blind shot.

comment:6 Changed 12 months ago by kencu (Ken)

If you would like to have a go at building clang-anything on Tiger i386, Tiger Server works in a VirtualBox VM with some small tweaks.

You really won't get anywhere with blind shots, although I appreciate your enthusiasm, you'll just drive the poor ticket reporter crazy.

comment:7 Changed 12 months ago by Cebtenzzre

That fix appears to have worked, now it successfully configures but fails to build. Should I open a new ticket?

:info:build /opt/local/var/macports/build/_Users_cebtenzzre_ports_lang_clang-11-bootstrap/clang-11-bootstrap/work/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp: In function 'void setThreadBackgroundPriority()':
:info:build /opt/local/var/macports/build/_Users_cebtenzzre_ports_lang_clang-11-bootstrap/clang-11-bootstrap/work/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:442:15: error: 'PRIO_DARWIN_THREAD' was not declared in this scope
:info:build   442 |   setpriority(PRIO_DARWIN_THREAD, 0, PRIO_DARWIN_BG);
:info:build       |               ^~~~~~~~~~~~~~~~~~
:info:build /opt/local/var/macports/build/_Users_cebtenzzre_ports_lang_clang-11-bootstrap/clang-11-bootstrap/work/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:442:38: error: 'PRIO_DARWIN_BG' was not declared in this scope
:info:build   442 |   setpriority(PRIO_DARWIN_THREAD, 0, PRIO_DARWIN_BG);
:info:build       |                                      ^~~~~~~~~~~~~~
:info:build /opt/local/var/macports/build/_Users_cebtenzzre_ports_lang_clang-11-bootstrap/clang-11-bootstrap/work/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp: In function 'bool hasThreadBackgroundPriority()':
:info:build /opt/local/var/macports/build/_Users_cebtenzzre_ports_lang_clang-11-bootstrap/clang-11-bootstrap/work/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:448:22: error: 'PRIO_DARWIN_THREAD' was not declared in this scope
:info:build   448 |   return getpriority(PRIO_DARWIN_THREAD, 0) == 1;
:info:build       |                      ^~~~~~~~~~~~~~~~~~
:info:build make[2]: *** [lib/Support/CMakeFiles/LLVMSupport.dir/CrashRecoveryContext.cpp.o] Error 1
:info:build make[2]: *** Waiting for unfinished jobs....

comment:8 Changed 12 months ago by catap (Kirill A. Korinsky)

I just pushed updated version of patch. I guess we may continue to use this ticket.

comment:9 Changed 12 months ago by Cebtenzzre

Now that issue is resolved, but there are more errors:

:info:build /opt/local/var/macports/build/_Users_cebtenzzre_ports_lang_clang-11-bootstrap/clang-11-bootstrap/work/llvm-project/llvm/projects/compiler-rt/lib/builtins/clear_cache.c:14:10: fatal error: libkern/OSCacheControl.h: No such file or directory
:info:build    14 | #include <libkern/OSCacheControl.h>
:info:build       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~
:info:build compilation terminated.
:info:build make[2]: *** [projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins_i386_osx.dir/clear_cache.c.o] Error 1
:info:build In file included from /opt/local/var/macports/build/_Users_cebtenzzre_ports_lang_clang-11-bootstrap/clang-11-bootstrap/work/llvm-project/llvm/lib/Support/Path.cpp:1151:
:info:build /opt/local/var/macports/build/_Users_cebtenzzre_ports_lang_clang-11-bootstrap/clang-11-bootstrap/work/llvm-project/llvm/lib/Support/Unix/Path.inc:40:10: fatal error: copyfile.h: No such file or directory
:info:build    40 | #include <copyfile.h>
:info:build       |          ^~~~~~~~~~~~
:info:build compilation terminated.

comment:10 Changed 12 months ago by catap (Kirill A. Korinsky)

Cebtenzzre, I've just pushed one more things that may help. I really haven't tested it, so, it may not work at all :)

comment:11 Changed 12 months ago by Cebtenzzre

Better, but there are still problems. I'm running into #67360 for all attempts to use gcc 10, plus these compiler errors (I ran make with --keep-going this time):

In file included from /opt/local/var/macports/build/_Users_cebtenzzre_ports_lang_clang-11-bootstrap/clang-11-bootstrap/work/llvm-project/llvm/lib/Support/Path.cpp:1151:
/opt/local/var/macports/build/_Users_cebtenzzre_ports_lang_clang-11-bootstrap/clang-11-bootstrap/work/llvm-project/llvm/lib/Support/Unix/Path.inc: In function 'std::string llvm::sys::fs::getMainExecutable(const char*, void*)':
/opt/local/var/macports/build/_Users_cebtenzzre_ports_lang_clang-11-bootstrap/clang-11-bootstrap/work/llvm-project/llvm/lib/Support/Unix/Path.inc:198:7: error: '_NSGetExecutablePath' was not declared in this scope
  198 |   if (_NSGetExecutablePath(exe_path, &size) == 0) {
      |       ^~~~~~~~~~~~~~~~~~~~
/opt/local/var/macports/build/_Users_cebtenzzre_ports_lang_clang-11-bootstrap/clang-11-bootstrap/work/llvm-project/llvm/lib/Support/Unix/Path.inc: In function 'std::error_code llvm::sys::fs::copy_file(const llvm::Twine&, const llvm::Twine&)':
/opt/local/var/macports/build/_Users_cebtenzzre_ports_lang_clang-11-bootstrap/clang-11-bootstrap/work/llvm-project/llvm/lib/Support/Unix/Path.inc:1292:19: error: 'COPYFILE_DATA' was not declared in this scope
 1292 |   uint32_t Flag = COPYFILE_DATA;
      |                   ^~~~~~~~~~~~~
/opt/local/var/macports/build/_Users_cebtenzzre_ports_lang_clang-11-bootstrap/clang-11-bootstrap/work/llvm-project/llvm/lib/Support/Unix/Path.inc:1305:7: error: 'copyfile' was not declared in this scope; did you mean 'copy_file'?
 1305 |       copyfile(From.str().c_str(), To.str().c_str(), /* State */ NULL, Flag);
      |       ^~~~~~~~
      |       copy_file
/opt/local/var/macports/build/_Users_cebtenzzre_ports_lang_clang-11-bootstrap/clang-11-bootstrap/work/llvm-project/llvm/lib/Support/RWMutex.cpp: In constructor 'llvm::sys::RWMutexImpl::RWMutexImpl()':
/opt/local/var/macports/build/_Users_cebtenzzre_ports_lang_clang-11-bootstrap/clang-11-bootstrap/work/llvm-project/llvm/lib/Support/RWMutex.cpp:112:40: error: expected type-specifier before 'MutexImpl'
  112 | RWMutexImpl::RWMutexImpl() : data_(new MutexImpl(false)) { }
      |                                        ^~~~~~~~~
/opt/local/var/macports/build/_Users_cebtenzzre_ports_lang_clang-11-bootstrap/clang-11-bootstrap/work/llvm-project/llvm/lib/Support/RWMutex.cpp: In destructor 'llvm::sys::RWMutexImpl::~RWMutexImpl()':
/opt/local/var/macports/build/_Users_cebtenzzre_ports_lang_clang-11-bootstrap/clang-11-bootstrap/work/llvm-project/llvm/lib/Support/RWMutex.cpp:115:22: error: 'MutexImpl' does not name a type; did you mean 'RWMutexImpl'?
  115 |   delete static_cast<MutexImpl *>(data_);
      |                      ^~~~~~~~~
      |                      RWMutexImpl
In file included from /opt/local/var/macports/build/_Users_cebtenzzre_ports_lang_clang-11-bootstrap/clang-11-bootstrap/work/llvm-project/llvm/lib/Support/ThreadLocal.cpp:42:
/opt/local/var/macports/build/_Users_cebtenzzre_ports_lang_clang-11-bootstrap/clang-11-bootstrap/work/llvm-project/llvm/lib/Support/Unix/ThreadLocal.inc: In member function 'void llvm::sys::ThreadLocalImpl::setInstance(const void*)':
/opt/local/var/macports/build/_Users_cebtenzzre_ports_lang_clang-11-bootstrap/clang-11-bootstrap/work/llvm-project/llvm/lib/Support/Unix/ThreadLocal.inc:66:57: error: incompatible types in assignment of 'void*' to 'char [8]'
   66 | void ThreadLocalImpl::setInstance(const void* d) { data = const_cast<void*>(d);}
      |                                                    ~~~~~^~~~~~~~~~~~~~~~~~~~~~

comment:12 Changed 12 months ago by catap (Kirill A. Korinsky)

I've pushed an updated version which addresses the issues in the first block.

The second part is puzzling me. From provided configure output:

729	:info:configure -- Looking for pthread_create in pthread
730	:info:configure -- Looking for pthread_create in pthread - not found
731	:info:configure -- Looking for pthread_create in c
732	:info:configure -- Looking for pthread_create in c - not found

I may conclude that pthread isn't available or available in some strange way because base on https://github.com/phracker/MacOSX-SDKs/blob/master/MacOSX10.4u.sdk/usr/include/pthread.h it should be good enough to run it.

As soon as that blocks in llvm/cmake/config-ix.cmake:85 decides that you have good enough pthread it should be fine. It runs check_library_exists(pthread pthread_create "" HAVE_LIBPTHREAD) and based on provided configure output it can't find anything inside library.

May I ask you to add into configure.args inside portfile --debug-output or --trace (will provides really a lot). It may explain this.

comment:13 Changed 12 months ago by Cebtenzzre

CMakeError.log shows why pthread_create was not found:

Determining if the function pthread_create exists in the pthread failed with the following output:
Change Dir: /opt/local/var/macports/build/_Users_cebtenzzre_ports_lang_clang-11-bootstrap/clang-11-bootstrap/work/build/CMakeFiles/CMakeTmp

Run Build Command:"make" "cmTC_3599f/fast"
make -f CMakeFiles/cmTC_3599f.dir/build.make CMakeFiles/cmTC_3599f.dir/build
Building C object CMakeFiles/cmTC_3599f.dir/CheckFunctionExists.c.o
/opt/local/libexec/gcc10-bootstrap/bin/gcc   -pipe -DNDEBUG -DCHECK_FUNCTION_EXISTS=pthread_create -arch i386 -mmacosx-version-min=10.4   -o CMakeFiles/cmTC_3599f.dir/CheckFunctionExists.c.o   -c /opt/local/libexec/cmake-bootstrap/share/cmake-3.9/Modules/CheckFunctionExists.c
Linking C executable cmTC_3599f
/opt/local/libexec/cmake-bootstrap/bin/cmake -E cmake_link_script CMakeFiles/cmTC_3599f.dir/link.txt --verbose=1
/opt/local/libexec/gcc10-bootstrap/bin/gcc -pipe -DNDEBUG -DCHECK_FUNCTION_EXISTS=pthread_create -arch i386 -mmacosx-version-min=10.4 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -static-libstdc++ -static-libgcc  CMakeFiles/cmTC_3599f.dir/CheckFunctionExists.c.o  -o cmTC_3599f -lpthread 
/usr/bin/ld: CMakeFiles/cmTC_3599f.dir/CheckFunctionExists.c.o has external relocation entries in non-writable section (__TEXT,__text) for symbols:
_pthread_create
collect2: error: ld returned 1 exit status

A quick google search tells me this could be due to missing -fPIC.

comment:14 Changed 12 months ago by catap (Kirill A. Korinsky)

Pushed an update which contains enforcing -fPIC, may I ask you to try it?

comment:15 Changed 12 months ago by Cebtenzzre

-fPIC is in the flags now, but the linker still fails:

/opt/local/libexec/gcc10-bootstrap/bin/gcc -pipe -fPIC -DNDEBUG -DCHECK_FUNCTION_EXISTS=pthread_create -arch i386 -mmacosx-version-min=10.4 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -static-libstdc++ -static-libgcc  CMakeFiles/cmTC_999e1.dir/CheckFunctionExists.c.o  -o cmTC_999e1 -lpthread 
/usr/bin/ld: CMakeFiles/cmTC_999e1.dir/CheckFunctionExists.c.o has external relocation entries in non-writable section (__TEXT,__text) for symbols:
_pthread_create
collect2: error: ld returned 1 exit status

And this is a build error I didn't notice before because I had my PATH set wrong:

/opt/local/var/macports/build/_Users_cebtenzzre_ports_lang_clang-11-bootstrap/clang-11-bootstrap/work/llvm-project/llvm/projects/compiler-rt/lib/builtins/i386/ashldi3.S:20:Unknown pseudo-op: .balign
/opt/local/var/macports/build/_Users_cebtenzzre_ports_lang_clang-11-bootstrap/clang-11-bootstrap/work/llvm-project/llvm/projects/compiler-rt/lib/builtins/i386/ashldi3.S:20:Rest of line ignored. 1st junk character valued 52 (4).
make[2]: *** [projects/compiler-rt/lib/builtins/CMakeFiles/clang_rt.builtins_i386_osx.dir/i386/ashldi3.S.o] Error 1

comment:16 Changed 12 months ago by catap (Kirill A. Korinsky)

Are you running it via port or by hand?

comment:17 Changed 12 months ago by Cebtenzzre

I've been testing the build via port, and then re-running make by hand with --keep-going in order to make sure I'm seeing all of the build errors. Let me know if you think there's a better way to do that, I'm not familiar with Portfile syntax. (edit: I figured out build.args, I'll use that from now on.)

Last edited 12 months ago by Cebtenzzre (previous) (diff)

comment:18 in reply to:  17 Changed 12 months ago by catap (Kirill A. Korinsky)

Replying to Cebtenzzre:

I've been testing the build via port, and then re-running make by hand with --keep-going in order to make sure I'm seeing all of the build errors. Let me know if you think there's a better way to do that, I'm not familiar with Portfile syntax.

This port file are quite sensetive for something wired in PATH like MacPorts' cctools :)

May I assume that you've picked the error from https://trac.macports.org/ticket/67348?replyto=17#comment:13 via port? May I ask you to run port clean clang-11-bootstrap and port configure clang-11-bootstrap and share with me port's log and cmake's error files.

Thanks.

Changed 12 months ago by Cebtenzzre

Attachment: main.2.log added

main log from port configure clang-11-bootstrap

Changed 12 months ago by Cebtenzzre

Attachment: CMakeError.log added

CMake error log from port configure clang-11-bootstrap

Note: See TracTickets for help on using tickets.