Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TO-DO: Libc++'s __config_site misplaced #72

Open
dslm4515 opened this issue Dec 28, 2022 · 16 comments · May be fixed by #105
Open

TO-DO: Libc++'s __config_site misplaced #72

dslm4515 opened this issue Dec 28, 2022 · 16 comments · May be fixed by #105
Assignees
Labels

Comments

@dslm4515
Copy link
Owner

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
@dslm4515 dslm4515 added the To-Do label Dec 28, 2022
@dslm4515 dslm4515 self-assigned this Dec 28, 2022
@dslm4515
Copy link
Owner Author

CMake still wont compile.
Will try building it under chroot.

@dslm4515
Copy link
Owner Author

Nope. Stage 1 clang has "no C++11 support"

@dslm4515
Copy link
Owner Author

CMake still wont compile

As of commit 1d4aefb , CMake can bootstrap and configure but fails to build:

[ 91%] Building CXX object Source/CursesDialog/CMakeFiles/ccmake.dir/ccmake.cxx.o
In file included from /mnt/cmlfs/sources/cmake-3.25.1/Source/CursesDialog/ccmake.cxx:8:
In file included from /cgnutools/include/x86_64-pc-linux-musl/c++/v1/iostream:41:
In file included from /cgnutools/include/x86_64-pc-linux-musl/c++/v1/ios:221:
In file included from /cgnutools/include/x86_64-pc-linux-musl/c++/v1/__locale:18:
In file included from /cgnutools/include/x86_64-pc-linux-musl/c++/v1/memory:841:
In file included from /cgnutools/include/x86_64-pc-linux-musl/c++/v1/__algorithm/copy.h:12:
In file included from /cgnutools/include/x86_64-pc-linux-musl/c++/v1/__algorithm/unwrap_iter.h:13:
In file included from /cgnutools/include/x86_64-pc-linux-musl/c++/v1/__iterator/iterator_traits.h:14:
In file included from /cgnutools/include/x86_64-pc-linux-musl/c++/v1/__iterator/incrementable_traits.h:15:
In file included from /cgnutools/include/x86_64-pc-linux-musl/c++/v1/concepts:133:
In file included from /cgnutools/include/x86_64-pc-linux-musl/c++/v1/__concepts/arithmetic.h:15:
In file included from /cgnutools/include/x86_64-pc-linux-musl/c++/v1/type_traits:421:
In file included from /cgnutools/include/x86_64-pc-linux-musl/c++/v1/__functional/invoke.h:15:
In file included from /cgnutools/include/x86_64-pc-linux-musl/c++/v1/__type_traits/apply_cv.h:16:
In file included from /cgnutools/include/x86_64-pc-linux-musl/c++/v1/__type_traits/remove_reference.h:13:
/cgnutools/include/x86_64-pc-linux-musl/c++/v1/cstddef:50:9: error: no member named 'nullptr_t' in the global namespace
using ::nullptr_t;
      ~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 errors generated.
