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

Author Topic: Forcing a x86 build on x64 machine CI sever (github actions)  (Read 3562 times)

0 Members and 1 Guest are viewing this topic.

kenpower

  • Newbie
  • *
  • Posts: 5
    • View Profile
Forcing a x86 build on x64 machine CI sever (github actions)
« on: December 01, 2021, 10:50:07 pm »
Hi,

I am running a github action to build/test an app using SFML.
As part of the build script, it clones SFML and builds it.

The problem occurs when I link the app with a x86 config, it complains (one error for every sfml call)

"error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __thiscall sf::Time::asMilliseconds(void)const"[/tt]
and
C:\Program Files (x86)\SFML\lib\sfml-window-d.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'

The problem goes away if I build my app with x64 config. But I need a 32bit build.

I've looked at the SFML Cmake files and it seems that the 32/64 build decision is based on a size of a pointer, so not easily configurable.

How can I force a 32bit build of SFML on a 64bit machine?
« Last Edit: December 01, 2021, 11:44:08 pm by kenpower »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10819
    • View Profile
    • development blog
    • Email
Re: Forcing a x86 build on x64 machine CI sever (github actions)
« Reply #1 on: December 02, 2021, 12:09:10 am »
You need to tell CMake what architecture you want to use.

See the generators CMake lists.
For VS 2019 and 2022 you need to specify the architecture with the -A flag.

Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

kenpower

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Forcing a x86 build on x64 machine CI sever (github actions)
« Reply #2 on: December 02, 2021, 10:05:55 am »
Thanks:
 
For people finding this question, I did (for dynamic linked libs in x86):

cmake -B build -DSFML_USE_STATIC_STD_LIBS=FALSE -DBUILD_SHARED_LIBS=TRUE -A Win32

I guess I was confused as I could not see a x86 option in ci.yml. I was couldn't see how the 32 bit builds were generated.