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

Author Topic: Compiling SFML with mingw under Ubuntu to be able to cross-compile for windows.  (Read 11166 times)

0 Members and 1 Guest are viewing this topic.

ntzrmtthihu777

  • Newbie
  • *
  • Posts: 10
    • View Profile
hmm. switching the -DSFML_STATIC to the compile option gives what appears to be identical output on the second command.
(let us note that the mingw-g++ -c etc command does produce a *.o file, and returns no errors. its the second command that foobars)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Quote
let us note that the mingw-g++ -c etc command does produce a *.o file, and returns no errors. its the second command that foobars
Yes, but the linker fails because the compiler generates the wrong function names. Because it fails at linker stage doesn't mean that it's the linker command line which is wrong.

I don't know what to else say, it should have solved the problem. Make sure that you clean your project ("make clean") and retry.
Laurent Gomila - SFML developer

ntzrmtthihu777

  • Newbie
  • *
  • Posts: 10
    • View Profile
Not using make, as the above commands show. just working at Pong.cpp using terminal tools. Either way I got fed up with working on it and set up a dev environment in a windows xp virtual box, lol.

pierre

  • Newbie
  • *
  • Posts: 1
    • View Profile
Hi!
I don't know how to cross-compile in ubuntu, but here is what I did to cross-compile in Fedora26. Cross compiling libs is a very usefull thing, as the minGW version installed with linux do not match the one for provided libs. worse, when mixing various libs, finding compatible pre-compiled version is always a headache.

1) INSTALL DEPENDANCIES
As root run:
BIT=32
dnf -y install mingw$BIT-gcc
dnf -y install mingw$BIT-winpthreads-static mingw$BIT-winpthreads
dnf -y install mingw$BIT-libjpeg-turbo-static mingw$BIT-libjpeg-turbo
dnf -y install mingw$BIT-openal-soft
dnf -y install mingw$BIT-libvorbis
dnf -y install mingw$BIT-libogg
dnf -y install mingw$BIT-flac
updatedb

2) Download and compile

VERSION=2.4.2
CMAKE=mingw32-cmake
MAKE=mingw32-make

wget https://www.sfml-dev.org/files/SFML-$VERSION-sources.zip
unzip SFML-$VERSION-sources.zip
mkdir SFML-$VERSION-build

cd SFML-$VERSION
$CMAKE
$MAKE clean
$MAKE
$MAKE install DESTDIR=../SFML-$VERSION-build