Open TheWorldOfCode opened 5 months ago
@TheWorldOfCode
TL;DR: Add this to your command line --add-compile-flag "-DBOOST_UUID_NO_SIMD"
Full explanation:
I've managed to reproduce your issue on Ubuntu Jammy
❯ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.4 LTS
Release: 22.04
Codename: jammy
with the following project:
#include <QCoreApplication>
#include <boost/uuid/uuid.hpp>
namespace my_app {
struct A {};
struct B : public A {};
}
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
boost::uuids::uuid tag;
return a.exec();
}
cmake_minimum_required(VERSION 3.14)
project(issue282 LANGUAGES CXX)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core)
FIND_PACKAGE(Boost REQUIRED)
add_executable(issue282
main.cpp
)
target_link_libraries(issue282 Qt${QT_VERSION_MAJOR}::Core)
target_include_directories(issue282 PUBLIC ${Boost_INCLUDE_DIRS})
include(GNUInstallDirs)
install(TARGETS issue282
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
compilation_database_dir: build
output_directory: docs/diagrams
diagrams:
my_app_class_diagram:
type: class
glob:
- "*.cpp"
using_namespace:
- my_app
exclude:
namespaces:
- std
Then when I ran clang-uml like this:
clang-uml -vvv
it worked. However if I added:
clang-uml -vvv --query-driver .
I was getting the same errors as you. The --query-driver .
basically automates what you did by adding your flags manually. This however, forces Clang to use GCC headers, where it fails to parse some internal headers related to SSE and SIMD low level operations.
Fortunately using these low level optimizations can be disabled in Boost, like this (of course this will not affect your actual build - only diagram generation):
clang-uml -vvv --add-compile-flag "-DBOOST_UUID_NO_SIMD"
You can also try to remove the include flags you added manually from the config and just run:
clang-uml -vvv --query-driver . --add-compile-flag "-DBOOST_UUID_NO_SIMD"
With the latter on my system I get the diagram:
@startuml
class "A" as C_0001961966708590071804
class C_0001961966708590071804 {
__
+tag : boost::uuids::uuid
}
class "B" as C_0000521024381453213179
class C_0000521024381453213179 {
__
}
C_0001961966708590071804 <|-- C_0000521024381453213179
'Generated with clang-uml, version 0.5.2-31-ge21c2d2
'LLVM version Ubuntu clang version 17.0.6 (++20231209124227+6009708b4367-1~exp1~20231209124336.77)
@enduml
If this doesn't help please share if possible a sample entry from your compile_commands.json
maybe I'll notice sth...
Many thanks for the fast response. Unfortunately, it didn't solve the issue.
I have appended the compile_commands.json
as requested.
I have done some additional tests if I add the option --add-compile-flag '-mno-sse'
.
compile_commands.json
Adding the compile flag solves the issue with xmmintrin.h
, but now it is complaining about std::nullopt
.
/home/user/workspace/ropca/external_libraries/robotics/include/robotics/hardware/kuka/actions/types/motion.h:30:89: error: no viable conversion from 'const std::nullopt_t' to 'int'
const std::optional<BoundedValue<float, 0.0f, 1.0f>> blendingRel = std::nullopt, const std::optional<float> blendingCart = std::nullopt,
@TheWorldOfCode That I cannot reproduce - if possible you could try to install newer LLVM (e.g. 17) and rebuild clang-uml
using:
LLVM_VERSION=17 make release
and then try with both --add-compile-flag '-mno-sse'
and --query-driver .
...
@TheWorldOfCode Also, are you able to reproduce the problem using the above simple project, for instance by modifying the main.cpp
:
#include <QCoreApplication>
#include <boost/uuid/uuid.hpp>
#include <optional>
namespace my_app {
struct AAA {};
struct A {
boost::uuids::uuid tag;
void foo(const std::optional<AAA> arg1 = std::nullopt) {
}
};
struct B : public A {};
} // namespace my_app
int main(int argc, char *argv[]) {
QCoreApplication a(argc, argv);
return a.exec();
}
?
Hello
Clang UML is a great tool and I have been using it for a couple of years on work-related projects. We have just updated from Ubuntu Focal to Ubuntu Jammy.
On Ubuntu Jammy it complaining that it cannot locate cstddef when processing boost/uuid/uuid.hpp. When I attempt to solve the issue new errors are generated.
--add-compile-flag '-I/usr/include/c++/11'
--add-compile-flag '-I/usr/include/x86_64-linux-gnu/c++/11'
--add-compile-flag '-I/usr/lib/gcc/x86_64-linux-gnu/11/include
Clang - UML
Configuration dump