[Lldb-commits] [lldb] r234949 - MacOSX needs a space between $(ARCHFLAG) and $(ARCH) otherwise we try to call clang with "-archx86_64" which doesn't work.

Greg Clayton gclayton at apple.com
Wed Apr 15 18:22:33 PDT 2015


My fix below just adds a space for Darwin and leaves them like they were for other platforms. Someone with better makefile abilities might be able to make a better fix, but using "-arch " as the ARCHFLAG doesn't work.


% svn diff
Index: make/Makefile.rules
===================================================================
--- make/Makefile.rules	(revision 235064)
+++ make/Makefile.rules	(working copy)
@@ -75,7 +75,7 @@
 # ARCHFLAG is the flag used to tell the compiler which architecture
 # to compile for. The default is the flag that clang accepts.
 #----------------------------------------------------------------------
-ARCHFLAG ?= "-arch "
+ARCHFLAG ?= -arch
 
 #----------------------------------------------------------------------
 # Change any build/tool options needed
@@ -127,11 +127,19 @@
 endif
 
 CFLAGS ?= -g -O0
-CFLAGS += $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) -I$(LLDB_BASE_DIR)include
+ifeq "$(OS)" "Darwin"
+	CFLAGS += $(ARCHFLAG) $(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) -I$(LLDB_BASE_DIR)include
+else
+	CFLAGS += $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) -I$(LLDB_BASE_DIR)include
+endif
 CFLAGS += -include $(THIS_FILE_DIR)test_common.h
 
 # Use this one if you want to build one part of the result without debug information:
-CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS)
+ifeq "$(OS)" "Darwin"
+	CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG) $(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS)
+else
+	CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS)
+endif
 
 CXXFLAGS += -std=c++11
 CXXFLAGS += $(CFLAGS)
% svn commit
Sending        make/Makefile.rules
Transmitting file data .
Committed revision 235065.


> On Apr 15, 2015, at 6:13 PM, Greg Clayton <gclayton at apple.com> wrote:
> 
> This doesn't work:
> 
> stdout: clang -g -O0 "-arch "x86_64   -I/Volumes/work/gclayton/Documents/src/lldb/trunk/test/make/../../include -include /Volumes/work/gclayton/Documents/src/lldb/trunk/test/make/test_common.h   -c -o const-strings.o const-strings.m
> 
> As this produce a single argument whose value os "-arch x86_64":
> 
> stderr: clang: warning: argument unused during compilation: '-arch x86_64'
> 
>> On Apr 15, 2015, at 2:34 AM, Tamas Berghammer <tberghammer at google.com> wrote:
>> 
>> I committed in the fix suggested by Siva as r234949. Please feel free to update it with a cleaner solution if you know one.
>> 
>> Tamas
>> 
>> On Wed, Apr 15, 2015 at 1:37 AM, Zachary Turner <zturner at google.com> wrote:
>> Will break Windows too fwiw as windows uses clang for compiling
>> 
>> On Tue, Apr 14, 2015 at 5:32 PM Siva Chandra <sivachandra at google.com> wrote:
>> On Tue, Apr 14, 2015 at 3:08 PM, Greg Clayton <gclayton at apple.com> wrote:
>>> Author: gclayton
>>> Date: Tue Apr 14 17:08:17 2015
>>> New Revision: 234949
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=234949&view=rev
>>> Log:
>>> MacOSX needs a space between $(ARCHFLAG) and $(ARCH) otherwise we try to call clang with "-archx86_64" which doesn't work.
>>> 
>>> 
>>> Modified:
>>>    lldb/trunk/test/make/Makefile.rules
>>> 
>>> Modified: lldb/trunk/test/make/Makefile.rules
>>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/make/Makefile.rules?rev=234949&r1=234948&r2=234949&view=diff
>>> ==============================================================================
>>> --- lldb/trunk/test/make/Makefile.rules (original)
>>> +++ lldb/trunk/test/make/Makefile.rules Tue Apr 14 17:08:17 2015
>>> @@ -117,11 +117,11 @@ else
>>> endif
>>> 
>>> CFLAGS ?= -g -O0
>>> -CFLAGS += $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) -I$(LLDB_BASE_DIR)include
>>> +CFLAGS += $(ARCHFLAG) $(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) -I$(LLDB_BASE_DIR)include
>> 
>> This breaks linux as the arch flags now become "-m 32" or "-m 64"
>> which clang or GCC will not accept. How about making ARCHFLAG ?=
>> "-arch " on line 68?
>> 
>>> CFLAGS += -include $(THIS_FILE_DIR)test_common.h
>>> 
>>> # Use this one if you want to build one part of the result without debug information:
>>> -CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS)
>>> +CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG) $(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS)
>>> 
>>> CXXFLAGS += -std=c++11
>>> CXXFLAGS += $(CFLAGS)
>>> 
>>> 
>>> _______________________________________________
>>> lldb-commits mailing list
>>> lldb-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>> _______________________________________________
>> lldb-commits mailing list
>> lldb-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>> 
>> _______________________________________________
>> lldb-commits mailing list
>> lldb-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>> 
>> 
> 
> 
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits





More information about the lldb-commits mailing list