Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ZebraineZ

macrumors 6502
Original poster
Mar 17, 2009
354
0
It was easy to do (though I can't think off the top of my head at this moment..) in XCode 3, and I got XCode 4 now.

I tried doing it, with the external build system and external target, and then I added files to the project and I went and pressed build and it basically gives one error saying there is no target or makefile or something...idk why it says that, I do the same exact thing I basically did in XCode 3 and it doesn't seem to get anywhere.
 
Last edited:
Did you add the makefile to the project? I can compile an external build system project in Xcode 4 if I add a makefile to the project and give it the name makefile.
 
NVM I got it done. But I still get these errors I got a long time ago...

This same error happened in 73 files.

Code:
src/elements/yest.c:1: error: bad value (native) for -march= switch
src/elements/yest.c:1: error: bad value (native) for -mtune= switch

Now I don't really know what the problem is....since it compiles fine through the command line, but with XCode I get these. From the command line it uses 4.2.1 gcc (which I'm assuming is the new one that came with XCode), but for XCode I don't know how to change the compiler or see what compiler it's using, it was easy to do in XCode 3 but not anymore.

Here is the makefile

Code:
SOURCES := src/*.c src/elements/*.c

PY_BIN := python
PY_VERSION := $(shell $(PY_BIN) -c "import sys;print sys.version[:3]")
PY_LIBPATH := $(shell $(PY_BIN) -c "import os.path,sys;print os.path.join(sys.exec_prefix,\"lib\",\"python%s\"%sys.version[:3],\"config\")")
PY_INCPATH := $(shell $(PY_BIN) -c "import os.path,sys;print os.path.join(sys.exec_prefix,\"include\",\"python%s\"%sys.version[:3])")
PY_LDFLAGS := $(shell $(PY_BIN) -c "import distutils.sysconfig;print distutils.sysconfig.get_config_var('LINKFORSHARED')")
PYCOMMAND := $(PY_BIN) getheader.py

CFLAGS := -w -std=c99 -D_POSIX_C_SOURCE=200112L -Iincludes/ 
OFLAGS := -O3 -ffast-math -ftree-vectorize -funsafe-math-optimizations
LFLAGS := -lSDL -lm -lbz2 -lutil -lpython$(PY_VERSION) -L$(PY_LIBPATH) -I$(PY_INCPATH) $(PY_LDFLAGS)
LFLAGS_X := -lm -lbz2 -lSDLmain -I/Library/Frameworks/Python.framework/Versions/$(PY_VERSION)/include/python$(PY_VERSION)
MFLAGS_SSE3 := -march=native -DX86 -DX86_SSE3 -msse3
MFLAGS_SSE2 := -march=native -DX86 -DX86_SSE2 -msse2
MFLAGS_SSE := -march=native -DX86 -DX86_SSE
FLAGS_DBUG := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L -pg -DX86 -DX86_SSE3 -msse3 -g
COMPILER := gcc
LINUX_TARG := powder-64-sse2 powder-sse powder-sse2
WIN32_TARG := powder-sse.exe powder-sse2.exe

powder: $(SOURCES)
	$(PYCOMMAND)
	$(COMPILER) -DINTERNAL -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE3) $(SOURCES) $(LFLAGS) -DLIN64
	mv $@ build
powder-debug-64: $(SOURCES)
	$(PYCOMMAND)
	$(COMPILER) -m64 -o$@ $(FLAGS_DBUG) -DLIN64 $(SOURCES) -Iincludes/ $(LFLAGS)
	mv $@ build
powder-debug: $(SOURCES)
	$(PYCOMMAND)
	$(COMPILER) -DINTERNAL -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE3) $(SOURCES) $(LFLAGS) -DLIN64 $(FLAGS_DBUG)
	mv $@ build
powder-sse3: $(SOURCES)
	$(PYCOMMAND)
	$(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE3) $(SOURCES) $(LFLAGS) -DLIN32
	strip $@
	mv $@ build
powder-sse2: $(SOURCES)
	$(PYCOMMAND)
	$(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE2) $(SOURCES) $(LFLAGS) -DLIN32
	strip $@
	mv $@ build
powder-sse: $(SOURCES)
	$(PYCOMMAND)
	$(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE) $(SOURCES) $(LFLAGS) -DLIN32
	strip $@
	mv $@ build
powder-64-sse3-opengl: $(SOURCES)
	$(PYCOMMAND)
	$(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE3) $(SOURCES) $(LFLAGS) -DLIN64 -lGL -lGLU -DOpenGL
	strip $@
	mv $@ build
powder-64-sse3: $(SOURCES)
	$(PYCOMMAND)
	$(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE3) $(SOURCES) $(LFLAGS) -DLIN64
	strip $@
	mv $@ build
powder-64-sse2: $(SOURCES)
	$(PYCOMMAND)
	$(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE2) $(SOURCES) $(LFLAGS) -DLIN64
	strip $@
	mv $@ build

powder-icc: $(SOURCES)
	/opt/intel/Compiler/11.1/073/bin/intel64/icc -m64 -o$@ -Iincludes/ -O2 -march=core2 -msse3 -mfpmath=sse -lSDL -lbz2 -lm -xW $(SOURCES) -std=c99 -D_POSIX_C_SOURCE=200112L

powder-res.o: powder-res.rc powder.ico
	i586-mingw32msvc-windres powder-res.rc powder-res.o

powder-sse3.exe: $(SOURCES) powder-res.o
	$(PYCOMMAND)
	i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE3) $(SOURCES) powder-res.o -lmingw32 -llibregex -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32
	strip $@
	chmod 0644 $@
	mv $@ build
powder-sse2.exe: $(SOURCES) powder-res.o
	$(PYCOMMAND)
	i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE2) $(SOURCES) powder-res.o -lmingw32 -llibregex -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32
	strip $@
	chmod 0644 $@
	mv $@ build
powder-sse.exe: $(SOURCES) powder-res.o
	$(PYCOMMAND)
	i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE) $(SOURCES) powder-res.o -lmingw32 -llibregex -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32
	strip $@
	chmod 0644 $@
	mv $@ build
powder-x: $(SOURCES)
	$(PYCOMMAND) --64bit
	gcc -o $@ $(CFLAGS) $(OFLAGS) $(LFLAGS_X) $(MFLAGS) $(SOURCES) -DMACOSX -DPIX32BGRA -arch x86_64 -framework Cocoa -framework SDL -framework Python
	strip $@ 
	mv $@ build
powder-x-ogl: $(SOURCES)
	$(PYCOMMAND) --64bit
	gcc -o $@ $(CFLAGS) $(OFLAGS) $(LFLAGS_X) $(MFLAGS) $(SOURCES) -DOpenGL -DMACOSX -DPIX32BGRA -arch x86_64 -framework Cocoa -framework SDL -framework OpenGL -framework Python
	strip $@ 
	mv $@ build

Powder-X is the one that should be compiling for OS X. Since it works fine in command line like I said, I don't know what the problem is then..
 
For an external build system project, Xcode initially sets the compiler version to Clang LLVM 1.0. To change the compiler version for the project,

  1. Select the project file from the project navigator to open the project settings editor.
  2. Select the target from the project settings editor.
  3. Click the Build Settings button at the top of the editor.
  4. Change the GCC_VERSION build setting.
If you want to see what Xcode is doing when it builds your project, open the log navigator by choosing View > Navigators > Log. Select the build from the log navigator to open the build results window. In the build results window there should be a step called Run external build tool. Since you're getting build errors, this step should have an error icon with the number of errors. Next to the number of errors is a tiny button with little horizontal lines. Click that button to open the build transcript, which shows you everything Xcode does when it builds the project.
 
For an external build system project, Xcode initially sets the compiler version to Clang LLVM 1.0. To change the compiler version for the project,

  1. Select the project file from the project navigator to open the project settings editor.
  2. Select the target from the project settings editor.
  3. Click the Build Settings button at the top of the editor.
  4. Change the GCC_VERSION build setting.
If you want to see what Xcode is doing when it builds your project, open the log navigator by choosing View > Navigators > Log. Select the build from the log navigator to open the build results window. In the build results window there should be a step called Run external build tool. Since you're getting build errors, this step should have an error icon with the number of errors. Next to the number of errors is a tiny button with little horizontal lines. Click that button to open the build transcript, which shows you everything Xcode does when it builds the project.


And what do I change the compiler version to exactly? It doesn't have a menu to select from, you need to input it manually unlike XCode 3...What do I need to type to make it use gcc? Just typing in GCC doesn't do me justice.

Edit: After a ton of googling I found this in someones log results lol

Code:
com.apple.compilers.gcc.4_2

so I assumed it was how to use gcc in XCode with that whole geeky dohicky way, and it didn't have a problem this time using the compiler, but still gave the error...
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.