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

Nicklas Boman via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri May 26 09:51:01 PDT 2023


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 <vector>
 
 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
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151570.526099.patch
Type: text/x-patch
Size: 1314 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230526/7e1854a4/attachment.bin>


More information about the lldb-commits mailing list