[Lldb-commits] [PATCH] D151570: Fix Build error on Mac M1 : error: use of undeclared identifier 'getopt_long_only'; did you mean 'getopt_long'?

2023-05-26 Thread Nicklas Boman via Phabricator via lldb-commits
smurfd created this revision.
smurfd added a reviewer: LLDB.
Herald added a subscriber: krytarowski.
Herald added a project: All.
smurfd requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

I got build error on ma m1
`lldb/source/Host/common/OptionParser.cpp:46:10: error: use of undeclared 
identifier 'getopt_long_only'; did you mean 'getopt_long'?`

this patch fixes that, two includes needed and also check if `__APPLE__`. after 
that building works.

Please set reviewers correct if its not correct, first patch


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151570

Files:
  lldb/include/lldb/Host/common/GetOptInc.h
  lldb/source/Host/common/OptionParser.cpp
  lldb/tools/lldb-server/lldb-platform.cpp


Index: lldb/tools/lldb-server/lldb-platform.cpp
===
--- lldb/tools/lldb-server/lldb-platform.cpp
+++ lldb/tools/lldb-server/lldb-platform.cpp
@@ -36,6 +36,7 @@
 #include "lldb/Host/common/TCPSocket.h"
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/Status.h"
+#include "lldb/Host/common/GetOptInc.h"
 
 using namespace lldb;
 using namespace lldb_private;
Index: lldb/source/Host/common/OptionParser.cpp
===
--- lldb/source/Host/common/OptionParser.cpp
+++ lldb/source/Host/common/OptionParser.cpp
@@ -10,7 +10,7 @@
 #include "lldb/Host/HostGetOpt.h"
 #include "lldb/Utility/OptionDefinition.h"
 #include "lldb/lldb-private-types.h"
-
+#include "lldb/Host/common/GetOptInc.h"
 #include 
 
 using namespace lldb_private;
Index: lldb/include/lldb/Host/common/GetOptInc.h
===
--- lldb/include/lldb/Host/common/GetOptInc.h
+++ lldb/include/lldb/Host/common/GetOptInc.h
@@ -15,7 +15,7 @@
 #define REPLACE_GETOPT
 #define REPLACE_GETOPT_LONG
 #endif
-#if defined(_MSC_VER) || defined(__NetBSD__)
+#if defined(_MSC_VER) || defined(__NetBSD__) || defined(__APPLE__)
 #define REPLACE_GETOPT_LONG_ONLY
 #endif
 


Index: lldb/tools/lldb-server/lldb-platform.cpp
===
--- lldb/tools/lldb-server/lldb-platform.cpp
+++ lldb/tools/lldb-server/lldb-platform.cpp
@@ -36,6 +36,7 @@
 #include "lldb/Host/common/TCPSocket.h"
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/Status.h"
+#include "lldb/Host/common/GetOptInc.h"
 
 using namespace lldb;
 using namespace lldb_private;
Index: lldb/source/Host/common/OptionParser.cpp
===
--- lldb/source/Host/common/OptionParser.cpp
+++ lldb/source/Host/common/OptionParser.cpp
@@ -10,7 +10,7 @@
 #include "lldb/Host/HostGetOpt.h"
 #include "lldb/Utility/OptionDefinition.h"
 #include "lldb/lldb-private-types.h"
-
+#include "lldb/Host/common/GetOptInc.h"
 #include 
 
 using namespace lldb_private;
Index: lldb/include/lldb/Host/common/GetOptInc.h
===
--- lldb/include/lldb/Host/common/GetOptInc.h
+++ lldb/include/lldb/Host/common/GetOptInc.h
@@ -15,7 +15,7 @@
 #define REPLACE_GETOPT
 #define REPLACE_GETOPT_LONG
 #endif
-#if defined(_MSC_VER) || defined(__NetBSD__)
+#if defined(_MSC_VER) || defined(__NetBSD__) || defined(__APPLE__)
 #define REPLACE_GETOPT_LONG_ONLY
 #endif
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D151570: Fix Build error on Mac M1 : error: use of undeclared identifier 'getopt_long_only'; did you mean 'getopt_long'?

2023-05-26 Thread Nicklas Boman via Phabricator via lldb-commits
smurfd added a comment.

Hey, yeah that compiles.
Im using the standard macos clang ,for Ventura 13.4, xcode 14.3

  $ gcc -v
  Apple clang version 14.0.3 (clang-1403.0.22.14.1)
  Target: arm64-apple-darwin22.5.0
  Thread model: posix
  InstalledDir: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

this is the way i built llvm from git main from 
`https://github.com/llvm/llvm-project`

  $ rm -rf build && mkdir build && cd build
  $ cmake 
-DLLVM_ENABLE_PROJECTS="bolt;clang;clang-tools-extra;compiler-rt;lld;lldb;mlir;openmp;polly;flang"
 -DCMAKE_BUILD_TYPE=Release 
-DCMAKE_CXX_FLAGS="-D_GLIBCXX_HAVE_ENOTRECOVERABLE=1 -DENOTRECOVERABLE=98" -G 
"Unix Makefiles" -DCMAKE_INSTALL_PREFIX=$HOME/code/.build/llvm-dev -Bbuild 
-DLLVM_ENABLE_RUNTIMES="libunwind;libcxxabi;pstl;libcxx" ../llvm
  $ make -j8 -Cbuild

after the error i apply this patch and the build finishes.

im using this checkout : dd16cd731dfb4746a351380edc848199cf9631e8 
 (have 
also now tried main at the time of writing : 
a419ec4f256d279c91746a3962dd6dd2da45c304 
) with the 
same error

  [ 65%] Built target llvm-tapi-diff
  [ 65%] Building CXX object 
lib/DebugInfo/PDB/CMakeFiles/LLVMDebugInfoPDB.dir/PDB.cpp.o
  
/Users/hellbeard/code/_misc/llvm-project/lldb/source/Host/common/OptionParser.cpp:46:10:
 error: use of undeclared identifier 'getopt_long_only'; did you mean 
'getopt_long'?
return getopt_long_only(argv.size() - 1, argv.data(), opt_cstr.c_str(),
   ^~~~
   getopt_long
  /opt/pkg/include/getopt.h:62:5: note: 'getopt_long' declared here
  int getopt_long(int, char * const *, const char *,
  ^
  1 error generated.
  make[2]: *** 
[tools/lldb/source/Host/CMakeFiles/lldbHost.dir/common/OptionParser.cpp.o] 
Error 1
  make[2]: *** Waiting for unfinished jobs


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151570/new/

https://reviews.llvm.org/D151570

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D151570: Fix Build error on Mac M1 : error: use of undeclared identifier 'getopt_long_only'; did you mean 'getopt_long'?

2023-06-02 Thread Nicklas Boman via Phabricator via lldb-commits
smurfd abandoned this revision.
smurfd added a comment.

Hey, sorry for wasting your time with this. Should have read the error message 
more carefully.
Its related to `pkgsrc` missing `getopt_long_only()` in `getopt.h`
Checking/filing a bug towards them instead


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151570/new/

https://reviews.llvm.org/D151570

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits