Jump to content

Problem building uGFX on Mac for x86_64


Recommended Posts

Posted

I am trying to build uGFX on my mac book pro, running MacOS Sierra - just to get the demos running.

I copied the Makefile from  ./boards/base/OSX/example/Makefile

The problem: the make is trying to build for i386 and so ignores my SDL2 lib which is built for x86_64.

Question:  how to setup the Make to build this as x86_64 architecture on my mac?

linker warning:

ld: warning: ignoring file /usr/local/lib/libSDL2.dylib, file was built for x86_64 which is not the architecture being linked (i386): /usr/local/lib/libSDL2.dylib

The linker command: Notice the insertion of -m32 near the end by make:

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.12 -m32 .build/obj/fakefile.o -o .build/ugfxTest

 

The Makefile settings
(I've tried CFLAGS and LDFLAG for `-arch m_64` but it has no effect.

##############################################################################################
# Settings
#

# General settings
       # See $(GFXLIB)/tools/gmake_scripts/readme.txt for the list of variables
       OPT_OS                                  = osx
       OPT_LINK_OPTIMIZE               = no

# uGFX settings
       # See $(GFXLIB)/tools/gmake_scripts/library_ugfx.mk for the list of variables
       GFXLIB                                  = /Users/jeff/Code/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.12

##############################################################################################
# Set these for your project
#

ARCH     =
SRCFLAGS = -ggdb -O0
CFLAGS   = `sdl2-config --libs --cflags`
CXXFLAGS =
ASFLAGS  =
LDFLAGS  =

SRC      =
OBJS     =
DEFS     =
LIBS     =
INCPATH  =
LIBPATH  =

##############################################################################################

 

Posted

Hello @jkraptor,

Unfortunately I won't be able to test this as I won't have access to a Mac until the coming Monday. I guess the quick solution is to use SDL2 32-bit as that is what we used ourselves for testing. Other than that I'm not sure whether simply changing the OPT_CPU value in the OS X / MacOS makefile is going to do the trick (in the file /tools/gmake_scripts/os_osx.mk).
Maybe @inmarket has something more helpful to say right.

Posted (edited)

Ha! That was it! It builds now and runs.
Just had to make this change in the os_osx.mk file

OPT_CPU = x64

Thanks Joel.

(by the way)
in gdriver.h, line 90, there are two const declarations in the same line, which the gcc compiler on the mac is not happy with.
just generates a warning).
Same issue on gdisp_driver.h, line 735.

Edited by jkraptor
Posted

64 bit compiling is not yet officially supported however the code has been carefully written and should be mostly compatible as you have found out.

Rather than change the existing os_osx.mk let me suggest that you create a new file os_osx64.mk. That would then get used by specifying OPT_OS=osx64 in your makefile.

After testing if you could submit the new file to us we can then add it as a supported platform.

With regard to the double const, our code is actually correct. The warning message comes because gcc (and quite a number of other compilers) actually misunderstand the differences between a const pointer and a const structure. Ie they misunderstand the c standard (no flames here please).

In practice it makes no difference as gcc implements it the way we want it to work despite issuing the warning.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...