dslm4515 / cmlfs Goto Github PK
View Code? Open in Web Editor NEWClang-Built Musl Linux From Scratch
License: MIT License
Clang-Built Musl Linux From Scratch
License: MIT License
--
|
|
|
|
| <title>Dukungan Mozilla</title>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| <script type="text/javascript" src="https://static-media-prod-cdn.itsre-sumo.mozilla.net/static/build/gtm-snippet-min.98ca663fd559.js" charset="utf-8"></script>
|
|
|
|
| <body class="html-ltr logged-out responsive id"
| data-readonly="false"
| data-usernames-api="/id/users/api/usernames"
| data-static-url="https://static-media-prod-cdn.itsre-sumo.mozilla.net/static/"
| data-media-url="https://user-media-prod-cdn.itsre-sumo.mozilla.net/"
|
| >
|
|
|
|
| Popular Searches:
| Firefox Accounts
| VPN
| Tracking Protection
|
Pick your product
Mobile app that gives you access to passwords you've saved to Firefox.
Virtual 3D meeting spaces for collaborating with friends, family, and colleagues on your browser or VR headset
| Panel Opsi/Preferensi memberikan Anda akses ke pengaturan Firefox. Artikel berikut menjabarkan tipe pengaturan seperti apa saja yang tersedia pada tiap panel.
|
| Secara baku, Firefox akan diperbarui secara otomatis, namun bisa juga dilakukan secara manual. Pelajari cara melakukan pembaruan di Windows, Mac, atau Linux.
|
| Firefox akan memberi peringatan ketika Anda masuk secara tidak aman dan jika ada kemungkinan informasi Anda dapat dicuri.
|
| Jika situs web gagal membuat koneksi aman, Firefox tidak akan tersambung dan akan menampilkan pesan galat pada laman. Pelajari lebih lanjut.
|
Grow and share your expertise with others. Answer questions and improve our knowledge base.
| Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
|
| Portions of this content are ©1998–2021 by individual mozilla.org contributors. Content available under a Creative Commons license.
|
diff --git a/configure.ac b/configure.ac
index ad046bc2..32524e8a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -105,29 +105,6 @@ AC_CHECK_TOOL([NM], [nm])
# https://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html
# Arrays of Variable Length
# https://gcc.gnu.org/onlinedocs/gcc/Variable-Length.html
-AC_CACHE_CHECK([for gcc with GNU99 support], ac_cv_c99, [dnl
-old_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -std=gnu99"
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([dnl
-int foo (int a)
-{
- for (int i = 0; i < a; ++i) if (i % 4) break; int s = a; return s;
-}
-
-double bar (double a, double b)
-{
- double square (double z) { return z * z; }
- return square (a) + square (b);
-}
-
-void baz (int n)
-{
- struct S { int x[[n]]; };
-}])],
- ac_cv_c99=yes, ac_cv_c99=no)
-CFLAGS="$old_CFLAGS"])
-AS_IF([test "x$ac_cv_c99" != xyes],
- AC_MSG_ERROR([gcc with GNU99 support required]))
AC_CACHE_CHECK([whether gcc supports __attribute__((visibility()))],
ac_cv_visibility, [dnl
diff --git a/src/elfcompress.c b/src/elfcompress.c
index c5ba6c34..96518a32 100644
--- a/src/elfcompress.c
+++ b/src/elfcompress.c
@@ -37,6 +37,10 @@
#include "libeu.h"
#include "printversion.h"
+#ifndef FNM_EXTMATCH
+# define FNM_EXTMATCH (1 << 5) /* Use ksh-like extended matching. */
+#endif
+
/* Name and version of program. */
ARGP_PROGRAM_VERSION_HOOK_DEF = print_version;
diff --git a/src/readelf.c b/src/readelf.c
index b9740455..26aac82f 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -8763,12 +8763,12 @@ print_debug_line_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr,
/* Apply the "operation advance" from a special opcode
or DW_LNS_advance_pc (as per DWARF4 6.2.5.1). */
unsigned int op_addr_advance;
- inline void advance_pc (unsigned int op_advance)
- {
- op_addr_advance = minimum_instr_len * ((op_index + op_advance)
- / max_ops_per_instr);
- address += op_addr_advance;
- op_index = (op_index + op_advance) % max_ops_per_instr;
+#define advance_pc(op_advance) \
+ {\
+ op_addr_advance = minimum_instr_len * ((op_index + op_advance)\
+ / max_ops_per_instr);\
+ address += op_addr_advance;\
+ op_index = (op_index + op_advance) % max_ops_per_instr;\
}
if (max_ops_per_instr == 0)
diff --git a/src/strip.c b/src/strip.c
index 7a5d4e4c..f10775d0 100644
--- a/src/strip.c
+++ b/src/strip.c
@@ -46,6 +46,10 @@
#include <system.h>
#include <printversion.h>
+#ifndef FNM_EXTMATCH
+# define FNM_EXTMATCH (1 << 5) /* Use ksh-like extended matching. */
+#endif
+
typedef uint8_t GElf_Byte;
/* Name and version of program. */
Apply above patch before autoreconf
step, then the magic appears.
Building GCC with /cross-tools
ends prematurely with build unable to find zlib:
/cross-tools/lib/gcc/x86_64-mlfs-linux-musl/10.2.1/../../../../x86_64-mlfs-linux-musl/bin/ld: warning: libc.musl-x86_64.so.1, needed by /opt/gnu/lib/libmpc.so, not found (try using -rpath or -rpath-link)
x86_64-mlfs-linux-musl-g++ -no-pie -g -O2 -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -static-libstdc++ -static-libgcc gcov.o json.o \
hash-table.o ggc-none.o libcommon.a ../libcpp/libcpp.a ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -lz -o gcov
/cross-tools/lib/gcc/x86_64-mlfs-linux-musl/10.2.1/../../../../x86_64-mlfs-linux-musl/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:3014: gcov] Error 1
make[2]: Leaving directory '/sources/gcc-10.2.1_pre2/build/gcc'
make[1]: *** [Makefile:4400: all-gcc] Error 2
make[1]: Leaving directory '/sources/gcc-10.2.1_pre2/build'
make: *** [Makefile:963: all] Error 2
Hello there!
First of all, thank You for great tutorial.
Please, look over - https://github.com/dslm4515/CMLFS/blob/master/0-Preparation
Line 98 and 109; seems there misprint occur - TRUPLE phrase, may be TRIPLE?
Please, fix! Thanks!
1-cgnutools/6a-libexecinfo
Please look over line 10-11 - there defined compiler, correct?
But cc != CC for Linux, so command may be mis-interpreted.
Please, check and fix as well. Thanks!
Every other instruction before this command runs without any errors.
$ cmake -B build -DCMAKE_EXE_LINKER_FLAGS="${LINKERFLAGS}" -DCMAKE_SHARED_LINKER_FLAGS="${LINKERFLAGS}" ${CONFIG_TOOLS} ${CONFIG_TRUPLES} ${CONFIG_CRT} ${CONFIG_CLANG} ${CONFIG_OPTIONS} ${CONFIG_LIBUNWIND} ${CONFIG_LIBCXXABI} ${CONFIG_LIBCXX} ${CONFIG_PATHS} ${BUILD_OFF}
CMake Warning at cmake/modules/HandleLLVMStdlib.cmake:28 (message):
Can't specify libc++ with '-stdlib='
Call Stack (most recent call first):
cmake/config-ix.cmake:15 (include)
CMakeLists.txt:684 (include)
-- Native target architecture is X86
-- Threads enabled.
-- Doxygen disabled.
-- Go bindings enabled.
-- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH)
-- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH)
-- OCaml bindings disabled.
-- LLVM host triple: x86_64-pc-linux-musl
-- LLVM default target triple: x86_64-pc-linux-musl
-- Building with -fPIC
-- Targeting X86
-- Could not find ParallelSTL, libc++abi will not attempt to use it but the build may fail if the libc++ in use needs it to be available.
-- Looking for cxxabi.h in /mnt/cmlfs/sources/llvm/projects/libcxx/../libcxxabi/include
-- Looking for cxxabi.h in /mnt/cmlfs/sources/llvm/projects/libcxx/../libcxxabi/include - found
-- Looking for __cxxabi_config.h in /mnt/cmlfs/sources/llvm/projects/libcxx/../libcxxabi/include
-- Looking for __cxxabi_config.h in /mnt/cmlfs/sources/llvm/projects/libcxx/../libcxxabi/include - found
-- Compiler-RT supported architectures: x86_64
-- Builtin supported architectures: x86_64
-- For x86_64 builtins preferring i386/fp_mode.c to fp_mode.c
-- For x86_64 builtins preferring x86_64/floatdidf.c to floatdidf.c
-- For x86_64 builtins preferring x86_64/floatdisf.c to floatdisf.c
-- For x86_64 builtins preferring x86_64/floatundidf.S to floatundidf.c
-- For x86_64 builtins preferring x86_64/floatundisf.S to floatundisf.c
-- For x86_64 builtins preferring x86_64/floatdixf.c to floatdixf.c
-- For x86_64 builtins preferring x86_64/floatundixf.S to floatundixf.c
CMake Error at projects/compiler-rt/cmake/Modules/AddCompilerRT.cmake:259 (message):
Cannot find builtins library for the target architecture
Call Stack (most recent call first):
projects/compiler-rt/lib/orc/CMakeLists.txt:93 (add_compiler_rt_runtime)
As i've seen, this isn't licensed formally yet, so i was going to suggest that we use something like the z-lib license for plain-text documentation.
I think that a more copycenter license would help when linking/using content from here in something licensed under a liberal license, like a Wiki licensed under CC-BY, for example.
Sorry for any broken english, i'm still praticing it.
On a musl host, LLVM fails to build due to liker not able to find -lcurses
:
[ 5%] Built target LLVMTableGenGlobalISel
make[2]: Entering directory '/mnt/cmlto/sources/llvm/build'
make[2]: Leaving directory '/mnt/cmlto/sources/llvm/build'
make[2]: Entering directory '/mnt/cmlto/sources/llvm/build'
[ 5%] Linking CXX executable ../../bin/llvm-tblgen
/mnt/cmlto/cgnutools/bin/../lib/gcc/x86_64-cmlfs-linux-musl/10.3.1/../../../../x86_64-cmlfs-linux-musl/bin/ld: error: cannot find -lcurses
/mnt/cmlto/sources/llvm/lib/Support/Unix/Process.inc:336: error: undefined reference to 'setupterm'
/mnt/cmlto/sources/llvm/lib/Support/Unix/Process.inc:354: error: undefined reference to 'tigetnum'
/mnt/cmlto/sources/llvm/lib/Support/Unix/Process.inc:358: error: undefined reference to 'set_curterm'
/mnt/cmlto/sources/llvm/lib/Support/Unix/Process.inc:359: error: undefined reference to 'del_curterm'
collect2: error: ld returned 1 exit status
make[2]: *** [utils/TableGen/CMakeFiles/llvm-tblgen.dir/build.make:192: bin/llvm-tblgen] Error 1
make[2]: Leaving directory '/mnt/cmlto/sources/llvm/build'
make[1]: *** [CMakeFiles/Makefile2:6927: utils/TableGen/CMakeFiles/llvm-tblgen.dir/all] Error 2
make[1]: Leaving directory '/mnt/cmlto/sources/llvm/build'
make: *** [Makefile:156: all] Error 2
make: Leaving directory '/mnt/cmlto/sources/llvm/build'
Same issue on hosts running MLFS 9.0.0 and CMLFS 2.0.0 (with LTO)
First attempt was building cgnutools with LTO. Same error for LLVM. Then I tried again with out LTO: same error.
In section 2-llvmtools/07-clang-llvm
(Line 136-138)
Remove the LLVM source as it will not be needed until chroot
cd $CMLFS/source &&
rm -rf llvm
Actual: seems symbol "s" missed,
Expected: Initially at preparation stage it was "sourceS' folder name
I've read this some time ago, and i thought it would be cool to share this article with you guys.
Here Agostino tests and benchmarks if using -j $(( n + 1 ))
is any better than just using -j $n
, and the conclusion is that its not.
https://blogs.gentoo.org/ago/2013/01/14/makeopts-jcore-1-is-not-the-best-optimization/
Here is my config.log
that the make program told me to take a look at details.
http://0x0.st/oTbw.log
checking for x86_64-meth-linux-musl-gcc... /mnt/cmlfs/sources/pkgs/gcc-10.3.1_git20210424/build/./gcc/xgcc -B/mnt/cmlfs/sources/pkgs/gcc-10.3.1_git20210424/build/./gcc/ -B/cgnutools/x86_64-meth-linux-musl/bin/ -B/cgnutools/x86_64-meth-linux-musl/lib/ -isystem /cgnutools/x86_64-meth-linux-musl/include -isystem /cgnutools/x86_64-meth-linux-musl/sys-include
checking for suffix of object files... configure: error: in `/mnt/cmlfs/sources/pkgs/gcc-10.3.1_git20210424/build/x86_64-meth-linux-musl/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details
make: *** [Makefile:12848: configure-target-libgcc] Error 1
This part causes the problem.
is this issue related to build llvm in llvmtools?
For LLVM 12, I just fine while building. See #12 (comment)
Now moving to chroot steps. I'll report if an issue appeared.
Originally posted by @owl4ce in #14 (comment)
So I switched back to building CMLFS with LLVM12. Still not successful. I accidentally used ninja instead of make:
[1619/3634] Building CXX object projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_linux.cpp.o
FAILED: projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_linux.cpp.o
/cgnutools/bin/x86_64-cmlfs-linux-musl-clang++ -DHAVE_RPC_XDR_H=0 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iprojects/compiler-rt/lib/sanitizer_common -I../projects/compiler-rt/lib/sanitizer_common -Iinclude -I../include -I../projects/compiler-rt/lib/sanitizer_common/.. -g -g1 -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -std=c++14 -Wno-unused-parameter -O3 -DNDEBUG -m64 -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -fno-lto -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -nostdinc++ -fno-rtti -Wframe-larger-than=570 -Wglobal-constructors -std=c++14 -MD -MT projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_linux.cpp.o -MF projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_linux.cpp.o.d -o projects/compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.x86_64.dir/sanitizer_linux.cpp.o -c ../projects/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
../projects/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:30:10: fatal error: 'asm/param.h' file not found
#include <asm/param.h>
^~~~~~~~~~~~~
1 error generated.
[1620/3634] Building CXX object utils/yaml-bench/CMakeFiles/yaml-bench.dir/YAMLBench.cpp.o
ninja: build stopped: subcommand failed.
Just like LFS 10+, build a very minimal llvmtools with cgnutools and build the rest of llvmtools under chroot.
Hopefully, this will drop the need for perl-cross, as it seems perl > 5.32.1 will not cross compile
There a little mess.
...
[ 28%] Building C object Source/kwsys/CMakeFiles/cmsysTestSharedForward.dir/testSharedForward.c.o
[ 28%] Building C object Source/kwsys/CMakeFiles/cmsysTestsC.dir/testEncode.c.o
[ 28%] Building C object Source/kwsys/CMakeFiles/cmsysTestsC.dir/cmsysTestsC.c.o
[ 29%] Building C object Utilities/cmlibarchive/libarchive/CMakeFiles/cmlibarchive.dir/archive_acl.c.o
[ 29%] Building C object Utilities/cmlibarchive/libarchive/CMakeFiles/cmlibarchive.dir/archive_check_magic.c.o
In file included from /mnt/cmlfs/sources/pkgs/cmake-3.20.5/Utilities/cmlibarchive/libarchive/archive_acl.c:37:
/usr/include/wchar.h:600:9: error: unknown type name '__gnuc_va_list'
__gnuc_va_list __arg)
^
/usr/include/wchar.h:607:8: error: unknown type name '__gnuc_va_list'
__gnuc_va_list __arg)
^
/usr/include/wchar.h:613:9: error: unknown type name '__gnuc_va_list'
__gnuc_va_list __arg)
^
/usr/include/wchar.h:675:8: error: unknown type name '__gnuc_va_list'
__gnuc_va_list __arg)
^
/usr/include/wchar.h:682:7: error: unknown type name '__gnuc_va_list'
__gnuc_va_list __arg)
^
/usr/include/wchar.h:687:8: error: unknown type name '__gnuc_va_list'
__gnuc_va_list __arg)
^
/usr/include/wchar.h:698:7: error: unknown type name '__gnuc_va_list'
__gnuc_va_list __arg), __isoc99_vfwscanf)
^
/usr/include/wchar.h:701:6: error: unknown type name '__gnuc_va_list'
__gnuc_va_list __arg), __isoc99_vwscanf)
^
/usr/include/wchar.h:705:11: error: unknown type name '__gnuc_va_list'
__gnuc_va_list __arg), __isoc99_vswscanf)
^
... so many errors here ...
I don't know how to override headers PATH to /llvmtools/include
, when I try to configure with CFLAGS="-I/llvmtools/include" CXXFLAGS="-I/llvmtools/include" ./bootstrap
still fails to build.
I have found the reason why utmps
fails to build using Clang 12 from /llvmtools/bin
. Since I am trying to build the end system without gcc or binutils, this was a pretty big issue for me.
After some short investigation, I found that somehow the static binaries generated by utmps
were claiming to have an interpreter:
# file utmps-utmpd
utmps-utmpd: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, interpreter /lib/ld-musl-x86_64.so.1, not stripped
And when debugging with lldb
:
* thread #1, name = 'utmps-utmpd', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
frame #0: 0x00007ffff7fbe950 libc.so`decode_vec(v=0x0000000000000000, a=0x00007fffffffe118, cnt=32) at dynlink.c:198:10
But ldd
correctly recognizes the binaries:
$ ldd utmps-utmpd
ldd: utmps-utmpd: Not a valid dynamic program
I found it extremely strange why a statically linked binary would have an interpreter listed by file, and why lldb
showed the source of the Segmentation Fault was from within libc.so
. So I did a bit more digging.
With CC=x86_64-cmlfs-linux-musl-clang
, Clang seems to always pass -dynamic-linker
, even for -static
(for brevity the linked objects are replaced with ...):
"/llvmtools/bin/ld.lld" --sysroot=/usr --eh-frame-hdr -m elf_x86_64 -static -o utmps-utmpd /usr/lib/crt1.o /usr/lib/crti.o /llvmtools/lib/clang/12.0.0/lib/linux/clang_rt.crtbegin-x86_64.o -L/usr/lib -dynamic-linker /lib/ld-musl-x86_64.so.1 ... -lskarnet --verbose --start-group /llvmtools/lib/clang/12.0.0/lib/linux/libclang_rt.builtins-x86_64.a -l:libunwind.a -lc --end-group /llvmtools/lib/clang/12.0.0/lib/linux/clang_rt.crtend-x86_64.o /usr/lib/crtn.o
With CC=clang
, the -dynamic-linker
flag is no longer present, however some of the paths are broken, and I must manually pass -L/usr/lib
:
"/llvmtools/bin/ld.lld" --sysroot=/llvmtools --eh-frame-hdr -m elf_x86_64 -static -o utmps-utmpd /llvmtools/bin/../lib/crt1.o /llvmtools/bin/../lib/crti.o /llvmtools/lib/clang/12.0.0/lib/linux/clang_rt.crtbegin-x86_64.o -L/usr/lib -L/llvmtools/bin/../lib -L/llvmtools/lib ... -lskarnet --verbose --start-group /llvmtools/lib/clang/12.0.0/lib/linux/libclang_rt.builtins-x86_64.a -l:libunwind.a -lc --end-group /llvmtools/lib/clang/12.0.0/lib/linux/clang_rt.crtend-x86_64.o /llvmtools/bin/../lib/crtn.o
Here's how those are symlinked:
# ls -lah `which x86_64-cmlfs-linux-musl-clang`
lrwxrwxrwx 1 root root 8 Jun 29 07:23 /llvmtools/bin/x86_64-cmlfs-linux-musl-clang -> clang-12
# ls -lah `which clang`
lrwxrwxrwx 1 root root 8 Jun 29 03:44 /llvmtools/bin/clang -> clang-12
Moreover, when building with CC=clang
, the build not only succeeds, utmps-utmpd
runs without issue:
# ./utmps-utmpd
utmps-utmpd: fatal: unable to get $IPCREMOTEEUID from environment
This seems to suggest to me that the out of tree cross compilation of LLVM for /llvmtools
is somehow broken.
The host system is musl Void Linux running under WSL 2 on x86_64. The target system is also x86_64.
LLVM of cgnutools still looks for headers for libexecinfo:
[ 15%] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/Signals.cpp.o
In file included from /mnt/cmlfs/sources/llvm/lib/Support/Unix/Unix.h:21,
from /mnt/cmlfs/sources/llvm/lib/Support/Unix/Signals.inc:35,
from /mnt/cmlfs/sources/llvm/lib/Support/Signals.cpp:225:
/mnt/cmlfs/sources/llvm/build/include/llvm/Config/config.h:25:26: fatal error: execinfo.h: No such
file or directory
25 | #define BACKTRACE_HEADER <execinfo.h>
| ^
compilation terminated.
make[2]: *** [lib/Support/CMakeFiles/LLVMSupport.dir/build.make:1882: lib/Support/CMakeFiles/LLVMSu
pport.dir/Signals.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/mnt/cmlfs/sources/llvm/build'
make[1]: *** [CMakeFiles/Makefile2:6560: lib/Support/CMakeFiles/LLVMSupport.dir/all] Error 2
make[1]: Leaving directory '/mnt/cmlfs/sources/llvm/build'
make: *** [Makefile:156: all] Error 2
make: Leaving directory '/mnt/cmlfs/sources/llvm/build'
even though i have it turned off:
export BUILD_OFF+="-DLLVM_ENABLE_BACKTRACES=OFF "
Tablegen fails to compile:
FAILED: utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeGenSchedule.cpp.o
/cgnutools/bin/x86_64-cmlfs-linux-musl-g++ -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/mnt/cmlfs/sources/llvm-project-15.0.5.src/build/utils/TableGen -I/mnt/cmlfs/sources/llvm-project-15.0.5.src/llvm/utils/TableGen -I/mnt/cmlfs/sources/llvm-project-15.0.5.src/build/include -I/mnt/cmlfs/sources/llvm-project-15.0.5.src/llvm/include -nostdinc++ -nodefaultlibs -isystem /cgnutools/include/c++/v1 -L/cgnutools/lib -Wl,-rpath,/cgnutools/lib -lc++ -lc++abi -lm -lc -lgcc_s -lgcc -g -g1 -Wl,--as-needed -lexecinfo -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wmisleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -std=c++14 -MD -MT utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeGenSchedule.cpp.o -MF utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeGenSchedule.cpp.o.d -o utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeGenSchedule.cpp.o -c /mnt/cmlfs/sources/llvm-project-15.0.5.src/llvm/utils/TableGen/CodeGenSchedule.cpp
In file included from /cgnutools/include/c++/v1/__functional/invoke.h:17,
from /cgnutools/include/c++/v1/type_traits:421,
from /cgnutools/include/c++/v1/limits:107,
from /cgnutools/include/c++/v1/math.h:309,
from /cgnutools/include/c++/v1/cmath:309,
from /mnt/cmlfs/sources/llvm-project-15.0.5.src/llvm/include/llvm/Support/MathExtras.h:19,
from /mnt/cmlfs/sources/llvm-project-15.0.5.src/llvm/include/llvm/ADT/APInt.h:19,
from /mnt/cmlfs/sources/llvm-project-15.0.5.src/llvm/utils/TableGen/CodeGenSchedule.h:17,
from /mnt/cmlfs/sources/llvm-project-15.0.5.src/llvm/utils/TableGen/CodeGenSchedule.cpp:14:
/cgnutools/include/c++/v1/__type_traits/decay.h: In instantiation of 'struct std::__1::__decay<const llvm::APInt&, true>':
/cgnutools/include/c++/v1/__type_traits/decay.h:56:89: required from 'struct std::__1::decay<const llvm::APInt&&>'
/cgnutools/include/c++/v1/__utility/pair.h:132:16: required by substitution of 'template<class _Tuple, typename std::__1::enable_if<typename std::__1::conditional<(std::__1::__tuple_like_with_size<_Tuple, 2, typename std::__1::remove_cv<typename std::__1::remove_reference<_Tp>::type>::type>::value && (! std::__1::is_same<typename std::__1::decay<_Tp>::type, std::__1::pair<const llvm::Record*, llvm::OpcodeInfo> >::value)), std::__1::pair<const llvm::Record*, llvm::OpcodeInfo>::_CheckTupleLikeConstructor, std::__1::__check_tuple_constructor_fail>::type::__enable_implicit<_Tuple>(), void>::type* <anonymous> > constexpr std::__1::pair<const llvm::Record*, llvm::OpcodeInfo>::pair(_Tuple&&) [with _Tuple = const llvm::APInt&&; typename std::__1::enable_if<typename std::__1::conditional<(std::__1::__tuple_like_with_size<_Tuple, 2, typename std::__1::remove_cv<typename std::__1::remove_reference<_Tp>::type>::type>::value && (! std::__1::is_same<typename std::__1::decay<_Tp>::type, std::__1::pair<const llvm::Record*, llvm::OpcodeInfo> >::value)), std::__1::pair<const llvm::Record*, llvm::OpcodeInfo>::_CheckTupleLikeConstructor, std::__1::__check_tuple_constructor_fail>::type::__enable_implicit<_Tuple>(), void>::type* <anonymous> = <missing>]'
/mnt/cmlfs/sources/llvm-project-15.0.5.src/llvm/utils/TableGen/CodeGenSchedule.cpp:372:69: required from here
/cgnutools/include/c++/v1/__type_traits/decay.h:47:30: error: forming pointer to reference type 'std::__1::remove_extent<const llvm::APInt&>::type' {aka 'const llvm::APInt&'}
47 | >::type type;
| ^~~~
ninja: build stopped: subcommand failed.
This will cause lld
, 'clang', and `libclang' to fail to compile (dependency)
Section 2-llvmtools/10-libstdcxx
In Line 16 -->
export CARGS+="--with-gxx-include-dir=/llvmtools/include/c++/11.2.0"
Need break-space after 0 before closing " otherwise next CARGS will concatenate and configure fail
That's may be the stupidiest bug, but who cares. When I try to make kernel headers via executing
ARCH=${CMLFS_ARCH} LLVM=1 CC=clang CXX=clang++ make headers
this command fails with following error:
HOSTCC scripts/basic/fixdep
/bin/sh: line 1: scripts/basic/fixdep: No such file or directory
make[1]: *** [scripts/Makefile.host:95: scripts/basic/fixdep] Error 127
make[1]: *** Deleting file 'scripts/basic/fixdep'
make: *** [Makefile:536: scripts_basic] Error 2
This error doesn't appear in MLFS environment that's why I suggested to make minimal MLFS environment and then build CMLFS entirely.
How this bug could be fixed without creating of MLFS?
Let's put in this issue that bugs like misplacing in configure scripts, misplacing of files, patches, etc. In general, everything of that should be fixed by maintainer not in first turn and you can fix it temporarly by yourselves. But in the end it must be fixed.
I was compiling llvm and then i got this error:
Full text log: https://termbin.com/eibv
As you can see, it's trying to "call"/link to libc.so.6
from the host system, not the toolchain one.
So, just to be sure, i ran ldd
both from the toolchain and from the host just to see where exactly libterminfo.so was trying to link:
And yes; apparently, when i built netbsd-curses, it was linked to the wrong libc.
I'm not sure if i will fix this right now -- it's late and i have to study and work tomorrow -- , so take this as a reminder and as an advice.
Tried emailing you but your account doesn't have obvious email address and user@github bounced because of "organizational settings"?
I cloned your "build llvm with musl" repo, but after reading the README I'm not entirely sure how to run the build? It seems to want me to download another one of your projects and... create a chroot to run it in maybe?
I have my own build script that was building a musl-based llvm Hexagon cross compiler (based off the build plumbing the Hexagon guys checked into the kvm test suite: their test involved building a compiler to build their vm image), but when I tried to run it again llvm died trying to link the rtsanitizer code to libc, which obviously didn't exist yet because you need a compiler to build the C library with. (There was also some discussion on the toybox mailing list about this in... July of last year, I think? I can dig up a link if you're curious.)
How do I build your toolchain project, and have you checked for regressions recently?
Rob
Stage 3-chroot/013a-zlib-ng: seems mises "/" symbol
When building mesa, build fails due to missing llvm-c headers:
In file included from ../src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c:44:
../src/amd/llvm/ac_llvm_util.h:31:10: fatal error: 'llvm-c/TargetMachine.h' file not found
#include <llvm-c/TargetMachine.h>
^~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
If I check that directory on the system:
/usr/include/llvm-c
├── Remarks.h
└── lto.h
... and compare it to the LLVM built in MLFS:
usr/
└── include
└── llvm-c
├── Analysis.h
├── BitReader.h
├── BitWriter.h
├── Comdat.h
├── Core.h
├── DataTypes.h
├── DebugInfo.h
├── Disassembler.h
├── DisassemblerTypes.h
├── Error.h
├── ErrorHandling.h
├── ExecutionEngine.h
├── ExternC.h
├── IRReader.h
├── Initialization.h
├── LinkTimeOptimizer.h
├── Linker.h
├── Object.h
├── Orc.h
├── OrcBindings.h
├── Remarks.h
├── Support.h
├── Target.h
├── TargetMachine.h
├── Transforms
│ ├── AggressiveInstCombine.h
│ ├── Coroutines.h
│ ├── IPO.h
│ ├── InstCombine.h
│ ├── PassManagerBuilder.h
│ ├── Scalar.h
│ ├── Utils.h
│ └── Vectorize.h
├── Types.h
└── lto.h
Looks like when the system LLVM was built, some headers were not copied/generated. I will compare builds between CMLFS and BMLFS, as both should be identical (assuming both were compiled by the same patches and source)
This is the command line i used to configure cmake.
In fact, it's the same from the documentation.
LDFLAGS="-Wl,-rpath,/cgnutools/lib" CFLAGS= -g -g1 CXXFLAGS=$CFLAGS CONFIG_TOOLS="-DCMAKE_C_COMPILER=${COPA_TARGET}-gcc " CONFIG_TOOLS+="-DCMAKE_CXX_COMPILER=${COPA_TARGET}-g++ " CONFIG_TOOLS+="-DCMAKE_EXE_LINKER_FLAGS=-Wl,-dynamic-linker /cgnutools/lib/ld-musl-x86_64.so.1 " CONFIG_TOOLS+="-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-dynamic-linker /cgnutools/lib/ld-musl-x86_64.so.1 " CONFIG_TOOLS+="-DCLANG_DEFAULT_LINKER=/cgnutools/bin/ld.lld " CONFIG_TRUPLES="-DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-pc-linux-musl " CONFIG_TRUPLES+="-DLLVM_HOST_TRIPLE=x86_64-pc-linux-musl " CONFIG_TRUPLES+="-DCOMPILER_RT_DEFAULT_TARGET_TRIPLE=x86_64-pc-linux-musl " CONFIG_CRT="-DCOMPILER_RT_USE_BUILTINS_LIBRARY=ON " CONFIG_CRT+="-DCOMPILER_RT_BUILD_SANITIZERS=OFF" CONFIG_CRT+="-DCOMPILER_RT_BUILD_XRAY=OFF " CONFIG_CRT+="-DCOMPILER_RT_BUILD_PROFILE=OFF " CONFIG_CRT+="-DCOMPILER_RT_BUILD_LIBFUZZER=OFF " CONFIG_CRT+="-DCOMPILER_RT_CAN_EXECUTE_TESTS=OFF " CONFIG_CRT+="-DCOMPILER_RT_HWASAN_WITH_INTERCEPTORS=OFF " CONFIG_CLANG="-DCLANG_DEFAULT_CXX_STDLIB=libc++ " CONFIG_CLANG+="-DCLANG_DEFAULT_UNWINDLIB=libunwind " CONFIG_CLANG+="-DCLANG_DEFAULT_RTLIB=compiler-rt " CONFIG_CLANG+="-DCLANG_ENABLE_STATIC_ANALYZER=OFF " CONFIG_CLANG+="-DCLANG_ENABLE_ARCMT=OFF " CONFIG_LIBUNWIND="-DLIBUNWIND_ENABLE_STATIC=OFF " CONFIG_LIBCXXABI="-DLIBCXXABI_ENABLE_STATIC=OFF " CONFIG_LIBCXX="-DLIBCXX_ENABLE_STATIC=OFF " CONFIG_PATHS="-DICONV_LIBRARY_PATH=/cgnutools/lib/libc.so " BUILD_OFF="-DLLVM_BUILD_TESTS=OFF " BUILD_OFF+="-DLLVM_INCLUDE_GO_TESTS=OFF " BUILD_OFF+="-DLLVM_INCLUDE_TESTS=OFF " BUILD_OFF+="-DLLVM_INCLUDE_DOCS=OFF " BUILD_OFF+="-DLLVM_INCLUDE_EXAMPLES=OFF " BUILD_OFF+="-DLLVM_INCLUDE_BENCHMARKS=OFF " BUILD_OFF+="-DLLVM_ENABLE_OCAMLDOC=OFF " BUILD_OFF+="-DLLVM_ENABLE_BACKTRACES=OFF " BUILD_OFF+="-DLLVM_ENABLE_LIBEDIT=OFF " BUILD_OFF+="-DLLVM_ENABLE_LIBXML2=OFF " BUILD_OFF+="-DLLVM_ENABLE_LIBPFM=OFF " BUILD_OFF+="-DLLVM_ENABLE_TERMINFO=OFF " BUILD_OFF+="-DLLVM_ENABLE_ZLIB=OFF " BUILD_OFF+="-DLLVM_ENABLE_Z3_SOLVER=OFF " BUILD_OFF+="-DLLVM_APPEND_VC_REV=OFF " BUILD_OFF+="-DLLVM_ENABLE_CRASH_OVERRIDES=OFF " BUILD_OFF+="-DLIBCXX_INCLUDE_BENCHMARKS=OFF " BUILD_OFF+="-DLIBCXX_ENABLE_DEBUG_MODE_SUPPORT=OFF " cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/cgnutools" -DBUILD_SHARED_LIBS=ON -DLLVM_ENABLE_LIBCXX=ON -DLLVM_TARGET_ARCH="X86" -DLLVM_TARGETS_TO_BUILD="X86" -DLIBCXX_HAS_MUSL_LIBC=ON -DDEFAULT_SYSROOT="/cgnutools" ${CONFIG_TOOLS} ${CONFIG_TRUPLES} ${CONFIG_CRT} ${CONFIG_CLANG} ${CONFIG_LIBUNWIND} ${CONFIG_LIBCXXABI} ${CONFIG_LIBCXX} ${CONFIG_PATHS} ${BUILD_OFF} && make -C build
My .bashrc:
# Directories
COPA='/dsk/0v'
GNUC_TOOLS='/cgnutools'
LLVM_TOOLS='/llvmtools'
LFS="${COPA}"
LLVM_SRC=/usr/tmp/llvm
# PATH
PATH="${GNUC_TOOLS}/bin:${LLVM_TOOLS}/bin:/bin:/usr/bin"
# Target
COPA_TARGET="`uname -m`-pindoramaCOPACABANA-linux-musl"
CMLFS_TARGET="${COPA_TARGET}"
TARGET_TRUPLE="x86_64-pc-linux-musl"
# Host
COPA_HOST="$(echo ${MACHTYPE} | sed "s/$(echo $MACHTYPE | cut -d- -f2)/crossCOPACABANA/")"
CMLFS_HOST="${COPA_HOST}"
# CPU information
ARCH='x86'
CPU='x86-64'
# C COMPILER
CC="${COPA_TARGET}-gcc"
CXX="${COPA_TARGET}-g++"
AR="${COPA_TARGET}-ar"
AS="${COPA_TARGET}-as"
RANLIB="${COPA_TARGET}-ranlib"
LD="${COPA_TARGET}-ld"
STRIP="${COPA_TARGET}-strip"
export COPA GNUC_TOOLS LLVM_TOOLS LFS CMLFS PATH COPA_TARGET LFS_TARGET CMLFS_TARGET TARGET_TRUPLE COPA_HOST LFS_HOST ARCH CPU
# Export C COMPILER
export CC CXX AR AS RANLIB LD STRIP
Perl wil not cross compile after copying perl-cross over it:
make[1]: Leaving directory '/mnt/cmlfs/sources/perl-5.36.0'
make dynaloader
make[1]: Entering directory '/mnt/cmlfs/sources/perl-5.36.0'
sh cflags.SH
cflags.SH: Adding -Werror=pointer-arith.
cflags.SH: Adding -Werror=vla.
cflags.SH: Adding -Wextra.
cflags.SH: Adding -Wno-long-long.
cflags.SH: Adding -Wno-declaration-after-statement.
cflags.SH: Adding -Wc++-compat.
cflags.SH: Adding -Wwrite-strings.
cflags.SH: cc = x86_64-pc-linux-musl-clang
cflags.SH: ccflags = -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
cflags.SH: stdflags =
cflags.SH: optimize =
cflags.SH: warn = -Wall -Werror=pointer-arith -Werror=vla -Wextra -Wno-long-long -Wno-declaration-after-statement -Wc++-compat -Wwrite-strings
Extracting cflags (with variable substitutions)
./miniperl_top make_patchnum.pl
make[1]: *** [Makefile:204: lib/Config_git.pl] Segmentation fault
make[1]: Leaving directory '/mnt/cmlfs/sources/perl-5.36.0'
make: *** [Makefile:81: all] Error 2
Looks like CMake fails to build due too misplaced __config_site
header for libc++.
It is at:
/cgnutools/include/x86_64-pc-linux-musl/c++/v1/
But shold be here with __config
/cgnutools/include/c++/v1/
For a work around, just use links:
ln -sv ../../x86_64-pc-linux-musl/c++/v1/__config_site /cgnutools/include/c++/v1/__config_site
ln -sv ../../x86_64-pc-linux-musl/c++/v1/module.modulemap cgnutools/include/c++/v1/module.modulemap
Need to update root file system tree to have:
As the title states, are there any real advantages to CMLFS
over MLFS
other than that the toolchain is a bit more bloated now as it uses both LLVM/GCC, and that LLVM is a bit worse at optimizations?
checking for liblzma... yes
checking for zlib... no
configure: error: Package requirements (zlib) were not met:
Package 'zlib', required by 'virtual:world', not found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables zlib_CFLAGS
and zlib_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
And maybe pigz instead of gzip, but pigz requires zlib (zlib-ng works too). Cons: pigz doesn't have wrapper script such as for grep (zgrep). Can be installed for both, gzip just for wrapper script if needed 😄 lol
Originally posted by @owl4ce in #14 (comment)
llvm compilation error. All steps are made in accordance with the instructions. At the stage CMLFS / 1-cgnutools / 7-clang gives an error.
[ 17%] Building CXX object utils/not/CMakeFiles/not.dir/not.cpp.o
[ 17%] Built target LLVMBitstreamReader
[ 17%] Building CXX object lib/BinaryFormat/CMakeFiles/LLVMBinaryFormat.dir/Minidump.cpp.o
[ 17%] Building CXX object lib/BinaryFormat/CMakeFiles/LLVMBinaryFormat.dir/MsgPackDocument.cpp.o
[ 17%] Building CXX object lib/BinaryFormat/CMakeFiles/LLVMBinaryFormat.dir/MsgPackDocumentYAML.cpp.o
[ 17%] Building CXX object lib/BinaryFormat/CMakeFiles/LLVMBinaryFormat.dir/MsgPackReader.cpp.o
[ 17%] Linking CXX executable ../../bin/not
/mnt/cmlfs/cgnutools/bin/../lib/gcc/x86_64-cmlfs-linux-musl/10.3.1/../../../../x86_64-cmlfs-linux-musl/bin/ld: warning: libc.so.6, needed by /mnt/cmlfs/cgnutools/bin/../../cgnutools/lib/libexecinfo.so.1, not found (try using -rpath or -rpath-link)
/mnt/cmlfs/cgnutools/bin/../lib/gcc/x86_64-cmlfs-linux-musl/10.3.1/../../../../x86_64-cmlfs-linux-musl/bin/ld: /mnt/cmlfs/cgnutools/bin/../../cgnutools/lib/libexecinfo.so.1: undefined reference to __stack_chk_fail@GLIBC_2.4' /mnt/cmlfs/cgnutools/bin/../lib/gcc/x86_64-cmlfs-linux-musl/10.3.1/../../../../x86_64-cmlfs-linux-musl/bin/ld: /mnt/cmlfs/cgnutools/bin/../../cgnutools/lib/libexecinfo.so.1: undefined reference to
strlen@GLIBC_2.2.5'
/mnt/cmlfs/cgnutools/bin/../lib/gcc/x86_64-cmlfs-linux-musl/10.3.1/../../../../x86_64-cmlfs-linux-musl/bin/ld: /mnt/cmlfs/cgnutools/bin/../../cgnutools/lib/libexecinfo.so.1: undefined reference to dladdr@GLIBC_2.34' /mnt/cmlfs/cgnutools/bin/../lib/gcc/x86_64-cmlfs-linux-musl/10.3.1/../../../../x86_64-cmlfs-linux-musl/bin/ld: /mnt/cmlfs/cgnutools/bin/../../cgnutools/lib/libexecinfo.so.1: undefined reference to
free@GLIBC_2.2.5'
/mnt/cmlfs/cgnutools/bin/../lib/gcc/x86_64-cmlfs-linux-musl/10.3.1/../../../../x86_64-cmlfs-linux-musl/bin/ld: /mnt/cmlfs/cgnutools/bin/../../cgnutools/lib/libexecinfo.so.1: undefined reference to realloc@GLIBC_2.2.5' /mnt/cmlfs/cgnutools/bin/../lib/gcc/x86_64-cmlfs-linux-musl/10.3.1/../../../../x86_64-cmlfs-linux-musl/bin/ld: /mnt/cmlfs/cgnutools/bin/../../cgnutools/lib/libexecinfo.so.1: undefined reference to
malloc@GLIBC_2.2.5'
/mnt/cmlfs/cgnutools/bin/../lib/gcc/x86_64-cmlfs-linux-musl/10.3.1/../../../../x86_64-cmlfs-linux-musl/bin/ld: /mnt/cmlfs/cgnutools/bin/../../cgnutools/lib/libexecinfo.so.1: undefined reference to snprintf@GLIBC_2.2.5' /mnt/cmlfs/cgnutools/bin/../lib/gcc/x86_64-cmlfs-linux-musl/10.3.1/../../../../x86_64-cmlfs-linux-musl/bin/ld: /mnt/cmlfs/cgnutools/bin/../../cgnutools/lib/libexecinfo.so.1: undefined reference to
write@GLIBC_2.2.5'
collect2: error: ld returned 1 exit status
make[2]: *** [utils/not/CMakeFiles/not.dir/build.make:98: bin/not] Error 1
make[2]: Leaving directory '/mnt/cmlfs/sources/llvm/build'
make[1]: *** [CMakeFiles/Makefile2:13073: utils/not/CMakeFiles/not.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 17%] Building CXX object lib/BinaryFormat/CMakeFiles/LLVMBinaryFormat.dir/MsgPackWriter.cpp.o
[ 17%] Building CXX object lib/BinaryFormat/CMakeFiles/LLVMBinaryFormat.dir/Wasm.cpp.o
[ 17%] Building CXX object lib/BinaryFormat/CMakeFiles/LLVMBinaryFormat.dir/XCOFF.cpp.o
[ 17%] Building CXX object lib/TableGen/CMakeFiles/LLVMTableGen.dir/Record.cpp.o
[ 17%] Building CXX object lib/TableGen/CMakeFiles/LLVMTableGen.dir/SetTheory.cpp.o
[ 17%] Building CXX object lib/TableGen/CMakeFiles/LLVMTableGen.dir/StringMatcher.cpp.o
[ 17%] Building CXX object lib/TableGen/CMakeFiles/LLVMTableGen.dir/TableGenBackend.cpp.o
[ 17%] Building CXX object lib/TableGen/CMakeFiles/LLVMTableGen.dir/TableGenBackendSkeleton.cpp.o
[ 17%] Building CXX object lib/TableGen/CMakeFiles/LLVMTableGen.dir/TGLexer.cpp.o
[ 17%] Linking CXX shared library ../libLLVMOption.so
[ 17%] Linking CXX shared library ../libLLVMBinaryFormat.so
make[2]: Leaving directory '/mnt/cmlfs/sources/llvm/build'
[ 17%] Built target LLVMOption
make[2]: Leaving directory '/mnt/cmlfs/sources/llvm/build'
[ 17%] Built target LLVMBinaryFormat
[ 17%] Building CXX object lib/TableGen/CMakeFiles/LLVMTableGen.dir/TGParser.cpp.o
[ 17%] Linking CXX shared library ../libLLVMFileCheck.so
make[2]: Leaving directory '/mnt/cmlfs/sources/llvm/build'
[ 17%] Built target LLVMFileCheck
[ 17%] Linking CXX shared library ../libLLVMTableGen.so
make[2]: Leaving directory '/mnt/cmlfs/sources/llvm/build'
[ 17%] Built target LLVMTableGen
make[1]: Leaving directory '/mnt/cmlfs/sources/llvm/build'
make: *** [Makefile:156: all] Error 2
make: Leaving directory '/mnt/cmlfs/sources/llvm/build'
When building LLVM of cgnutools, libc++ will not compile if localization is enabled:
-DLIBCXX_ENABLE_LOCALIZATION=ON
If turned on, build fails:
In file included from /mnt/cmlfs/sources/llvm-rl/build/include/c++/v1/__locale:44:
/mnt/cmlfs/sources/llvm-rl/build/include/c++/v1/__support/musl/xlocale.h:28:68: error: 'abi_tag' attribute applied to extern "C" declaration 'long long int strtoll_l(const char*, char**, int, locale_t)'
28 | strtoll_l(const char *__nptr, char **__endptr, int __base, locale_t) {
| ^
/mnt/cmlfs/sources/llvm-rl/build/include/c++/v1/__support/musl/xlocale.h:33:69: error: 'abi_tag' attribute applied to extern "C" declaration 'long long unsigned int strtoull_l(const char*, char**, int, locale_t)'
33 | strtoull_l(const char *__nptr, char **__endptr, int __base, locale_t) {
| ^
/mnt/cmlfs/sources/llvm-rl/build/include/c++/v1/__support/musl/xlocale.h:38:74: error: 'abi_tag' attribute applied to extern "C" declaration 'long long int wcstoll_l(const wchar_t*, wchar_t**, int, locale_t)'
38 | wcstoll_l(const wchar_t *__nptr, wchar_t **__endptr, int __base, locale_t) {
| ^
/mnt/cmlfs/sources/llvm-rl/build/include/c++/v1/__support/musl/xlocale.h:43:75: error: 'abi_tag' attribute applied to extern "C" declaration 'long long int wcstoull_l(const wchar_t*, wchar_t**, int, locale_t)'
43 | wcstoull_l(const wchar_t *__nptr, wchar_t **__endptr, int __base, locale_t) {
| ^
/mnt/cmlfs/sources/llvm-rl/build/include/c++/v1/__support/musl/xlocale.h:48:62: error: 'abi_tag' attribute applied to extern "C" declaration 'long double wcstold_l(const wchar_t*, wchar_t**, locale_t)'
48 | wcstold_l(const wchar_t *__nptr, wchar_t **__endptr, locale_t) {
| ^
ninja: build stopped: subcommand failed.
Even with patch from Alpine Linux, issue persists.
While in chroot and building the final system, I noticed stage1 clang uses GCC:
llvmtools 3.0.0 clang version 15.0.5
Target: x86_64-pc-linux-musl
Thread model: posix
InstalledDir: /llvmtools/bin
Configuration file: /llvmtools/bin/x86_64-pc-linux-musl.cfg
Found candidate GCC installation: /llvmtools/bin/../lib/gcc/x86_64-pc-linux-musl/12.2.0
Selected GCC installation: /llvmtools/bin/../lib/gcc/x86_64-pc-linux-musl/12.2.0
I only built GCC as a backup if a package is hard coded to compile with GCC only.
I have not completely built the final system, so I do not know what specific packages need GCC.
Build fails due to 20 errors. This is the 2nd kernel version with bad typos in the source.
CC /sources/linux-5.13/tools/objtool/arch/x86/decode.o [136/1913]
In file included from arch/x86/decode.c:10:
In file included from /sources/linux-5.13/tools/arch/x86/include/asm/insn.h:10:
In file included from /usr/include/asm/byteorder.h:5:
In file included from /usr/include/linux/byteorder/little_endian.h:13:
/usr/include/linux/swab.h:136:8: error: unknown type name '__always_inline'
static __always_inline unsigned long __swab(const unsigned long y)
^
/usr/include/linux/swab.h:171:8: error: unknown type name '__always_inline'
static __always_inline __u16 __swab16p(const __u16 *p)
^
/usr/include/linux/swab.h:171:29: error: expected ';' after top level declarator
static __always_inline __u16 __swab16p(const __u16 *p)
^
In file included from arch/x86/decode.c:10:
In file included from /sources/linux-5.13/tools/arch/x86/include/asm/insn.h:12:
/sources/linux-5.13/tools/arch/x86/include/asm/inat.h:97:8: error: unknown type name 'insn_attr_t'; did you mean 'insn_byte_t'?
extern insn_attr_t inat_get_opcode_attribute(insn_byte_t opcode);
^~~~~~~~~~~
insn_byte_t
/sources/linux-5.13/tools/arch/x86/include/asm/inat_types.h:12:23: note: 'insn_byte_t' declared here
typedef unsigned char insn_byte_t;
^
In file included from arch/x86/decode.c:10:
In file included from /sources/linux-5.13/tools/arch/x86/include/asm/insn.h:12:
/sources/linux-5.13/tools/arch/x86/include/asm/inat.h:99:8: error: unknown type name 'insn_attr_t'; did you mean 'insn_byte_t'?
extern insn_attr_t inat_get_escape_attribute(insn_byte_t opcode,
^~~~~~~~~~~
insn_byte_t
/sources/linux-5.13/tools/arch/x86/include/asm/inat_types.h:12:23: note: 'insn_byte_t' declared here
typedef unsigned char insn_byte_t;
^
In file included from arch/x86/decode.c:10:
In file included from /sources/linux-5.13/tools/arch/x86/include/asm/insn.h:12:
/sources/linux-5.13/tools/arch/x86/include/asm/inat.h:101:11: error: unknown type name 'insn_attr_t'; did you mean 'insn_byte_t'?
insn_attr_t esc_attr);
^~~~~~~~~~~
insn_byte_t
/sources/linux-5.13/tools/arch/x86/include/asm/inat_types.h:12:23: note: 'insn_byte_t' declared here
typedef unsigned char insn_byte_t;
^
MKELF scripts/mod/elfconfig.h
In file included from arch/x86/decode.c:10:
In file included from /sources/linux-5.13/tools/arch/x86/include/asm/insn.h:12:
/sources/linux-5.13/tools/arch/x86/include/asm/inat.h:102:8: error: unknown type name 'insn_attr_t'; did you mean 'insn_byte_t'?
extern insn_attr_t inat_get_group_attribute(insn_byte_t modrm,
^~~~~~~~~~~
insn_byte_t
^~~~~~~~~~~ [90/1913]
insn_byte_t
/sources/linux-5.13/tools/arch/x86/include/asm/inat_types.h:12:23: note: 'insn_byte_t' declared here
typedef unsigned char insn_byte_t;
^
In file included from arch/x86/decode.c:10:
In file included from /sources/linux-5.13/tools/arch/x86/include/asm/insn.h:12:
/sources/linux-5.13/tools/arch/x86/include/asm/inat.h:104:10: error: unknown type name 'insn_attr_t'; did you mean 'insn_byte_t'?
insn_attr_t esc_attr);
^~~~~~~~~~~
insn_byte_t
/sources/linux-5.13/tools/arch/x86/include/asm/inat_types.h:12:23: note: 'insn_byte_t' declared here
typedef unsigned char insn_byte_t;
^
In file included from arch/x86/decode.c:10:
In file included from /sources/linux-5.13/tools/arch/x86/include/asm/insn.h:12:
/sources/linux-5.13/tools/arch/x86/include/asm/inat.h:105:8: error: unknown type name 'insn_attr_t'; did you mean 'insn_byte_t'?
extern insn_attr_t inat_get_avx_attribute(insn_byte_t opcode,
^~~~~~~~~~~
insn_byte_t
/sources/linux-5.13/tools/arch/x86/include/asm/inat_types.h:12:23: note: 'insn_byte_t' declared here
typedef unsigned char insn_byte_t;
^
In file included from arch/x86/decode.c:10:
In file included from /sources/linux-5.13/tools/arch/x86/include/asm/insn.h:12:
/sources/linux-5.13/tools/arch/x86/include/asm/inat.h:110:41: error: unknown type name 'insn_attr_t'; did you mean 'insn_byte_t'?
static inline int inat_is_legacy_prefix(insn_attr_t attr)
^~~~~~~~~~~
insn_byte_t
/sources/linux-5.13/tools/arch/x86/include/asm/inat_types.h:12:23: note: 'insn_byte_t' declared here
typedef unsigned char insn_byte_t;
^
In file included from arch/x86/decode.c:10:
In file included from /sources/linux-5.13/tools/arch/x86/include/asm/insn.h:12:
/sources/linux-5.13/tools/arch/x86/include/asm/inat.h:116:47: error: unknown type name 'insn_attr_t'; did you mean 'insn_byte_t'?
static inline int inat_is_address_size_prefix(insn_attr_t attr)
^~~~~~~~~~~
insn_byte_t
/sources/linux-5.13/tools/arch/x86/include/asm/inat_types.h:12:23: note: 'insn_byte_t' declared here
typedef unsigned char insn_byte_t;
^
HOSTCC scripts/mod/modpost.o
In file included from arch/x86/decode.c:10:
In file included from /sources/linux-5.13/tools/arch/x86/include/asm/insn.h:12:
/sources/linux-5.13/tools/arch/x86/include/asm/inat.h:121:47: error: unknown type name 'insn_attr_t'; did you mean 'insn_byte_t'?
static inline int inat_is_operand_size_prefix(insn_attr_t attr)
^~~~~~~~~~~
insn_byte_t
^~~~~~~~~~~ [44/1913]
insn_byte_t
/sources/linux-5.13/tools/arch/x86/include/asm/inat_types.h:12:23: note: 'insn_byte_t' declared here
typedef unsigned char insn_byte_t;
^
In file included from arch/x86/decode.c:10:
In file included from /sources/linux-5.13/tools/arch/x86/include/asm/insn.h:12:
/sources/linux-5.13/tools/arch/x86/include/asm/inat.h:126:38: error: unknown type name 'insn_attr_t'; did you mean 'insn_byte_t'?
static inline int inat_is_rex_prefix(insn_attr_t attr)
^~~~~~~~~~~
insn_byte_t
/sources/linux-5.13/tools/arch/x86/include/asm/inat_types.h:12:23: note: 'insn_byte_t' declared here
typedef unsigned char insn_byte_t;
^
In file included from arch/x86/decode.c:10:
In file included from /sources/linux-5.13/tools/arch/x86/include/asm/insn.h:12:
/sources/linux-5.13/tools/arch/x86/include/asm/inat.h:131:39: error: unknown type name 'insn_attr_t'; did you mean 'insn_byte_t'?
static inline int inat_last_prefix_id(insn_attr_t attr)
^~~~~~~~~~~
insn_byte_t
/sources/linux-5.13/tools/arch/x86/include/asm/inat_types.h:12:23: note: 'insn_byte_t' declared here
typedef unsigned char insn_byte_t;
^
In file included from arch/x86/decode.c:10:
In file included from /sources/linux-5.13/tools/arch/x86/include/asm/insn.h:12:
/sources/linux-5.13/tools/arch/x86/include/asm/inat.h:139:38: error: unknown type name 'insn_attr_t'; did you mean 'insn_byte_t'?
static inline int inat_is_vex_prefix(insn_attr_t attr)
^~~~~~~~~~~
insn_byte_t
/sources/linux-5.13/tools/arch/x86/include/asm/inat_types.h:12:23: note: 'insn_byte_t' declared here
typedef unsigned char insn_byte_t;
^
In file included from arch/x86/decode.c:10:
In file included from /sources/linux-5.13/tools/arch/x86/include/asm/insn.h:12:
/sources/linux-5.13/tools/arch/x86/include/asm/inat.h:146:39: error: unknown type name 'insn_attr_t'; did you mean 'insn_byte_t'?
static inline int inat_is_evex_prefix(insn_attr_t attr)
^~~~~~~~~~~
insn_byte_t
/sources/linux-5.13/tools/arch/x86/include/asm/inat_types.h:12:23: note: 'insn_byte_t' declared here
typedef unsigned char insn_byte_t;
^
In file included from arch/x86/decode.c:10:
In file included from /sources/linux-5.13/tools/arch/x86/include/asm/insn.h:12:
/sources/linux-5.13/tools/arch/x86/include/asm/inat.h:151:39: error: unknown type name 'insn_attr_t'; did you mean 'insn_byte_t'?
static inline int inat_is_vex3_prefix(insn_attr_t attr)
^~~~~~~~~~~
insn_byte_t
/sources/linux-5.13/tools/arch/x86/include/asm/inat_types.h:12:23: note: 'insn_byte_t' declared here
static inline int inat_is_vex3_prefix(insn_attr_t attr) [0/1913]
^~~~~~~~~~~
insn_byte_t /sources/linux-5.13/tools/arch/x86/include/asm/inat_types.h:12:23: note: 'insn_byte_t' declared here typedef unsigned char insn_byte_t;
^
In file included from arch/x86/decode.c:10:
In file included from /sources/linux-5.13/tools/arch/x86/include/asm/insn.h:12: /sources/linux-5.13/tools/arch/x86/include/asm/inat.h:156:34: error: unknown type name 'insn_attr_t'; did you mean 'insn_byte_t'?
static inline int inat_is_escape(insn_attr_t attr)
^~~~~~~~~~~
insn_byte_t /sources/linux-5.13/tools/arch/x86/include/asm/inat_types.h:12:23: note: 'insn_byte_t' declared here typedef unsigned char insn_byte_t;
^
In file included from arch/x86/decode.c:10:
In file included from /sources/linux-5.13/tools/arch/x86/include/asm/insn.h:12:
/sources/linux-5.13/tools/arch/x86/include/asm/inat.h:161:34: error: unknown type name 'insn_attr_t'; did you mean 'insn_byte_t'?
static inline int inat_escape_id(insn_attr_t attr)
^~~~~~~~~~~
insn_byte_t
/sources/linux-5.13/tools/arch/x86/include/asm/inat_types.h:12:23: note: 'insn_byte_t' declared here
typedef unsigned char insn_byte_t;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[4]: *** [/sources/linux-5.13/tools/build/Makefile.build:97: /sources/linux-5.13/tools/objtool/arch/x86/decode.o] Error 1
make[3]: *** [/sources/linux-5.13/tools/build/Makefile.build:139: arch/x86] Error 2
make[2]: *** [Makefile:56: /sources/linux-5.13/tools/objtool/objtool-in.o] Error 2
make[1]: *** [Makefile:69: objtool] Error 2
make: *** [Makefile:1974: tools/objtool] Error 2
make: *** Waiting for unfinished jobs....
Stage 3-chroot/018-binutils
Issue: on configure stage, system hanging with huge load and memory leaks at stage:
checking whether compiler driver understands Ada...
It taken a hour, then I break process.
Tried to switch from ( set-llvm-mode && set-llvm-bin-mode ) --> ( set-gcc-mode && set-gnu-bin-mode )
Configuration stage completed pretty fast and OK
checking whether compiler driver understands Ada... no
But compilation failed with:
../../bfd/compress.c:22:10: fatal error: 'zlib.h' file not found
/mnt/cmlfs/llvmtools/include/bzlib.h
/mnt/cmlfs/usr/include/zlib.h
Gives me an error:
HOSTCC scripts/basic/fixdep
/bin/sh: line 1: scripts/basic/fixdep: No such file or directory
make[1]: *** [scripts/Makefile.host:95: scripts/basic/fixdep] Error 127
make[1]: *** Deleting file 'scripts/basic/fixdep'
make: *** [Makefile:535: scripts_basic] Error 2
Know issue: scripts/basic/fixdep.c
failed to compile when using stage0 clang/llvm
Building llvmtools
with llvm-12.0.0 on a glibc host .... Build fails.
[ 70%] Building CXX object src/CMakeFiles/cxx_shared.dir/charconv.cpp.o [139/1822]
In file included from /mnt/cmlfs/sources/llvm/projects/libcxx/src/charconv.cpp:9:
In file included from /mnt/cmlfs/sources/llvm/projects/libcxx/build/include/c++/v1/charconv:79: /mnt/cmlfs/sources/llvm/projects/libcxx/build/include/c++/v1/cmath:321:9: error: no member named 'signbit' in the global namespace; did you mean '__signbit'?
using ::signbit;
~~^~~~~~~
__signbit
/llvmtools/include/math.h:93:5: note: '__signbit' declared here
int __signbit(double);
^
In file included from /mnt/cmlfs/sources/llvm/projects/libcxx/src/charconv.cpp:9:
In file included from /mnt/cmlfs/sources/llvm/projects/libcxx/build/include/c++/v1/charconv:79:
/mnt/cmlfs/sources/llvm/projects/libcxx/build/include/c++/v1/cmath:322:9: error: no member named 'fpclassify' in the global namespace; did you mean '__fpclassify'?
using ::fpclassify;
~~^~~~~~~~~~
__fpclassify
/llvmtools/include/math.h:51:5: note: '__fpclassify' declared here
int __fpclassify(double);
^
In file included from /mnt/cmlfs/sources/llvm/projects/libcxx/src/charconv.cpp:9:
In file included from /mnt/cmlfs/sources/llvm/projects/libcxx/build/include/c++/v1/charconv:79:
/mnt/cmlfs/sources/llvm/projects/libcxx/build/include/c++/v1/cmath:323:9: error: no member named 'isfinite' in the global namespace; did you mean 'finite'?
using ::isfinite;
~~^~~~~~~~
finite
/llvmtools/include/math.h:401:13: note: 'finite' declared here
int finite(double);
^
In file included from /mnt/cmlfs/sources/llvm/projects/libcxx/src/charconv.cpp:9:
In file included from /mnt/cmlfs/sources/llvm/projects/libcxx/build/include/c++/v1/charconv:79:
/mnt/cmlfs/sources/llvm/projects/libcxx/build/include/c++/v1/cmath:324:9: error: no membe[106/1822]sinf' in the global namespace
using ::isinf;
~~^
/mnt/cmlfs/sources/llvm/projects/libcxx/build/include/c++/v1/cmath:325:9: error: no member named 'isnan' in the global namespace
using ::isnan;
~~^
/mnt/cmlfs/sources/llvm/projects/libcxx/build/include/c++/v1/cmath:326:9: error: no member named 'isnormal' in the global namespace
using ::isnormal;
~~^
/mnt/cmlfs/sources/llvm/projects/libcxx/build/include/c++/v1/cmath:327:9: error: no member named 'isgreater' in the global namespace; did you mean '__isgreater'?
using ::isgreater;
~~^~~~~~~~~
__isgreater
/llvmtools/include/math.h:118:1: note: '__isgreater' declared here
__ISREL_DEF(greater, >, double_t)
^
/llvmtools/include/math.h:105:21: note: expanded from macro '__ISREL_DEF'
static __inline int __is##rel(type __x, type __y) \
^
<scratch space>:59:1: note: expanded from here
__isgreater
^
In file included from /mnt/cmlfs/sources/llvm/projects/libcxx/src/charconv.cpp:9:
In file included from /mnt/cmlfs/sources/llvm/projects/libcxx/build/include/c++/v1/charconv:79:
/mnt/cmlfs/sources/llvm/projects/libcxx/build/include/c++/v1/cmath:328:9: error: no member named 'isgreaterequal' in the global namespace; did you mean '__isgreaterequal'?
using ::isgreaterequal;
~~^~~~~~~~~~~~~~
__isgreaterequal
/llvmtools/include/math.h:121:1: note: '__isgreaterequal' declared here
__ISREL_DEF(greaterequal, >=, double_t) [72/1822]
^
/llvmtools/include/math.h:105:21: note: expanded from macro '__ISREL_DEF'
static __inline int __is##rel(type __x, type __y) \
^
<scratch space>:62:1: note: expanded from here
__isgreaterequal
^
In file included from /mnt/cmlfs/sources/llvm/projects/libcxx/src/charconv.cpp:9:
In file included from /mnt/cmlfs/sources/llvm/projects/libcxx/build/include/c++/v1/charconv:79:
/mnt/cmlfs/sources/llvm/projects/libcxx/build/include/c++/v1/cmath:329:9: error: no member named 'isless' in the global namespace; did you mean '__isless'?
using ::isless;
~~^~~~~~
__isless
/llvmtools/include/math.h:109:1: note: '__isless' declared here
__ISREL_DEF(less, <, double_t)
^
/llvmtools/include/math.h:105:21: note: expanded from macro '__ISREL_DEF'
static __inline int __is##rel(type __x, type __y) \
^
<scratch space>:50:1: note: expanded from here
__isless
^
In file included from /mnt/cmlfs/sources/llvm/projects/libcxx/src/charconv.cpp:9:
In file included from /mnt/cmlfs/sources/llvm/projects/libcxx/build/include/c++/v1/charconv:79:
/mnt/cmlfs/sources/llvm/projects/libcxx/build/include/c++/v1/cmath:330:9: error: no member named 'islessequal' in the global namespace; did you mean '__islessequal'?
using ::islessequal;
~~^~~~~~~~~~~
__islessequal
/llvmtools/include/math.h:112:1: note: '__islessequal' declared here
__ISREL_DEF(lessequal, <=, double_t)
^
/llvmtools/include/math.h:105:21: note: expanded from macro '__ISREL_DEF' [38/1822]
static __inline int __is##rel(type __x, type __y) \
^
<scratch space>:53:1: note: expanded from here
__islessequal
^
In file included from /mnt/cmlfs/sources/llvm/projects/libcxx/src/charconv.cpp:9:
In file included from /mnt/cmlfs/sources/llvm/projects/libcxx/build/include/c++/v1/charconv:79:
/mnt/cmlfs/sources/llvm/projects/libcxx/build/include/c++/v1/cmath:331:9: error: no member named 'islessgreater' in the global namespace; did you mean '__islessgreater'?
using ::islessgreater;
~~^~~~~~~~~~~~~
__islessgreater
/llvmtools/include/math.h:115:1: note: '__islessgreater' declared here
__ISREL_DEF(lessgreater, !=, double_t)
^
/llvmtools/include/math.h:105:21: note: expanded from macro '__ISREL_DEF'
static __inline int __is##rel(type __x, type __y) \
^
<scratch space>:56:1: note: expanded from here
__islessgreater
^
In file included from /mnt/cmlfs/sources/llvm/projects/libcxx/src/charconv.cpp:9:
In file included from /mnt/cmlfs/sources/llvm/projects/libcxx/build/include/c++/v1/charconv:79:
/mnt/cmlfs/sources/llvm/projects/libcxx/build/include/c++/v1/cmath:332:9: error: no member named 'isunordered' in the global namespace
using ::isunordered;
~~^
/mnt/cmlfs/sources/llvm/projects/libcxx/build/include/c++/v1/cmath:333:9: error: no member named 'isunordered' in the global namespace
using ::isunordered;
~~^
/mnt/cmlfs/sources/llvm/projects/libcxx/build/include/c++/v1/cmath:339:9: error: no member named 'abs' in the global namespace; did you mean 'fabs'?
using ::abs; [4/1822]
~~^~~
fabs
/llvmtools/include/math.h:203:13: note: 'fabs' declared here
double fabs(double);
^
In file included from /mnt/cmlfs/sources/llvm/projects/libcxx/src/charconv.cpp:9:
In file included from /mnt/cmlfs/sources/llvm/projects/libcxx/build/include/c++/v1/charconv:79:
/mnt/cmlfs/sources/llvm/projects/libcxx/build/include/c++/v1/cmath:644:26: error: no template named 'numeric_limits'
bool _FloatBigger = (numeric_limits<_FloatT>::digits > numeric_limits<_IntT>::digits),
^
/mnt/cmlfs/sources/llvm/projects/libcxx/build/include/c++/v1/cmath:644:60: error: no template named 'numeric_limits'
bool _FloatBigger = (numeric_limits<_FloatT>::digits > numeric_limits<_IntT>::digits),
^
/mnt/cmlfs/sources/llvm/projects/libcxx/build/include/c++/v1/cmath:645:18: error: no template named 'numeric_limits'
int _Bits = (numeric_limits<_IntT>::digits - numeric_limits<_FloatT>::digits)>
^
/mnt/cmlfs/sources/llvm/projects/libcxx/build/include/c++/v1/cmath:645:50: error: no template named 'numeric_limits'
int _Bits = (numeric_limits<_IntT>::digits - numeric_limits<_FloatT>::digits)>
^
/mnt/cmlfs/sources/llvm/projects/libcxx/build/include/c++/v1/cmath:650:17: error: no template named 'numeric_limits'
static_assert(numeric_limits<_FloatT>::radix == 2, "FloatT has incorrect radix");
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [src/CMakeFiles/cxx_shared.dir/build.make:128: src/CMakeFiles/cxx_shared.dir/charconv.cpp.o] Error 1
make[2]: Leaving directory '/mnt/cmlfs/sources/llvm/projects/libcxx/build'
make[1]: *** [CMakeFiles/Makefile2:533: src/CMakeFiles/cxx_shared.dir/all] Error 2
make[1]: Leaving directory '/mnt/cmlfs/sources/llvm/projects/libcxx/build'
make: *** [Makefile:130: all] Error 2
make: Leaving directory '/mnt/cmlfs/sources/llvm/projects/libcxx/build'
Under chroot, LLD and clang will not compile because llvm-tblgen
fails to compile:
[14/22] Building CXX object utils/TableGen/CMakeFiles/llvm-tblgen.dir/CodeGenHwModes.cpp.o
In file included from /sources/llvm-project-15.0.5.src/llvm/utils/TableGen/DAGISelMatcherOpt.cpp:14:
/sources/llvm-project-15.0.5.src/llvm/utils/TableGen/CodeGenDAGPatterns.h:1046:23: error: expected expression
return Operands[ON];
^
1 error generated.
I'm thinking of trying to compile CMLFS here to actually try to find errors and actually try to help in something on the project, but i'm in doubt about how to build it correctly.
What is the host you're using? I'm currently using Devuan Beowulf (equivalent to Debian 10).
I think things like this are worth to be put in a documentation-- or better, an index containing tested/compatible hosts for cross-compiling it.
Hi, nice repository. I'm not sure what the problem is (the title). However, libstdc++ becomes like this:
$ ldd /cgnutools/x86_64-cmlfs-linux-musl/lib/libstdc++.so
ldd (0x7f16150ee000)
libc.so => ldd (0x7f16150ee000)
Error loading shared library libgcc_s.so.1: No such file or directory (needed by /cgnutools/x86_64-cmlfs-linux-musl/lib/libstdc++.so)
Error relocating /cgnutools/x86_64-cmlfs-linux-musl/lib/libstdc++.so: _Unwind_GetRegionStart: symbol not found
Error relocating /cgnutools/x86_64-cmlfs-linux-musl/lib/libstdc++.so: _Unwind_GetTextRelBase: symbol not found
Error relocating /cgnutools/x86_64-cmlfs-linux-musl/lib/libstdc++.so: _Unwind_RaiseException: symbol not found
Error relocating /cgnutools/x86_64-cmlfs-linux-musl/lib/libstdc++.so: _Unwind_Resume_or_Rethrow: symbol not found
Error relocating /cgnutools/x86_64-cmlfs-linux-musl/lib/libstdc++.so: _Unwind_GetIPInfo: symbol not found
Error relocating /cgnutools/x86_64-cmlfs-linux-musl/lib/libstdc++.so: _Unwind_GetLanguageSpecificData: symbol not found
Error relocating /cgnutools/x86_64-cmlfs-linux-musl/lib/libstdc++.so: _Unwind_GetDataRelBase: symbol not found
Error relocating /cgnutools/x86_64-cmlfs-linux-musl/lib/libstdc++.so: _Unwind_SetGR: symbol not found
Error relocating /cgnutools/x86_64-cmlfs-linux-musl/lib/libstdc++.so: _Unwind_DeleteException: symbol not found
Error relocating /cgnutools/x86_64-cmlfs-linux-musl/lib/libstdc++.so: __popcountdi2: symbol not found
Error relocating /cgnutools/x86_64-cmlfs-linux-musl/lib/libstdc++.so: _Unwind_Resume: symbol not found
Error relocating /cgnutools/x86_64-cmlfs-linux-musl/lib/libstdc++.so: _Unwind_SetIP: symbol not found
So it can't build on step 8-clang
$ LD_LIBRARY_PATH=/cgnutools/lib:/cgnutools/${CMLFS_TARGET}/lib:/usr/lib:/lib ninja -C build
ninja: /cgnutools/x86_64-cmlfs-linux-musl/lib/libstdc++.so.6: no version information available (required by ninja)
ninja: /cgnutools/x86_64-cmlfs-linux-musl/lib/libstdc++.so.6: no version information available (required by ninja)
ninja: /cgnutools/x86_64-cmlfs-linux-musl/lib/libstdc++.so.6: no version information available (required by ninja)
ninja: /cgnutools/x86_64-cmlfs-linux-musl/lib/libstdc++.so.6: no version information available (required by ninja)
ninja: /cgnutools/x86_64-cmlfs-linux-musl/lib/libstdc++.so.6: no version information available (required by ninja)
ninja: /cgnutools/x86_64-cmlfs-linux-musl/lib/libstdc++.so.6: no version information available (required by ninja)
ninja: /cgnutools/x86_64-cmlfs-linux-musl/lib/libstdc++.so.6: no version information available (required by ninja)
ninja: Relink `/cgnutools/x86_64-cmlfs-linux-musl/lib/libgcc_s.so.1' with `/lib64/libc.so.6' for IFUNC symbol `memset'
Segmentation fault
Though, libgcc_s.so.1
is fine.
$ ldd /cgnutools/x86_64-cmlfs-linux-musl/lib/libgcc_s.so.1
ldd (0x7f04a7038000)
libc.so => ldd (0x7f04a7038000)
[ 2-llvmtools >> 04-libcxx ]
Building libcxx under llvm source fails to build:
[187/264] Building CXX object src/CMakeFiles/cxx_static.dir/atomic.cpp.o
FAILED: src/CMakeFiles/cxx_static.dir/atomic.cpp.o
/cgnutools/bin/x86_64-cmlfs-linux-musl-clang++ -DNDEBUG -D_LIBCPP_BUILDING_LIBRARY -D_LIBCPP_HAS_N
O_PRAGMA_SYSTEM_HEADER -D_LIBCPP_LINK_PTHREAD_LIB -D_LIBCPP_LINK_RT_LIB -Iinclude/c++build -DLIBCXX
_BUILDING_LIBCXXABI -nostdinc++ -fvisibility-inlines-hidden -fvisibility=hidden -Wall -Wextra -W -Wwrite-strings -Wno-unused-parameter -Wno-long-long -Werror=return-type -Wextra-semi -Wno-user-defined-literals -Wno-covered-switch-default -Wno-ignored-attributes -Wno-error -I /mnt/cmlfs/sources/llvm/projects/libcxx/build/include/c++/v1 -include /mnt/cmlfs/sources/llvm/projects/libcxx/build/__config_site -std=c++14 -MD -MT src/CMakeFiles/cxx_static.dir/atomic.cpp.o -MF src/CMakeFiles/cxx_static.dir/atomic.cpp.o.d -o src/CMakeFiles/cxx_static.dir/atomic.cpp.o -c ../src/atomic.cpp
../src/atomic.cpp:21:10: fatal error: 'linux/futex.h' file not found
#include <linux/futex.h>
^~~~~~~~~~~~~~~
1 error generated.
[188/264] Building CXX object src/CMakeFiles/cxx_static.dir/barrier.cpp.o
ninja: build stopped: subcommand failed.
Same error if built with make instead of ninja
Looks like zlib-ng (with zlib-compat) isn't compatible with perl?
Perl fails to build:
In file included from Zlib.xs:34:
/usr/include/zlib.h:1781:31: error: unknown type name 'gzFile'
Z_EXTERN int Z_EXPORT gzgetc_(gzFile file); /* backward compatibility */
^
/usr/include/zlib.h:1818:13: error: unknown type name 'gzFile'
Z_EXTERN gzFile Z_EXPORT gzopen(const char *, const char *);
^
/usr/include/zlib.h:1819:45: error: unexpected type name 'off_t': expected identifier
Z_EXTERN z_off_t Z_EXPORT gzseek(gzFile, z_off_t, int);
^
/usr/include/zconf.h:159:21: note: expanded from macro 'z_off_t'
# define z_off_t off_t
^
In file included from Zlib.xs:34:
/usr/include/zlib.h:1819:54: error: expected identifier
Z_EXTERN z_off_t Z_EXPORT gzseek(gzFile, z_off_t, int);
^
/usr/include/zlib.h:1820:37: error: a parameter list without types is only allowed in a function definition
Z_EXTERN z_off_t Z_EXPORT gztell(gzFile);
^
/usr/include/zlib.h:1821:39: error: a parameter list without types is only allowed in a function definition
Z_EXTERN z_off_t Z_EXPORT gzoffset(gzFile);
^
/usr/include/zlib.h:1840:35: error: unknown type name 'gzFile'
Z_EXTERN int Z_EXPORTVA gzvprintf(gzFile file, const char *format, va_list va);
^
In file included from Zlib.xs:743:
./constants.h:370:18: warning: incompatible pointer to integer conversion assigning to 'IV' (aka 'long') from 'void *' [-Wint-conversion]
*iv_return = Z_NULL;
^ ~~~~~~
when checking libc++.so.1.0 with ldd
:
$ LD_LIBRARY_PATH=/cgnutools/lib ldd build/lib/libc++.so.1.0
ldd (0x7fd1cf4b8000)
libc.so => ldd (0x7fd1cf4b8000)
libunwind.so.1 => /cgnutools/lib/libunwind.so.1 (0x7fd1cf30c000)
libc++abi.so.1 => /cgnutools/lib/libc++abi.so.1 (0x7fd1cf2b6000)
Error relocating build/lib/libc++.so.1.0: __divti3: symbol not found
What provides __divti3
?
Grub builds fine under chroot. When it is time to use grub-install
to install grub as boot loader, install fails as diskboot.img
is too large at 129Mb. Correct size is 512 Kb.
Replacing image (with correct size) from an older build, install progresses but fails again with boot.img
too large at 535 Kb instead of 512 Kb.
Replace boot.img
from an older build (with correct size) and now install succeeds.
Re-built llvmtools
and made sure libcxx
did not require libatomic.
now llvm/clang for llvmtools
fails to build:
FAILED: include/llvm/IR/Attributes.inc
cd /mnt/cmlfs/sources/llvm/build && /mnt/cmlfs/sources/llvm/build/bin/llvm-tblgen -gen-attrs -I /mnt/cmlfs/sources/llvm/include/llvm/IR -I /mnt/cmlfs/sources/llvm/build/include -I /mnt/cmlfs/sources/llvm/include /mnt/cmlfs/sources/llvm/include/llvm/IR/Attributes.td --write-if-changed -o include/llvm/IR/Attributes.inc -d include/llvm/IR/Attributes.inc.d
/bin/sh: /mnt/cmlfs/sources/llvm/build/bin/llvm-tblgen: No such file or directory
[220/3316] Building CXX object lib/BinaryFormat/CMakeFiles/LLVMBinaryFormat.dir/MsgPackDocument.cpp.o
ninja: build stopped: subcommand failed.
Originally posted by @dslm4515 in #12 (comment)
When Clang(llvm) is built under chroot and tested, LLD searches for the C Runtime objects in this directory:
ld.lld: /usr/bin/../lib/Scrt1.o
ld.lld: /usr/bin/../lib/crti.o
ld.lld: /usr/bin/../lib/crtn.o
Which resolves to /usr/lib/*crt[1in].o
Once GCC is built under chroot after or before LLVM, LLD now searches for C runtime objects in:
ld. lld: /usr/lib/gcc/x86_64-linux-musl/10.3.1/../../../Scrt1.o
ld.lld: /usr/lib/gcc/x86_64-linux-musl/10.3.1/../../../crti.o
ld.lld: /usr/lib/gcc/x86_64-linux-musl/10.3.1/../../../crtn.o
Which resolves to /usr/lib/*crt[1in].o
Why does the search path change (even though both paths point to the same directory)?
And, can it be set to just /usr/lib
?
llvmtools' libc++.so.1
from libcxx should NOT rely on libatomic.so.1
, which is provided by GCC.
$ ldd /llvmtools/lib/libc++.so.1
ldd (0x7fb67cb49000)
libc.so => ldd (0x7fb67cb49000)
Error loading shared library libatomic.so.1: No such file or directory (needed by /llvmtools/lib/libc++.so.1)
libunwind.so.1 => /llvmtools/lib/../lib/libunwind.so.1 (0x7fb67ca6b000)
libc++abi.so.1 => /llvmtools/lib/../lib/libc++abi.so.1 (0x7fb67ca0f000)
This will require to build LLVM for llvmtools with a LD_LIBARARY_PATH
hack
While in chroot, building GCC to install in /opt/gnu
with clang fails. GMP, MPC, MPFR, and Binutils are installed in /opt/gnu
.
make[1]: Entering directory '/sources/gcc-10.2.1_pre2/build'
make[2]: Entering directory '/sources/gcc-10.2.1_pre2/build/libiberty'
rm -f ./libiberty.a pic/./libiberty.a noasan/./libiberty.a
/opt/gnu/bin/as rc ./libiberty.a \
./regex.o ./cplus-dem.o ./cp-demangle.o ./md5.o ./sha1.o ./alloca.o ./argv.o ./choose-temp.o ./concat.o ./cp-demint.o ./crc32.o ./d-demangle.o ./dwarfnames.o ./dyn-string.o ./fdmatch.o ./fibheap.o ./filedescriptor.o ./filename_cmp.o ./floatformat.o ./fnmatch.o ./fopen_unlocked.o ./getopt.o ./getopt1.o ./getpwd.o ./getruntime.o ./hashtab.o ./hex.o ./lbasename.o ./lrealpath.o ./make-relative-prefix.o ./make-temp-file.o ./objalloc.o ./obstack.o ./partition.o ./pexecute.o ./physmem.o ./pex-common.o ./pex-one.o ./pex-unix.o ./vprintf-support.o ./rust-demangle.o ./safe-ctype.o ./simple-object.o ./simple-object-coff.o ./simple-object-elf.o ./simple-object-mach-o.o ./simple-object-xcoff.o ./sort.o ./spaces.o ./splay-tree.o ./stack-limit.o ./strerror.o ./strsignal.o ./timeval-utils.o ./unlink-if-ordinary.o ./xasprintf.o ./xatexit.o ./xexit.o ./xmalloc.o ./xmemdup.o ./xstrdup.o ./xstrerror.o ./xstrndup.o ./xvasprintf.o ./sigsetmask.o ./setproctitle.o
Assembler messages:
Error: can't open rc for reading: No such file or directory
rc: Error: can't open ./libiberty.a for reading: No such file or directory
./regex.o:1: Error: junk at end of line, first unrecognized character valued 0x7f
and ends with:
./setproctitle.o:4: Error: junk at end of line, first unrecognized character valued 0x8
./setproctitle.o:4: Error: junk at end of line, first unrecognized character valued 0x18
make[2]: *** [Makefile:252: libiberty.a] Error 1
make[2]: Leaving directory '/sources/gcc-10.2.1_pre2/build/libiberty'
make[1]: *** [Makefile:8362: all-libiberty] Error 2
make[1]: Leaving directory '/sources/gcc-10.2.1_pre2/build'
make: *** [Makefile:963: all] Error 2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.