iPhone.sdk

Previous topic - Next topic

marovada

Is iphone-sdk-4.1 packaged with GLBasic? 

There is a reference to -isysroot"%CYG_GLBASIC%Compiler/platform/iPhone/iphone-sdk-4.1 in the platform.ini file but I can't find iphone-sdk-4.1 in the /Compiler/platform directory.

bigsofty

Glbasic had the ability to compile for the iPhone without the need for a Mac and XCode, this was removed to keep Apple happy, this reference may be a remnant of that feature?
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

marovada

It makes sense that Apple wouldn't want its sdk packaged, but how does GLBasic create object files for the iPhone?

I'm asking because xcode will not compile a GLBasic iPhone project against GLBasic object files compiled from iphone-sdk-6 and above. Anyone using the command line in OS X to compile GLBasic projects must therefore have an older version of the sdk which is quite limiting.

Or maybe I'm missing something...

bigsofty

GLBasic creates static libs using the GCC ARM compiler, all XCode does is link them. I am using the latest XCode version and it works fine?
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

marovada

#4
I'm talking about creating the static libs.  If you look at the platform ini file, there is a command line for creating the object files that links against isysroot/iphone-sdk-4.1.  It then uses libtool to package the object files into a static library.

I'm linking against isysroot/iphone-sdk-6.1.  I create the object files and then package them into the static lib but I when I create the xcode project and link against the static lib it doesn't compile.

If I use the GLBasic editor to create the static lib then xcode compiles perfectly as you've observed.  My question is what sdk is the GLBasic editor using to make the static lib. 

Kitty Hello

I won't say. Can we quit this conversation? ;)

Kitty Hello

Oh. You can't link my libs? What error do you get?

Ian Price

Quote from: Kitty Hello on 2013-Jul-01
I won't say. Can we quit this conversation? ;)
No! Please continue ;)

Especially since I can't test on my iPod anymore due to XCode. Direct testing would be incredibly useful. After all Gernot, you wanted to see AquaVenture on iOS...
I came. I saw. I played.

spacefractal

Linking libs is not illigal, but not sure what you want to doing?

But compile it without Xcode is illegal, why gernot won't tell and might have been some early test and then removed. The curent sdk weight some gb too and is impossible to include anyway.

Project with Xcode and glbasic still accept by apple and did a recent release of greedy mouse. but iPhone 5 support is required. but damn you can't test it anymore or get a newer used retina iPod.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

marovada

Quote from: Kitty Hello on 2013-Jul-01
Oh. You can't link my libs? What error do you get?

Sorry, I'm not being clear.

This is for my Mac IDE.  I precompile with GPC.  I want to compile libPROGRAM.a on my mac. The platform.ini file says to do this:

Code (glbasic) Select
Gcc="%GLBASIC%Compiler\platform\iPhone\bin\arm-apple-darwin9-g++.exe" -pipe -c -O3 -marm -mno-thumb-interwork -w -isysroot"%CYG_GLBASIC%Compiler/platform/iPhone/iphone-sdk-4.1" -I"%CYG_GLBASIC%Compiler/platform/iPhone/iphone-sdk-4.1/usr/lib/gcc/arm-apple-darwin10/4.2.1/include" -I"%CYG_GLBASIC%Compiler/platform/Include" -I"%CYG_PROJECT_PATH%" -L"%CYG_PROJECT_PATH%" -DTARGET_OS_IPHONE=1 -DIPHONE %SOURCEFILES%

You can see that it refers to "iphone-sdk-4.1".  I don't have iphone-sdk-4.1

So I do this:

Code (glbasic) Select
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-llvm-g++-4.2 -pipe -c -O3 -marm -mno-thumb-interwork -w -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -I/Applications/Xcode.app/Contents/Developer/platform/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/include -I/Users/marovada/Documents/GLBasic/Compiler/platform/include -I~/Desktop/Test -L~/Desktop/Test -DTARGET_OS_IPHONE=1 -DIPHONE ~/Desktop/Test/*.cpp

I then package into a lib by doing this:

Code (glbasic) Select
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool -static -o  libPROGRAM.a ./*.o
        chmod 777 libPROGRAM.a


That all works fine, but when I create an xcode project and try to compile against libPROGRAM.a, I get link errors about undefined symbols for armv7s.

So I tried to use iphone-sdk-5.0 to create the libPROGRAM.a file and I got no errors in xcode.  This makes me think that it is not possible (maybe because of armv7s architecture) to create libPROGRAM.a with iphone-sdk-6.0.

There is nothing illegal about this.  Anyone can create a static library for iphone from c++ or obj-c files.

But maybe this is something you don't want to disclose because it involves the inner workings of GLBasic.  If that's the case, I fully understand (although I'm a bit confused about the platform.ini file).  But also, that possibly means that no one can compile an iphone static libPROGRAM.a on the command line using GPC and the latest iphone-sdk, unless I am making some other kind of mistake.

Kitty Hello

The libprogram.a is not using any kind of libs to build. Headers are fine from sdk 6.x. My libprogram is armv6, though. Can you change that in you gcc line?

spacefractal

armv6 is unsupported today, so you should change it to armv7 (or build two libs)? Yes some users might cant test it anymore, but this is Apple have done.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Kitty Hello

armv6 is a subset of armv7.

marovada

#13
Quote from: Kitty Hello on 2013-Jul-05
The libprogram.a is not using any kind of libs to build. Headers are fine from sdk 6.x. My libprogram is armv6, though. Can you change that in you gcc line?

I used -march=armv6 but got the same errors.  Maybe it's the version of gcc that comes with sdk 6.1?

The error when I build the iphone xcode project is this:

Code (glbasic) Select
Undefined symbols for architecture armv7s:
  "__GLBASIC__::GLB_LIC_MAIL", referenced from:
      __GLBASIC__::PrepLic() in libGLBasiciPhone-egl.a(glb-full.o)
  "___GLB_Defaults", referenced from:
      -[EAGLView createFramebuffer] in libGLBasiciPhone-egl.a(iPhoneEAGLView.o)
      _iPhoneMain in libGLBasiciPhone-egl.a(glb-full.o)
  "__GLBASIC__::__g_pSubCalls", referenced from:
      __GLBASIC__::CALLBYNAME(__GLBASIC__::DGStr const&) in libGLBasiciPhone-egl.a(glb-full.o)
  "__GLBASIC__::__MainGameSub_()", referenced from:
      _iPhoneMain in libGLBasiciPhone-egl.a(glb-full.o)
  "__GQuitNProfile()", referenced from:
      ___GLB_close_all_filehandles in libGLBasiciPhone-egl.a(glb-full.o)
  "__GLBASIC__::GLB_LIC_CODE", referenced from:
      __GLBASIC__::PrepLic() in libGLBasiciPhone-egl.a(glb-full.o)
ld: symbol(s) not found for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)


It doesn't happen with gcc and headers in iphone sdk 5.

Note that the error is in libGLBasiciPhone-egl.a, but it depends on which version of iphone sdk I use to build libPROGRAM.a.

marovada

It's definitely an architecture problem because I'm getting this warning with iphone sdk 6.1:

Code (glbasic) Select
ld: warning: ignoring file /Users/marovada/Desktop/TypeTest/distribute/xcode/Lib/libPROGRAM.a, file was built for archive which is not the architecture being linked (armv7): /Users/marovada/Desktop/TypeTest/distribute/xcode/Lib/libPROGRAM.a

I've tried using the -arch switch when building libPROGRAM.a but no luck.  Gernot, what is the correct command line argument?