-
Notifications
You must be signed in to change notification settings - Fork 81
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
Error compiling 1.11.X with LLVM #256
Comments
The incomplete type seems to be Either musl lacks std::pair or it has some bugs, I don't know. I do not officially support musl.. too niche.. and too incomplete. If you can figure out a patch to fix this, it's welcome but I lack the time to support this. Sorry man. |
Thanks, but if i change the step to reproduce to |
Hmm. Ah, interesting. Well one big difference is that 1.11.0 switched the compiler standard to use C++20. Maybe there's something weird/out of spec with musl and C++20? |
Hmm. I wonder if this error might be related to llvm trying to use libstcd++ (gcc's C++ headers and lib) rather than its own libc++ (clang C++ headers and lib)... from the paths in the above error log it looks like that might be what's going on. And it could be that with language standard c++17 it "just worked" but with c++20 somehow that trips things up. You may have to figure out what flags to use to use the llvm/clang headers? No idea man.. this is kind of beyond the scope of my time commitments right now.. but if you do figure it out, patches welcome. |
It's out of my scope too, but I found some possible related problems. Maybe someone could find the issues helpful. llvm/llvm-project#62166 llvm/llvm-project#59966 llvm/llvm-project#59292 |
Oh I see I need to use alpine to reproduce. I will try to do so now.. and maybe come up with a clever solution but.. this really is not something I wanted to support. Use a real libc man wth. musl is anemic and buggy last I checked. |
Ok, I was able to reproduce on alpine. This is definitely an issue with alpine's environment. Something is not kosher in what is going on with clang++ 17 and alpine. I don't like that it's using g++'s C++ headers rather than clang's, for start. That is suspicious. Also doubly so that it's using musl. I have definitely used clang-17 before without issue. In fact, I just tried it now on a different non-alpine box with clang-17 and it compiled fine. |
Ok, I was able to reproduce on debian 12 cloud image. Installed LLVM like this -> https://apt.llvm.org <- version 19 LLVM: wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 19 all env vars: CC="clang"
CXX="${CC}++"
CFLAGS="-O3 -pipe -march=native -fPIE"
CXXFLAGS="$CFLAGS"
LDFLAGS="-pie -Wl,--as-needed"
MAKEFLAGS="-j$(nproc)" dependencies: sudo apt install autoconf git liblz4-dev make pkg-config qt6-base-dev rocksdb-tools libzmq3-dev librocksdb-dev libjemalloc-dev steps to reproduce: cd /tmp
VERSION=1.11.0
git clone --branch v$VERSION https://github.com/cculianu/Fulcrum.git && cd Fulcrum
qmake6 \
Fulcrum.pro \
-spec "linux-$CC" \
-o build/
make -C build qmake output: Info: creating stash file /tmp/Fulcrum/build/.qmake.stash
Info: creating cache file /tmp/Fulcrum/build/.qmake.cache
Checking for builtin_clzl... yes
Checking for builtin_clzll... yes
Checking for endian_big... no
Checking for endian_little... yes
Checking for zmq... yes
Project MESSAGE: ZMQ version: 4.3.4
Checking for rocksdb... yes
Project MESSAGE: rocksdb: using system lib
Checking for jemalloc... yes
Project MESSAGE: Including embedded secp256k1
Project MESSAGE: Installation dir prefix is /usr/local make output/errors: In file included from ../src/Json/Json_Parser.cpp:26:
In file included from ../src/Json/Json.h:28:
In file included from ../src/Common.h:21:
In file included from /usr/include/x86_64-linux-gnu/qt6/QtCore/QString:1:
In file included from /usr/include/x86_64-linux-gnu/qt6/QtCore/qstring.h:14:
In file included from /usr/include/x86_64-linux-gnu/qt6/QtCore/qchar.h:9:
In file included from /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/functional:62:
In file included from /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/vector:64:
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_vector.h:367:35: error: arithmetic on a pointer to an incomplete type 'std::pair<QByteArray, (anonymous namespace)::Container>'
367 | _M_impl._M_end_of_storage - _M_impl._M_start);
| ~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_vector.h:526:7: note: in instantiation of member function 'std::_Vector_base<std::pair<QByteArray, (anonymous namespace)::Container>, std::allocator<std::pair<QByteArray, (anonymous namespace)::Container>>>::~_Vector_base' requested here
526 | vector() = default;
| ^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/type_traits:1240:60: note: in defaulted default constructor for 'std::vector<std::pair<QByteArray, (anonymous namespace)::Container>>' first required here
1240 | decltype(__helper<const _Tp&>({}))* = 0);
| ^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/type_traits:1249:24: note: while substituting deduced template arguments into function template '__test' [with _Tp = (anonymous namespace)::Container]
1249 | typedef decltype(__test(declval<_Tp>())) type;
| ^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/type_traits:1254:14: note: in instantiation of template class 'std::__is_implicitly_default_constructible_impl<(anonymous namespace)::Container>' requested here
1254 | : public __is_implicitly_default_constructible_impl<_Tp>::type
| ^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/type_traits:168:14: note: in instantiation of template class 'std::__is_implicitly_default_constructible_safe<(anonymous namespace)::Container>' requested here
168 | : public __conditional_t<_B1::value, _B2, _B1>
| ^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/type_traits:1259:14: note: (skipping 10 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all)
1259 | : public __and_<__is_constructible_impl<_Tp>,
| ^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_construct.h:193:30: note: in instantiation of function template specialization 'std::_Destroy_aux<false>::__destroy<(anonymous namespace)::Container *>' requested here
193 | return _Destroy_aux<false>::__destroy(__first, __last);
| ^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/alloc_traits.h:850:7: note: in instantiation of function template specialization 'std::_Destroy<(anonymous namespace)::Container *>' requested here
850 | _Destroy(__first, __last);
| ^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_vector.h:1932:11: note: in instantiation of function template specialization 'std::_Destroy<(anonymous namespace)::Container *, (anonymous namespace)::Container>' requested here
1932 | std::_Destroy(__pos, this->_M_impl._M_finish,
| ^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_vector.h:1601:9: note: in instantiation of member function 'std::vector<(anonymous namespace)::Container>::_M_erase_at_end' requested here
1601 | { _M_erase_at_end(this->_M_impl._M_start); }
| ^
../src/Json/Json_Parser.cpp:538:41: note: in instantiation of member function 'std::vector<(anonymous namespace)::Container>::clear' requested here
538 | void clear() { data.clear(); values.clear(); entries.clear(); typ = Null; }
| ^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_iterator.h:2593:12: note: definition of 'std::pair<QByteArray, (anonymous namespace)::Container>' is not complete until the closing '}'
2593 | struct pair;
| ^
1 error generated.
make: *** [Makefile:1563: Json_Parser.o] Error 1
make: *** Waiting for unfinished jobs....
make: Leaving directory '/tmp/Fulcrum/build' Where is musl here on debian 12? |
Hmm ok, so the |
^ This is a gcc C++ header, being used by clang. That can be problematic. Hmm. I think the problem is the qmakespec. You are picking the profile for clang + libstdc++ (gcc's c++ lib). That is known to be problematic. Change this line:
To:
And let me know what happens. |
Debian with /usr/bin/ld: App.o: in function `QString::toStdString() const':
App.cpp:(.text._ZNK7QString11toStdStringEv[_ZNK7QString11toStdStringEv]+0x1c): undefined reference to `QByteArray::toStdString() const'
/usr/bin/ld: App.o: in function `Exception::Exception(QString const&)':
App.cpp:(.text._ZN9ExceptionC2ERK7QString[_ZN9ExceptionC2ERK7QString]+0x20): undefined reference to `QByteArray::toStdString() const'
/usr/bin/ld: BTC_Address.o: in function `BTC::Address::fromString(QString const&)':
BTC_Address.cpp:(.text+0x5e5): undefined reference to `QByteArray::toStdString() const'
/usr/bin/ld: Controller.o: in function `Controller::startup()':
Controller.cpp:(.text+0xf15): undefined reference to `QByteArray::toStdString() const'
/usr/bin/ld: Controller.o: in function `Controller::on_coinDetected(BTC::Coin)':
Controller.cpp:(.text+0x2799): undefined reference to `QByteArray::toStdString() const'
/usr/bin/ld: Controller.o:Controller.cpp:(.text+0x858b): more undefined references to `QByteArray::toStdString() const' follow
/usr/bin/ld: Storage.o: in function `Storage::rocksdbVersion()':
Storage.cpp:(.text+0xe98): undefined reference to `rocksdb::GetRocksVersionAsString(bool)'
/usr/bin/ld: Storage.cpp:(.text+0xf02): undefined reference to `rocksdb::GetRocksBuildProperties()'
/usr/bin/ld: Storage.o: in function `Storage::startup()':
Storage.cpp:(.text+0x156b): undefined reference to `rocksdb::NewLRUCache(unsigned long, int, bool, double, std::__1::shared_ptr<rocksdb::MemoryAllocator>, bool, rocksdb::CacheMetadataChargePolicy, double)'
/usr/bin/ld: Storage.cpp:(.text+0x2682): undefined reference to `QByteArray::toStdString() const'
/usr/bin/ld: Storage.cpp:(.text+0x26cd): undefined reference to `rocksdb::DB::Open(rocksdb::Options const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, rocksdb::DB**)'
/usr/bin/ld: Storage.o: in function `Storage::loadCheckTxHash2TxNumMgr()':
Storage.cpp:(.text+0x7153): undefined reference to `rocksdb::Slice::ToString(bool) const'
/usr/bin/ld: Storage.o: in function `(anonymous namespace)::StatusString(rocksdb::Status const&)':
Storage.cpp:(.text+0x11a8e): undefined reference to `rocksdb::Status::ToString() const'
/usr/bin/ld: Storage.o: in function `Storage::gentlyCloseAllDBs()':
Storage.cpp:(.text+0x11d6a): undefined reference to `rocksdb::Status::ToString() const'
/usr/bin/ld: Storage.cpp:(.text+0x11eff): undefined reference to `rocksdb::Status::ToString() const'
/usr/bin/ld: Storage.cpp:(.text+0x12089): undefined reference to `rocksdb::Status::ToString() const'
/usr/bin/ld: Storage.o: in function `(anonymous namespace)::TxHash2TxNumMgr::rebuildDB()':
Storage.cpp:(.text+0x17b99): undefined reference to `rocksdb::Slice::ToString(bool) const'
/usr/bin/ld: Storage.cpp:(.text+0x17c03): undefined reference to `rocksdb::Slice::ToString(bool) const'
/usr/bin/ld: Storage.cpp:(.text+0x17ce4): undefined reference to `QByteArray::fromStdString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)'
/usr/bin/ld: Storage.cpp:(.text+0x17d22): undefined reference to `QByteArray::fromStdString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)'
/usr/bin/ld: Storage.cpp:(.text+0x18547): undefined reference to `rocksdb::Status::ToString() const'
/usr/bin/ld: Storage.cpp:(.text+0x18830): undefined reference to `rocksdb::Status::ToString() const'
/usr/bin/ld: Storage.o: in function `Storage::deleteRpaEntriesFromHeight(unsigned int, bool, bool)':
Storage.cpp:(.text+0x1ad61): undefined reference to `rocksdb::Status::ToString() const'
/usr/bin/ld: Storage.o: in function `Storage::deleteRpaEntriesToHeight(unsigned int, bool, bool)':
Storage.cpp:(.text+0x1b4c3): undefined reference to `rocksdb::Status::ToString() const'
/usr/bin/ld: Storage.o: in function `(anonymous namespace)::TxHash2TxNumMgr::insertForBlock(unsigned long, std::__1::vector<PreProcessedBlock::TxInfo, std::__1::allocator<PreProcessedBlock::TxInfo> > const&)':
Storage.cpp:(.text+0x23d83): undefined reference to `rocksdb::Status::ToString() const'
/usr/bin/ld: Storage.o:Storage.cpp:(.text+0x23e34): more undefined references to `rocksdb::Status::ToString() const' follow
/usr/bin/ld: Storage.o: in function `_ZNSt3__115allocate_sharedB8ne190104IN7rocksdb18WriteBufferManagerENS_9allocatorIS2_EEJmRNS_10shared_ptrINS1_5CacheEEEETnNS_9enable_ifIXntsr8is_arrayIT_EE5valueEiE4typeELi0EEENS5_ISA_EERKT0_DpOT1_':
Storage.cpp:(.text._ZNSt3__115allocate_sharedB8ne190104IN7rocksdb18WriteBufferManagerENS_9allocatorIS2_EEJmRNS_10shared_ptrINS1_5CacheEEEETnNS_9enable_ifIXntsr8is_arrayIT_EE5valueEiE4typeELi0EEENS5_ISA_EERKT0_DpOT1_[_ZNSt3__115allocate_sharedB8ne190104IN7rocksdb18WriteBufferManagerENS_9allocatorIS2_EEJmRNS_10shared_ptrINS1_5CacheEEEETnNS_9enable_ifIXntsr8is_arrayIT_EE5valueEiE4typeELi0EEENS5_ISA_EERKT0_DpOT1_]+0x65): undefined reference to `rocksdb::WriteBufferManager::WriteBufferManager(unsigned long, std::__1::shared_ptr<rocksdb::Cache>, bool)'
/usr/bin/ld: Storage.o: in function `rocksdb::Customizable::GetOptionsPtr(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const':
Storage.cpp:(.text._ZNK7rocksdb12Customizable13GetOptionsPtrERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE[_ZNK7rocksdb12Customizable13GetOptionsPtrERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE]+0xb): undefined reference to `rocksdb::Configurable::GetOptionsPtr(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const'
/usr/bin/ld: Storage.o:(.data.rel.ro+0x6c0): undefined reference to `rocksdb::Customizable::GetOption(rocksdb::ConfigOptions const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) const'
/usr/bin/ld: Storage.o:(.data.rel.ro+0x6c8): undefined reference to `rocksdb::Customizable::AreEquivalent(rocksdb::ConfigOptions const&, rocksdb::Configurable const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) const'
/usr/bin/ld: Storage.o:(.data.rel.ro+0x6f0): undefined reference to `rocksdb::Configurable::ParseStringOptions(rocksdb::ConfigOptions const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)'
/usr/bin/ld: Storage.o:(.data.rel.ro+0x6f8): undefined reference to `rocksdb::Configurable::ConfigureOptions(rocksdb::ConfigOptions const&, std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > > const&, std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > >*)'
/usr/bin/ld: Storage.o:(.data.rel.ro+0x700): undefined reference to `rocksdb::Configurable::ParseOption(rocksdb::ConfigOptions const&, rocksdb::OptionTypeInfo const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, void*)'
/usr/bin/ld: Storage.o:(.data.rel.ro+0x708): undefined reference to `rocksdb::Configurable::OptionsAreEqual(rocksdb::ConfigOptions const&, rocksdb::OptionTypeInfo const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, void const*, void const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) const'
/usr/bin/ld: Storage.o:(.data.rel.ro+0x710): undefined reference to `rocksdb::Customizable::SerializeOptions(rocksdb::ConfigOptions const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const'
/usr/bin/ld: Storage.o:(.data.rel.ro+0x718): undefined reference to `rocksdb::Customizable::GetOptionName(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const'
/usr/bin/ld: Storage.o:(.data.rel.ro+0x758): undefined reference to `rocksdb::AssociativeMergeOperator::PartialMerge(rocksdb::Slice const&, rocksdb::Slice const&, rocksdb::Slice const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, rocksdb::Logger*) const'
/usr/bin/ld: Storage.o:(.data.rel.ro+0x760): undefined reference to `rocksdb::MergeOperator::PartialMergeMulti(rocksdb::Slice const&, std::__1::deque<rocksdb::Slice, std::__1::allocator<rocksdb::Slice> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, rocksdb::Logger*) const'
/usr/bin/ld: ZmqSubNotifier.o: in function `ZmqSubNotifier::start(QString const&, QString const&, long)::$_0::operator()<std::__1::unique_ptr<std::__1::promise<bool>, std::__1::default_delete<std::__1::promise<bool> > > >(std::__1::unique_ptr<std::__1::promise<bool>, std::__1::default_delete<std::__1::promise<bool> > >) const::{lambda()#1}::operator()() const':
ZmqSubNotifier.cpp:(.text+0x214c): undefined reference to `QByteArray::toStdString() const'
/usr/bin/ld: ZmqSubNotifier.cpp:(.text+0x21cb): undefined reference to `QByteArray::toStdString() const'
/usr/bin/ld: register_MetaTypes.o: in function `bool QMetaType::registerConverter<QList<PeerInfo>, QIterable<QMetaSequence>, QtPrivate::QSequentialIterableConvertFunctor<QList<PeerInfo> > >(QtPrivate::QSequentialIterableConvertFunctor<QList<PeerInfo> >)':
register_MetaTypes.cpp:(.text._ZN9QMetaType17registerConverterI5QListI8PeerInfoE9QIterableI13QMetaSequenceEN9QtPrivate33QSequentialIterableConvertFunctorIS3_EEEEbT1_[_ZN9QMetaType17registerConverterI5QListI8PeerInfoE9QIterableI13QMetaSequenceEN9QtPrivate33QSequentialIterableConvertFunctorIS3_EEEEbT1_]+0x3a): undefined reference to `QMetaType::registerConverterFunction(std::__1::function<bool (void const*, void*)> const&, QMetaType, QMetaType)'
/usr/bin/ld: register_MetaTypes.o: in function `bool QMetaType::registerMutableView<QList<PeerInfo>, QIterable<QMetaSequence>, QtPrivate::QSequentialIterableMutableViewFunctor<QList<PeerInfo> > >(QtPrivate::QSequentialIterableMutableViewFunctor<QList<PeerInfo> >)':
register_MetaTypes.cpp:(.text._ZN9QMetaType19registerMutableViewI5QListI8PeerInfoE9QIterableI13QMetaSequenceEN9QtPrivate37QSequentialIterableMutableViewFunctorIS3_EEEEbT1_[_ZN9QMetaType19registerMutableViewI5QListI8PeerInfoE9QIterableI13QMetaSequenceEN9QtPrivate37QSequentialIterableMutableViewFunctorIS3_EEEEbT1_]+0x3a): undefined reference to `QMetaType::registerMutableViewFunction(std::__1::function<bool (void*, void*)> const&, QMetaType, QMetaType)'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:516: Fulcrum] Error 1
make: Leaving directory '/tmp/Fulcrum/build' |
This is a linking error. So.. it got to the link phase. At least it compiled! Looks like it's having trouble linking to Qt lib. You started from a fresh build dir, yes? Idk what to tell you man. This is not a problem with the Fulcrum codebase per se. This is some issue with linking to Qt and I don't have the time or energy to troubleshoot this further. Use gcc on Linux. Gcc these days is more feature-complete anyway. |
It also failed to link to rocksdb. . . idk sometimes C++ libs compiled with gcc don't play nice with clang. If you want to use clang looks like you either have to get to the bottom of this or rebuild the world with clang.. sorry. This is beyond my paygrade. |
Seems to be something related to an incomplete type being used in a standard library container, specifically
std::vector<std::pair<QByteArray, (anonymous namespace)::Container>>
located onsrc/Json/Json_Parser.cpp
.Compile just fine with
g++
with the same setup.System:
Compiling flags:
Dependencies:
Steps to reproduce:
Error:
The text was updated successfully, but these errors were encountered: