Open watkinsr opened 5 years ago
updating rct code can fix build on openbsd..
@cslux , attaching local diff from rct submodule. Feedback or improvements are welcome. ig wordexp can be dropped in favour of glob, that will be a bit cleaner diff for openbsd and other platforms as well.
diff --git a/rct/Log.h b/rct/Log.h
index 4b2453a..3de7bcb 100644
--- a/rct/Log.h
+++ b/rct/Log.h
@@ -141,7 +141,7 @@ public:
Log(LogLevel level = LogLevel::Error, Flags<LogOutput::LogFlag> flags = LogOutput::DefaultFlags);
Log(const Log &other);
Log &operator=(const Log &other);
-#if defined(OS_Darwin)
+#if defined(OS_Darwin) || defined(__OpenBSD__)
#ifndef __i386__
Log operator<<(long number) { return addStringStream(number); }
#endif
diff --git a/rct/MemoryMonitor.cpp b/rct/MemoryMonitor.cpp
index 543d6aa..b0b6a0a 100644
--- a/rct/MemoryMonitor.cpp
+++ b/rct/MemoryMonitor.cpp
@@ -69,6 +69,12 @@ static inline uint64_t usageFreeBSD()
#warning "implement me"
return 0;
}
+#elif (__OpenBSD__)
+static inline uint64_t usageOpenBSD()
+{
+#warning "implement me"
+ return 0;
+}
#elif defined(OS_DragonFly)
static inline uint64_t usageDragonFly()
{
@@ -122,6 +128,8 @@ uint64_t MemoryMonitor::usage()
return usageLinux();
#elif defined(OS_FreeBSD)
return usageFreeBSD();
+#elif defined(__OpenBSD__)
+ return usageOpenBSD();
#elif defined(OS_DragonFly)
return usageDragonFly();
#elif defined(OS_Darwin)
diff --git a/rct/Path.cpp b/rct/Path.cpp
index 9b00914..708f2bd 100644
--- a/rct/Path.cpp
+++ b/rct/Path.cpp
@@ -7,8 +7,10 @@
# include <Windows.h>
# include <Shellapi.h>
# include "WindowsUnicodeConversion.h"
+#elif defined(__OpenBSD__)
+#include <glob.h>
#else
-# include <wordexp.h>
+ #include <wordexp.h>
#endif
#include <limits.h>
#include <stdio.h>
@@ -262,14 +264,23 @@ bool Path::resolve(ResolveMode mode, const Path &cwd, bool *changed)
if (isEmpty())
return false;
if (startsWith('~')) {
+
+#elif defined(__OpenBSD__)
+ glob_t exp_result;
+ if (glob(constData(), 0, NULL, &exp_result) == false) {
+ operator=(exp_result.gl_pathv[0]);
+ if (changed)
+ *changed = true;
+ }
+#else
wordexp_t exp_result;
wordexp(constData(), &exp_result, 0);
operator=(exp_result.we_wordv[0]);
wordfree(&exp_result);
if (changed)
*changed = true;
- }
#endif
+ }
if (*this == ".")
clear();
if (mode == MakeAbsolute || !sRealPathEnabled) {
Hey @rkanavath! Looks good to me! Could you create a PR on the rct project, please?
Thanks, Christian
@rkanavath
wordexp can be dropped in favour of glob,
Can you do that? Or just create an issue on the rct project?
Thanks, Christian
@cslux done in in https://github.com/Andersbakken/rct/pull/80.
you might need to update git tag on submodule once that pr is merged.
I cannot compile it on OpenBSD -current (6.8) :
prometeo ~/Documents/projects/rtags> cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 .
-- The C compiler identification is Clang 10.0.1
-- The CXX compiler identification is Clang 10.0.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- llvm-config executable found: /usr/bin/llvm-config
-- Using Clang version 10.0.1 from /usr/lib with CXXFLAGS -I/usr/include -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-- Found LibClang: /usr/local/lib/libclang.so.8.1
-- Performing Test LIBCLANG_COMPILES
-- Performing Test LIBCLANG_COMPILES - Failed
CMake Error at src/CMakeLists.txt:103 (message):
Failed to compile small clang test app.
It's likely that the include file <clang-c/Index.h> could not be found!
Maybe you need to install the clang development package (delete the CMakeCache.txt file before trying to run cmake again after installation)?
See CMakeFiles/CMakeError.log for more info.
-- Configuring incomplete, errors occurred! See also "/home/josefig/Documents/projects/rtags/CMakeFiles/CMakeOutput.log". See also "/home/josefig/Documents/projects/rtags/CMakeFiles/CMakeError.log".
I cannot compile it on OpenBSD -current (6.8) :
prometeo ~/Documents/projects/rtags> cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 . -- The C compiler identification is Clang 10.0.1 -- The CXX compiler identification is Clang 10.0.1 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- llvm-config executable found: /usr/bin/llvm-config -- Using Clang version 10.0.1 from /usr/lib with CXXFLAGS -I/usr/include -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -- Found LibClang: /usr/local/lib/libclang.so.8.1 -- Performing Test LIBCLANG_COMPILES -- Performing Test LIBCLANG_COMPILES - Failed CMake Error at src/CMakeLists.txt:103 (message): Failed to compile small clang test app.
It's likely that the include file <clang-c/Index.h> could not be found!
Maybe you need to install the clang development package (delete the CMakeCache.txt file before trying to run cmake again after installation)?
See CMakeFiles/CMakeError.log for more info.
-- Configuring incomplete, errors occurred! See also "/home/josefig/Documents/projects/rtags/CMakeFiles/CMakeOutput.log". See also "/home/josefig/Documents/projects/rtags/CMakeFiles/CMakeError.log".
Sorry, my problem was the include path, now it worked. Thanks!
Describe the bug Rtags fails to build on OpenBSD.
To Reproduce Steps to reproduce the behavior: Do: git clone --recursive https://github.com/Andersbakken/rtags.git cd rtags cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 . make
Expected behavior rtags to build successfully.
Screenshots/Backtrace [ 1%] Built target emacs_byte_compile_ac-rtags.el [ 1%] Built target emacs_byte_compile_rtags.el [ 2%] Built target emacs_byte_compile_flycheck-rtags.el [ 3%] Built target emacs_byte_compile_ivy-rtags.el [ 4%] Built target emacs_byte_compile_helm-rtags.el [ 5%] Building CXX object src/CMakeFiles/rtags.dir/ClangIndexer.cpp.o In file included from /home/ryan/rtags/src/ClangIndexer.cpp:17: In file included from /home/ryan/rtags/src/ClangIndexer.h:20: In file included from /home/ryan/rtags/src/Token.h:19: In file included from /home/ryan/rtags/src/rct/rct/Serializer.h:14: /home/ryan/rtags/src/rct/rct/Log.h:156:9: error: class member cannot be redeclared Log operator<<(unsigned long long number) { return addStringStream(number); } ^ /home/ryan/rtags/src/rct/rct/Log.h:150:9: note: previous definition is here Log operator<<(uint64_t number) { return addStringStream(number); } ^ /home/ryan/rtags/src/rct/rct/Log.h:157:9: error: class member cannot be redeclared Log operator<<(long long number) { return addStringStream(number); } ^ /home/ryan/rtags/src/rct/rct/Log.h:151:9: note: previous definition is here Log operator<<(int64_t number) { return addStringStream(number); } ^ /home/ryan/rtags/src/ClangIndexer.cpp:2102:36: error: use of overloaded operator '<<' is ambiguous (with operand types 'Log' and 'size_t' (aka 'unsigned long')) << "targets" << it->second->targets.size()