Hello,
I try to cross compile my external PuREST JSON for Windows using MXE on Linux. According to their tutorial, a little work is necessary on the Makefile to be able to cross-compile (http://mxe.cc/#tutorial):
-- Start quote -- Step 5d: Cross compile your Project (Makefile)
If you have a handwritten Makefile, you probably will have to make a few adjustments to it:
CC=$(CROSS)gcc LD=$(CROSS)ld AR=$(CROSS)ar PKG_CONFIG=$(CROSS)pkg-config
You may have to add a few others, depending on your project.
Then, all you have to do is:
make CROSS=i686-pc-mingw32-
That's it! -- End quote --
That is, what I tried, and compilation is working, but the linker does not work, and outputs:
i686-pc-mingw32-gcc -shared -o libpurest_json.dll libpurest_json.o -lcurl -ljson -L"/home/thomas/src/Pd-0.42.5-extended/pd-win/src" -L"/home/thomas/src/Pd-0.42.5-extended/pd-win/bin" -L"/home/thomas/src/Pd-0.42.5-extended/pd-win/obj" -lpd -lwsock32 -lkernel32 -luser32 -lgdi32 -liberty -lpthread libpurest_json.o: In function `output_json': /home/thomas/src/pd/my-objects/purest_json/libpurest_json.c:145: undefined reference to `s_list' /opt/mxe/usr/lib/gcc/i686-pc-mingw32/4.7.1/../../../../i686-pc-mingw32/lib/libjson.a(printbuf.o): In function `vasprintf': /opt/mxe/tmp-json-c/json-c-0.10/printbuf.c:130: undefined reference to `_vscprintf' /opt/mxe/usr/lib/gcc/i686-pc-mingw32/4.7.1/../../../../i686-pc-mingw32/lib/libmingwex.a(pformat.o):pformat.c:(.text+0x1732): undefined reference to `_get_output_format' collect2: error: ld returned 1 exit status make: *** [libpurest_json.dll] Fehler 2
I have pd.dll in the path /home/thomas/src/Pd-0.42.5-extended/pd-win/bin.
The complete Makefile and input / output of make is at https://gist.github.com/3307768
Here are my questions: Does gcc use the wrong linker (ld instead of i686-pc-mingw32-ld)? Is there a way to force gcc to use the correct linker? Do I something else than pd.dll for linking?
Thanks in advance, Thomas