make[2]: *** [Source/CursesDialog/CMakeFiles/ccmake.dir/build.make:76: Source/CursesDialog/CMakeFiles/ccmake.dir/ccmake.cxx.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2377: Source/CursesDialog/CMakeFiles/ccmake.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

@dslm4515
Copy link
Owner Author

Looks like C Library implementation [by musl] has nullptr_t defined. Forced the libc++ headers to use musl's stddef.h in place of libc++'s cstddef:

Modified: /cgnutools/include/x86_64-pc-linux-musl/c++/v1/__type_traits/remove_reference.h

 #ifndef _LIBCPP___TYPE_TRAITS_REMOVE_REFERENCE_H
#define _LIBCPP___TYPE_TRAITS_REMOVE_REFERENCE_H

#include <__config>
//#include <cstddef>
#include <stddef.h>

Modified: /cgnutools/include/x86_64-pc-linux-musl/c++/v1/__type_traits/apply_cv.h

#ifndef _LIBCPP___TYPE_TRAITS_APPLY_CV_H
#define _LIBCPP___TYPE_TRAITS_APPLY_CV_H

#include <__config>
#include <__type_traits/integral_constant.h>
#include <__type_traits/is_const.h>
#include <__type_traits/is_volatile.h>
#include <__type_traits/remove_reference.h>
//#include <cstddef>
#include <stddef.h>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#  pragma GCC system_header
#endif

_LIBCPP_BEGIN_NAMESPACE_STD

@dslm4515
Copy link
Owner Author

dslm4515 commented Dec 29, 2022

Each time i modify a libc++ header, cmake builds further.... modified these libc++ headers as well:
I'll just use a link to replace cstddef with stddef.h

 /cgnutools/include/x86_64-pc-linux-musl/c++/v1/__type_traits/is_array.h
/cgnutools/include/x86_64-pc-linux-musl/c++/v1/__type_traits/remove_extent.h
/cgnutools/include/x86_64-pc-linux-musl/c++/v1/__type_traits/is_member_function_pointer.h

@dslm4515
Copy link
Owner Author

Number of headers to modify continues to grow... Perhaps, use a link to replace cstddef with musl's stddef.h ?

ln -sv ../../../stddef.h /cgnutools/include/x86_64-pc-linux-musl/c++/v1/cstddef

@dslm4515
Copy link
Owner Author

Looks like a libc++ header needs musl's stddef.h added:

 /cgnutools/include/x86_64-pc-linux-musl/c++/v1/__type_traits/is_fundamental.h

@dslm4515
Copy link
Owner Author

New road block:

[  0%] Building CXX object Source/kwsys/CMakeFiles/cmsys.dir/Directory.cxx.o
In file included from /mnt/cmlfs/sources/cmake-3.25.1/Source/kwsys/Directory.cxx:4:
In file included from /mnt/cmlfs/sources/cmake-3.25.1/Source/cmsys/Directory.hxx:7:
In file included from /mnt/cmlfs/sources/cmake-3.25.1/Source/cmsys/Status.hxx:8:
In file included from /cgnutools/include/x86_64-pc-linux-musl/c++/v1/string:519:
In file included from /cgnutools/include/x86_64-pc-linux-musl/c++/v1/__algorithm/max.h:13:
In file included from /cgnutools/include/x86_64-pc-linux-musl/c++/v1/__algorithm/comp_ref_type.h:13:
In file included from /cgnutools/include/x86_64-pc-linux-musl/c++/v1/__debug:16:
In file included from /cgnutools/include/x86_64-pc-linux-musl/c++/v1/type_traits:452:
In file included from /cgnutools/include/x86_64-pc-linux-musl/c++/v1/__type_traits/is_compound.h:14:
In file included from /cgnutools/include/x86_64-pc-linux-musl/c++/v1/__type_traits/is_fundamental.h:14:
/cgnutools/include/x86_64-pc-linux-musl/c++/v1/__type_traits/is_null_pointer.h:24:49: error: use of undeclared identifier 'nullptr_t'; did you mean 'nullptr'?
template <>          struct __is_nullptr_t_impl<nullptr_t> : public true_type {};
                                                ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 errors generated.
make[3]: *** [Source/kwsys/CMakeFiles/cmsys.dir/build.make:174: Source/kwsys/CMakeFiles/cmsys.dir/Directory.cxx.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:1524: Source/kwsys/CMakeFiles/cmsys.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:2384: Source/CursesDialog/CMakeFiles/ccmake.dir/rule] Error 2
make: *** [Makefile:953: ccmake] Error 2

@dslm4515
Copy link
Owner Author

Modified header to use libc++'s cstddef? Since I renamed the real libc++ header as cstddef.orig then made a link of cstddef to point to musl's stddef.h, I added #include <cstddef.orig> to the following libc++ header:

/cgnutools/include/x86_64-pc-linux-musl/c++/v1/__type_traits/is_null_pointer.h

@dslm4515
Copy link
Owner Author

No. Problem just got re-routed:

/cgnutools/include/x86_64-pc-linux-musl/c++/v1/cstddef.orig:50:9: error: no member named 'nullptr_t' in the global namespace
using ::nullptr_t;
      ~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 errors generated.
make[3]: *** [Source/CursesDialog/CMakeFiles/ccmake.dir/build.make:76: Source/CursesDialog/CMakeFiles/ccmake.dir/ccmake.cxx.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:2377: Source/CursesDialog/CMakeFiles/ccmake.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:2384: Source/CursesDialog/CMakeFiles/ccmake.dir/rule] Error 2
make: *** [Makefile:953: ccmake] Error 2

@dslm4515
Copy link
Owner Author

dslm4515 commented Dec 30, 2022

So CMake wont cross compile. BUT compiles fine under chroot!

@takusuman
Copy link
Contributor

Got this now at the second stage of LLVM for Copacabana... Guess a fix could be using /cgnutools/include/$TARGET_TUPLE/c++/v1 at the include search path too.

@takusuman
Copy link
Contributor

Yep, it works greatly!

@dslm4515
Copy link
Owner Author

dslm4515 commented Jan 3, 2025

I'm going to re-open this and close it once I get a commit in for this

@dslm4515 dslm4515 reopened this Jan 3, 2025
takusuman added a commit to takusuman/CMLFS that referenced this issue Jan 4, 2025
…M 1st stage

Discovered this while building Copacabana's toolchain.
Fixes dslm4515#72.
@takusuman
Copy link
Contributor

Proposal made; I think it needs some testing from CMLFS' side.

@takusuman
Copy link
Contributor

@dslm4515 I know it's not related exactly to this issue, but we could update 1-Stage0 recipe for mussel to use the latest version and abandon the hacks that had to be done in the past.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants