Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: how to compile under cygwin  (Read 8705 times)

0 Members and 2 Guests are viewing this topic.

roarbug

  • Newbie
  • *
  • Posts: 4
    • View Profile
how to compile under cygwin
« on: September 03, 2012, 08:18:32 pm »
Hi,
I'm trying to compile under cygwin.
I'm very new to Windows (Windows 7 starter) and Cygwin.
As I use Linux for years, I'm trying similar commands, but it doesn't work.

Could someone tell me what command lines I should use ?

Also I'm not sure which archive I should use (so I've tryed both).
Or maybe none if it may work in Cygwin ? Maybe I have to recompile SFML myself for Cygwin ?

I've tryed Code::Blocks, but was unable to make it work. Anyway Cygwin ressemble more like something I'm used to.

Also I've seen that the docs provide explanation for compiling in different environment. When I will have succeed to use SFML under Cygwin, would you accept if I write the equivalent page to include it on this website ?

thanks in advance

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: how to compile under cygwin
« Reply #1 on: September 03, 2012, 08:31:01 pm »
Cygwin tries to 'emulate' a POSIX/Linux enviroment under Windows, for that it makes use of various tricks and if you compile an application with GCC under cygwin you'll also have to provide the cygwin DLL.
I'd also say that you'll have to recompile SFML for cygwin.

If you've all the needed tools installed from the cygwin repository it should work very similar to Linux.
You'll also have to make sure that you don't have any interference with other application installed on your system, e.g. if you have CMake installed for Windows, make sure it doesn't get called from the command line, etc.

I'd say it would be better to use something like MSYS, MinGW and Code::Blocks or if you want to leave the gcc area you could also use Visual Studio Express which can also compile on the command line, if you don't want to use the IDE itself. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

roarbug

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: how to compile under cygwin
« Reply #2 on: September 03, 2012, 09:11:34 pm »
Yes I do want to explore other ways to do things, and even trying them all for those that don't require to buy a license.

But first I would like to be able to get a hello-world working and play with it, without too much time and pain.

Thank you about making me informed for the cygwin DLL deps.

But I see that MinGW compilers seem to be available in the cygwin environment.
What about using it ?

I haven't found much tutorial about how to compile with MinGW under Cygwin. Maybe this is not a good solution ?
« Last Edit: September 03, 2012, 09:21:10 pm by roarbug »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: how to compile under cygwin
« Reply #3 on: September 03, 2012, 09:32:01 pm »
But I see that MinGW compilers seem to be available in the cygwin environment.
What about using it ?

I haven't found much tutorial about how to compile with MinGW under Cygwin. Maybe this is not a good solution ?
You can use it if you want, but the binaries will also need the cygwin DLL (unless you set the flag to not use cygwin stuff).
If you've installed them, then you can easily call them with mingw32-make or mingw32-gcc, etc. IMHO it doesn't make that much sense to use MinGW in combination with cygwin, since cygwin already provides gcc, make, etc.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: how to compile under cygwin
« Reply #4 on: September 04, 2012, 06:32:22 pm »
I'd suggest you do the following (there are several approaches to this, but this is by far the easiest one; you won't need Cygwin):

Download and install MinGW as well as MSYS to C:\Usr (or create a symbolic link).
Add the following paths to Windows' PATH environment variable: C:\usr\bin and C:\usr\msys\1.0\bin
Install CMake and add it's bin dir to the path as well (think this is done by the setup program anyway).

One this is done you can open up a console window (cmd) and start using the shell similar to Unix.

When building libraries, install them to C:\Usr (prefix), which should result in your include files landing in C:\usr\include, libraries landing in C:\usr\lib, etc. which will allow CMake to find all your libraries like it does under Linux/Unix, saving you lots of trouble.

For example, to build and use SFML, you'd do the following:
Quote
cd /sfml-source-dir
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=C:/usr .
make install
cmake -DCMAKE_BUILD_TYPE=Debug
make install
cd /my-own-dir
make whatever

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: how to compile under cygwin
« Reply #5 on: September 04, 2012, 07:42:42 pm »
I'd suggest you do the following (there are several approaches to this, but this is by far the easiest one; you won't need Cygwin)
This all highly depends on what he wants to achive. If you want to have a Linux like enviroment under Windows, then there's no other way then Cygwin. Although if you just want to compile things with MinGW then MSYS is probably the easiest choice. :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything