dswl Posted August 8, 2017 Report Posted August 8, 2017 I’m still trying to get one of the demos to work on OS X. Unfortunately I get a duplicate symbol error, but strangely for just one file. duplicate symbol _main in: .build/obj/GFXLIB/demos/modules/gdisp/basics/main.o ld: 1 duplicate symbol for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [.build/demotest.elf] Error 1 The linking ultimately fails. There is no other file than the modified example makefile from `ugfx/boards/base/OSX/example` in the project folder: No second main.c or any other custom file I wrote containing the main symbol. The C compiler options: C Compiler Options.... gcc -c -L/usr/local/lib -lSDL2 -I/usr/local/include/SDL2 -D_THREAD_SAFE -I/usr/local/include/SDL2 -D_THREAD_SAFE -ggdb -O0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.11 -m64 -fomit-frame-pointer -Wall -Wextra -Wstrict-prototypes -fverbose-asm -MMD -MP -MF .build/dep/fakefile.o.d -I. -I../ugfx/demos/modules/gdisp/basics -I../ugfx -I../ugfx/3rdparty/tinygl-0.4-ugfx/include -I../ugfx/boards/base/OSX -I../ugfx/drivers/multiple/SDL -I../ugfx/demos/modules/gdisp/basics -DGFX_USE_OS_OSX=TRUE -DGFX_OS_PRE_INIT_FUNCTION=sdl_driver_init fakefile.c -o .build/obj/fakefile.o The linker command: Linker Options........ gcc -L/usr/local/lib -lSDL2 -I/usr/local/include/SDL2 -D_THREAD_SAFE -pthread -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.11 -m64 -nostartfiles .build/obj/fakefile.o -o .build/demotest.elf I modified the example makefile from `ugfx/boards/base/OSX/example` as follows: # Possible Targets: all clean Debug cleanDebug Release cleanRelease ############################################################################################## # Settings # # General settings # See $(GFXLIB)/tools/gmake_scripts/readme.txt for the list of variables OPT_OS = osx64 OPT_LINK_OPTIMIZE = no # uGFX settings # See $(GFXLIB)/tools/gmake_scripts/library_ugfx.mk for the list of variables GFXLIB = ../ugfx GFXBOARD = OSX GFXDEMO = modules/gdisp/basics # OSX settings # See $(GFXLIB)/tools/gmake_scripts/os_osx.mk for the list of variables OSX_SDK = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk OSX_ARCH = -mmacosx-version-min=10.11 ############################################################################################## # Set these for your project # ARCH = SRCFLAGS = -ggdb -O0 CFLAGS = `sdl2-config --libs --cflags` CXXFLAGS = ASFLAGS = LDFLAGS = SRC = OBJS = DEFS = LIBS = INCPATH = LIBPATH = ############################################################################################## # These should be at the end # include $(GFXLIB)/demos/modules/gwin/widgets/demo.mk include $(GFXLIB)/tools/gmake_scripts/library_ugfx.mk include $(GFXLIB)/tools/gmake_scripts/os_$(OPT_OS).mk include $(GFXLIB)/tools/gmake_scripts/compiler_gcc.mk # *** EOF *** I use uGFX 2.7 on OS X 10.11.6. I appreciate any help pointing me out to what I'm doing wrong. Regards
cpu20 Posted August 8, 2017 Report Posted August 8, 2017 You are compiling two demos at once in your Makefile: GFXDEMO = modules/gdisp/basics include $(GFXLIB)/demos/modules/gwin/widgets/demo.mk The best way to include the demo is by using GFXDEMO. Most likely the widgets demo is a leftover here you forgot to delete.
dswl Posted August 9, 2017 Author Report Posted August 9, 2017 Thank you for pointing this out. The GFXDEMO variable was totally out of my view...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now