haxenme / nme

A cross-platform native backend for Haxe projects
MIT License
479 stars 123 forks source link

iOS - Build Failed #455

Closed micage closed 6 years ago

micage commented 7 years ago

Hi, I decided to give HAXE a try. After downloading and installing I tried out some samples. If target is MacOs, all is fine but executing the following command:

nme test ios -simulator in pwd: /usr/local/lib/haxe/lib/nme/5,6,71/samples/00-Nmml

leads to linker errors:

Undefined symbols for architecture x86_64:
  "_ModPlug_GetLength", referenced from:
      nme::NmeSoundData::parseMid(unsigned char const*, int, unsigned int) in libApplicationMain.a(03d7a667_Audio.o)
  "_ModPlug_GetSettings", referenced from:
      nme::NmeSoundData::parseMid(unsigned char const*, int, unsigned int) in libApplicationMain.a(03d7a667_Audio.o)
  "_ModPlug_Load", referenced from:
      nme::NmeSoundData::parseMid(unsigned char const*, int, unsigned int) in libApplicationMain.a(03d7a667_Audio.o)
      nme::NmeSoundStreamMid::NmeSoundStreamMid(nme::INmeSoundData*, unsigned char const*, int) in libApplicationMain.a(03d7a667_Audio.o)
  "_ModPlug_Read", referenced from:
      nme::NmeSoundData::parseMid(unsigned char const*, int, unsigned int) in libApplicationMain.a(03d7a667_Audio.o)
      nme::NmeSoundStreamMid::fillBuffer(char*, int) in libApplicationMain.a(03d7a667_Audio.o)
  "_ModPlug_Seek", referenced from:
      nme::NmeSoundStreamMid::setPosition(double) in libApplicationMain.a(03d7a667_Audio.o)
  "_ModPlug_SetSettings", referenced from:
      nme::NmeSoundData::parseMid(unsigned char const*, int, unsigned int) in libApplicationMain.a(03d7a667_Audio.o)
  "_ModPlug_Unload", referenced from:
      nme::NmeSoundData::parseMid(unsigned char const*, int, unsigned int) in libApplicationMain.a(03d7a667_Audio.o)
      nme::NmeSoundStreamMid::~NmeSoundStreamMid() in libApplicationMain.a(03d7a667_Audio.o)
      nme::NmeSoundStreamMid::~NmeSoundStreamMid() in libApplicationMain.a(03d7a667_Audio.o)
ld: symbol(s) not found for architecture x86_64

haxelib version: 3.3.0, nme: 5.6.71, OS X 10.11.6

Help!

madrazo commented 7 years ago

I think that for iOS, you have to first open the project in xcode with "nme update" instead of "nme test", then build from there.
Another thing to try is the "-toolkit" flag

micage commented 7 years ago

Thanks for your response. Did not get it to work. Tried a lot: update, reinstall, fixing it in xcode. The linker errors disappeared, but then a weird runtime error struck me and I pulled the trigger. Finally i tried the same with openfl and managed it to run the DisplayBitmap sample on all devices/emulator/simulators. Puuh.

TL;DR use the right tools Is it just me or isn't it completely insane that for each and every little sample the complete library has to be rebuild. Tons of code are being compiled just to watch at a tiny little app that displays an image without any functionality. By all means this is not acceptable. 99% of the compiled stuff isn't even used by most of the samples. There has to be a way to precompile this and put it in a library and just link the samples to it. Or do early tree-shaking. For mobile dev beginners it's nearly impossible to overcome situations when these kind of problems (platform issues most of the time) arise. On the landing pages everything is easy but a small deviation of your computer configuration and you can find yourself in a world pain.

What I'm looking for is a way to write platform independent code and when I'm done coding just deploy it for a certain target platform without having to deal much with glue code that marries my code to the target. The only tool that I know of that can handle this easily is Unity3D. But I'm looking for alternatives. A framework or library that is stable, well documented and supports/rules them all (PC/OS X/Linux/iOS/Android).

-> interesting project: Oryol, watch the live demos!

hughsando commented 7 years ago

The HXCPP_COMPILE_CACHE is designed to share code between projects/samples and act as the "precompile step". This is most easily done by editing your ~/.hxcpp_config.xml to contain a line like: <set name="HXCPP_COMPILE_CACHE" value="/Users/Hugh/.hxcpp_cache" />

thomasuster commented 6 years ago

Hey @micage, would love to help you get started on one of the samples on iOS if you're still interested., just ping me on twitter (https://twitter.com/thomasuster). Maybe some documentation / script changes are needed here. Also opened https://github.com/HaxeFoundation/hxcpp/issues/731 which I think would have helped.