How do I use cygwin to cross compile to linux, whe

2019-08-10 02:26发布

问题:

Will I have to use the crosstool that cygwin provides to make the libX11.so, libGL.so, and libGLU.so libraries using their respective source code? Or do you know where I can find them compiled already for crosstool (I'm new to this cross compilation)?

Just for clarification: I'm on a windows 7 machine trying to get my application also to compile for linux systems by using cygwin's cross compilation. The application uses OpenGL. Thanks

回答1:

To cross-compile for Linux you should install the needed development libs and headers on a linux box[1] and then copy /usr/lib and /usr/include your cygwin environment (e.g. /crosscompiler/linux/...). When you build the cross compiler in cygwin, tell it where those native linux headers and libs are so they'll be used when you compile your app.

[1] If you're looking to run on a wide variety of linux boxes make sure you pick an older linux distro (e.g. Red Hat 9) to ensure your app doesn't have dependencies on very new glibc, etc..



回答2:

Why do you want to use Cygwin?

There is instructions on the OpenGL Wiki about how to use OpenGL on Windows using MinGW.

MinGW use the same GNU tools that are available on Linux (GCC, GDB, GMAKE, etc.) but produce Windows native executables. So, you shouldn't have trouble compiling your source code on both platforms.



回答3:

I just ended up building on a native Linux machine.