De: "Thomas Mayer" thomas@residuum.org À: "Patrice Colet" colet.patrice@free.fr, pd-dev@iem.at Envoyé: Vendredi 10 Août 2012 21:01:52 Objet: Re: [PD-dev] Cross Compiling External for Windows - Problem
Hi,
On 10.08.2012 11:20, Patrice Colet wrote:
Hello, I'm afraid the work to be made isn't in the Makefile but in source files,
did you give a try with this:
http://readlist.com/lists/lists.sourceforge.net/mingw-users/1/9807.html
I don't think, this is the problem: There is no MSVC involved in the entire toolchain, but only gcc on Linux, partly using MXE for cross compilation on Linux.
the mail reply says how MSVC is involved,
"int _get_output_format( void ); is a standard MSVC function"
http://msdn.microsoft.com/en-us/library/571yb472(v=vs.80).aspx
the problem is certainly because stdlib is different on windows, for exemple vasprintf() is missing, you have to provide it into the sources, like we have done on gridflow, or provide another function.
gcc seems to try mscv's _get_output_format() for resolving it without success...
Another thing, I've used s_list in an external that compiles fine with g++ linking and declspec embedding...
can you post all the compile process, and what is your linker?
On 10.08.2012 23:20, Patrice Colet wrote:
the mail reply says how MSVC is involved,
"int _get_output_format( void ); is a standard MSVC function"
http://msdn.microsoft.com/en-us/library/571yb472(v=vs.80).aspx
the problem is certainly because stdlib is different on windows, for
exemple vasprintf() is missing,
you have to provide it into the sources, like we have done on
gridflow, or provide another function.
gcc seems to try mscv's _get_output_format() for resolving it without
success...
It must be a linker problem: When I compile the test application for json-c with MXE, then there is no problem at all, and I can run the program in Windows correctly.
Another thing, I've used s_list in an external that compiles fine with g++ linking and declspec embedding...
can you post all the compile process, and what is your linker?
My complete compile process is this:
cross compilation tools and necessary libraries (make curl json-c libiberty pthreads). 1a. (optional) Run built test application in Windows to ensure correct build process 2. Get PuREST JSON (https://github.com/residuum/PuRestJson). The Makefile uses the template 1.0.12. NB: The Makefile in the repository is not the same one as on my local machine, I will push it once cross compilation is possible. 3. Run make UNAME=MINGW CROSS=i686-pc-mingw32 CROSS_PATH=/opt/mxe/usr PD_PATH=/home/thomas/src/Pd-0.42.5-extended/pd-win
Output: i686-pc-mingw32-gcc
-I"/home/thomas/src/Pd-0.42.5-extended/pd-win/include/pd" -std=c99 -DPD
-DVERSION='"0.7.1"' -mms-bitfields
-I"/home/thomas/src/Pd-0.42.5-extended/pd-win/src" -mthreads -Wall -W -g
-I/opt/mxe/usr/i686-pc-mingw32/include -O3 -funroll-loops
-fomit-frame-pointer -o "libpurest_json.o" -c "libpurest_json.c"
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 am not sure, how to get information about the linker used, and how to set it in the Makefile. That was part of the original question, apparently setting LD in the Makefile is not enough (see https://gist.github.com/3307768).
Thanks for your help, Thomas
Output: i686-pc-mingw32-gcc -I"/home/thomas/src/Pd-0.42.5-extended/pd-win/include/pd" -std=c99
re, how to get information about the linker used, and how
to set it in the Makefile. That was part of the original question,
try to put this in LDFLAGS or LIBS -Wl,--verbose to make linker more talkative...
Hello Patrice,
On 14.08.2012 11:52, Patrice Colet wrote:
Output: i686-pc-mingw32-gcc -I"/home/thomas/src/Pd-0.42.5-extended/pd-win/include/pd" -std=c99
re, how to get information about the linker used, and how
to set it in the Makefile. That was part of the original question,
try to put this in LDFLAGS or LIBS -Wl,--verbose to make linker more talkative...
it seems, that I have problems compiling the external with MinGW on Windows as well. I will try to make that work first, and then go on with the compilation with MXE on Linux. Your tips have led to some bugs with my Makefile already.
Thanks, Thomas
Hello Thomas,
it seems, that I have problems compiling the external with MinGW on Windows as well. I will try to make that work first, and then go on
I tried to have a look but there is something I didn't have time to handle, how to get libcurl on win32 for mingw...
with the compilation with MXE on Linux. Your tips have led to some bugs with my Makefile already.
cool, let us know if you get something working :D