1

Ok, so I've been developing externals for Pure Data using Visual Studio Express 2013 and all is going fine and dandy. Everything compiles, works and all that.

But now I'm faced with having to do specific compilation of the externals for Android (for use with libPD), which means I'm going to have to use Android NDK. All guides I found for NDK use Eclipse, so I've decided to get the code into Eclipse and start working with it.

I had Eclipse previously installed for some attempts at Android dev, which meant I only had to install Make, Gcc and Gdb. Did so via Cygwin, restarted Eclipsed, everything seemed to work fine (when attempting to compile an empty project all calls are made without errors and project compiles).

Imported basic "helloworld" project source into newly created Eclipse C project and got (as expected) an error when trying to include "m_pd.h". Searched google and eclipse docs for library inclusion, tried it in include path, in library path (linker->libraries settings), and can't get it to work well with any other solution apart from adding it to the include path. Added Pure Data src folder to project's include path, and error went away.

However, when I try to compile the project, all the PD methods and functions get undefined reference errors (post, pd_new, gensym, etc, etc), which points at compiler being unable to correctly reach the library...

As a total Eclipse newbie user, I'm wondering if I missed some step or if I did anything wrong...

Same errors seem to happen either with internal and external compiler. External (cygwin gcc) shows errors at linking stage (after "Invoking: Cygwin C Linker" line)

UPDATE: Compile errors disappeared after I added include path to cygwin linker libraries path. Now getting "syntax error near unexpected token `('" error on makefile command: gcc -shared -o "dataIn.dll" ./src/dataIn.o -lC:/Program\ Files\ (x86)/Pure\ Data/src

Is make getting weird because of that "(" in the path?

Ishkur
  • 75
  • 1
  • 8

2 Answers2

1

gcc and GNU make have a reputation of dealing badly with spaces in include paths.

the short answer is: don't!

it's easy enought to unzip Pd to a sane place, that doesn't contain spaces, paranthesis, asterisks and the dreaded AUX. e.g.

C:\Pd\
umläute
  • 28,885
  • 9
  • 68
  • 122
  • Did that, to no avail. – Ishkur Apr 21 '15 at 22:42
  • In the end I just adopted the makefile template provided in PD's website and got it to work with command line "make" and ndk-build for Android externals... Will try again to get Eclipse 100% working anyway, would be a LOT easier to keep everything organized.. – Ishkur Apr 21 '15 at 22:49
  • Also worthy to note that Eclipse workspace and ndk paths should also be in a "sane place", without any crazy characters and no spaces. NDK will not work on paths with spaces at all. – Ishkur Apr 21 '15 at 22:51
0

For the record, and if anyone stumbles upon this question, the problem was using Cygwin, as it needs a dll (cygwin1.dll) to run anything compiled with it. Ended up switching to using MingW and everything worked fine.

Umlaute's suggestions regarding file paths and directories are extremely important as well to ensure correct compilation.

Ishkur
  • 75
  • 1
  • 8