1

I'm creating a framework that links against a static library using the linker flags -pagezero_size and -image_base

The library is LuaJIT compiled for 64 bits on Mac OS X, and my framework is just an ObjC wrapper for LuaJit plus a bridge to load other frameworks and passing classes and instance objects back and forth.

Everything works fine, but now I want to start writing tests for my framework before I start making some modifications, but the problem is that Xcode complains that pagezero_size is only for the main executable. i.e. adding the flags to the test target throws the error:

ld: -pagezero_size option can only be used when linking a main executable

Any ideas how to run tests for a static library that needs to be linked using -pagezero_size and -image_base?

rraallvv
  • 2,875
  • 6
  • 30
  • 67
  • The library needs to be built with those flags itself or you need to use those flags when you link your application against the library? – Etan Reisner May 04 '15 at 23:27
  • @EtanReisner The library needs to be linked with those flags as [this answer](http://stackoverflow.com/questions/20858911/lua-open-returns-null-using-luajit) suggests – rraallvv May 04 '15 at 23:34
  • That indicates that the main application needs to be linked against the library with those flags. So where are you trying to use that flag currently that is causing a problem? – Etan Reisner May 05 '15 at 01:55
  • @EtanReisner I just added a new "Cocoa Test Bundle" target to the project, and tried to init the Lua VM directly from the test method in the template by calling `lua_open()`, since `lua_open ` is returning `NULL` I assume it's because I'm not adding pagezero_size to the linker flags, but adding the flags throw the error described above. I've not pushed yet the latest modifications but the framework is hosted [here](https://github.com/rraallvv/Lua-Framework), I'm now trying to add some tests. – rraallvv May 05 '15 at 02:11
  • Does the `Cocoa Test Bundle` build an executable? Are there flags for doing that specifically (as opposed to building the library)? I can't suggest anything specific since I don't do Xcode or OS X. – Etan Reisner May 05 '15 at 02:20
  • @EtanReisner no, the test bundle doesn't build an executable, and the framework either, I guess I'll have to add an executable target that load the framework just for running tests. – rraallvv May 05 '15 at 02:27
  • That might be true. I don't know enough to say anything more useful at this point though, sorry. – Etan Reisner May 05 '15 at 02:37

0 Answers0