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

Author Topic: Unable to use RSFML  (Read 11700 times)

0 Members and 1 Guest are viewing this topic.

Ragbot

  • Newbie
  • *
  • Posts: 24
    • View Profile
    • Email
Unable to use RSFML
« on: June 01, 2021, 03:17:57 pm »
I try compiling but it keeps giving me this linker error.

Quote
error: linking with `x86_64-w64-mingw32-gcc` failed: exit code: 1
  |
  = note: "x86_64-w64-mingw32-gcc" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-Wl,--dynamicbase" "-Wl,--di
sable-auto-image-base" "-m64" "-Wl,--high-entropy-va" "C:\\Users\\shale\\.rustup\\toolchains\\stable-x86_6
4-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsbegin.o" "-L" "C:\\Users\\shale\\.rustup\\to
olchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "D:\\tmp\\source\\rs\\ri
mg\\target\\debug\\deps\\rimg-ad2a4556e79d2940.rimg.20lb8wv2-cgu.0.rcgu.o" "D:\\tmp\\source\\rs\\rimg\\tar
get\\debug\\deps\\rimg-ad2a4556e79d2940.rimg.20lb8wv2-cgu.1.rcgu.o" "D:\\tmp\\source\\rs\\rimg\\target\\de
bug\\deps\\rimg-ad2a4556e79d2940.rimg.20lb8wv2-cgu.10.rcgu.o" "D:\\tmp\\source\\rs\\rimg\\target\\debug\\d
eps\\rimg-ad2a4556e79d2940.rimg.20lb8wv2-cgu.11.rcgu.o" "D:\\tmp\\source\\rs\\rimg\\target\\debug\\deps\\r
img-ad2a4556e79d2940.rimg.20lb8wv2-cgu.12.rcgu.o" "D:\\tmp\\source\\rs\\rimg\\target\\debug\\deps\\rimg-ad
2a4556e79d2940.rimg.20lb8wv2-cgu.13.rcgu.o" "D:\\tmp\\source\\rs\\rimg\\target\\debug\\deps\\rimg-ad2a4556
e79d2940.rimg.20lb8wv2-cgu.14.rcgu.o" "D:\\tmp\\source\\rs\\rimg\\target\\debug\\deps\\rimg-ad2a4556e79d29
40.rimg.20lb8wv2-cgu.15.rcgu.o" "D:\\tmp\\source\\rs\\rimg\\target\\debug\\deps\\rimg-ad2a4556e79d2940.rim
g.20lb8wv2-cgu.2.rcgu.o" "D:\\tmp\\source\\rs\\rimg\\target\\debug\\deps\\rimg-ad2a4556e79d2940.rimg.20lb8
wv2-cgu.3.rcgu.o" "D:\\tmp\\source\\rs\\rimg\\target\\debug\\deps\\rimg-ad2a4556e79d2940.rimg.20lb8wv2-cgu
.4.rcgu.o" "D:\\tmp\\source\\rs\\rimg\\target\\debug\\deps\\rimg-ad2a4556e79d2940.rimg.20lb8wv2-cgu.5.rcgu
.o" "D:\\tmp\\source\\rs\\rimg\\target\\debug\\deps\\rimg-ad2a4556e79d2940.rimg.20lb8wv2-cgu.6.rcgu.o" "D:
\\tmp\\source\\rs\\rimg\\target\\debug\\deps\\rimg-ad2a4556e79d2940.rimg.20lb8wv2-cgu.7.rcgu.o" "D:\\tmp\\
source\\rs\\rimg\\target\\debug\\deps\\rimg-ad2a4556e79d2940.rimg.20lb8wv2-cgu.8.rcgu.o" "D:\\tmp\\source\
\rs\\rimg\\target\\debug\\deps\\rimg-ad2a4556e79d2940.rimg.20lb8wv2-cgu.9.rcgu.o" "-o" "D:\\tmp\\source\\r
s\\rimg\\target\\debug\\deps\\rimg-ad2a4556e79d2940.exe" "D:\\tmp\\source\\rs\\rimg\\target\\debug\\deps\\
rimg-ad2a4556e79d2940.4yd7dkx4mepq9kek.rcgu.o" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "D:\\tmp\\source\
\rs\\rimg\\target\\debug\\deps" "-L" "C:\\Users\\shale\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\
\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "-Wl,-Bstatic" "D:\\tmp\\source\\rs\\rimg\\target\\debug\\deps\
\libsfml-b9afb2dd96dce8b0.rlib" "D:\\tmp\\source\\rs\\rimg\\target\\debug\\deps\\libbitflags-84f5a0c0a040c
b29.rlib" "D:\\tmp\\source\\rs\\rimg\\target\\debug\\deps\\libonce_cell-50563e1b480243e9.rlib" "D:\\tmp\\s
ource\\rs\\rimg\\target\\debug\\deps\\libwidestring-5382785c179206ec.rlib" "D:\\tmp\\source\\rs\\rimg\\tar
get\\debug\\deps\\libcsfml_graphics_sys-2e5f9fc9ee526da7.rlib" "D:\\tmp\\source\\rs\\rimg\\target\\debug\\
deps\\libcsfml_window_sys-9bfd16c96170dff1.rlib" "D:\\tmp\\source\\rs\\rimg\\target\\debug\\deps\\libcsfml
_audio_sys-be74682fdca4ff3a.rlib" "D:\\tmp\\source\\rs\\rimg\\target\\debug\\deps\\libcsfml_system_sys-c21
ace4f867a3dbe.rlib" "-Wl,--start-group" "C:\\Users\\shale\\.rustup\\toolchains\\stable-x86_64-pc-windows-g
nu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libstd-5c720e8db4b99e37.rlib" "C:\\Users\\shale\\.rustup\\to
olchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libpanic_unwind-29283164
da786e03.rlib" "C:\\Users\\shale\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-
pc-windows-gnu\\lib\\libobject-1776be3a32adbb49.rlib" "C:\\Users\\shale\\.rustup\\toolchains\\stable-x86_6
4-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libaddr2line-0892c1b32ffa2c4d.rlib" "C:\\Users
\\shale\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libg
imli-517a95b0a57b9e8e.rlib" "C:\\Users\\shale\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rus
tlib\\x86_64-pc-windows-gnu\\lib\\librustc_demangle-82d48d88ac13ce1c.rlib" "C:\\Users\\shale\\.rustup\\too
lchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libhashbrown-37de12e440fa
77bc.rlib" "C:\\Users\\shale\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-w
indows-gnu\\lib\\librustc_std_workspace_alloc-7549ba16005c4b88.rlib" "C:\\Users\\shale\\.rustup\\toolchain
s\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libunwind-b131f4022158fa79.rlib
" "C:\\Users\\shale\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gn
u\\lib\\libcfg_if-bfa5ff0422f13358.rlib" "C:\\Users\\shale\\.rustup\\toolchains\\stable-x86_64-pc-windows-
gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liblibc-454b6cdb3888a4db.rlib" "C:\\Users\\shale\\.rustup\\
toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liballoc-90ee5fe37d110
9a4.rlib" "C:\\Users\\shale\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-wi
ndows-gnu\\lib\\librustc_std_workspace_core-f5802464b35b87c4.rlib" "C:\\Users\\shale\\.rustup\\toolchains\
\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcore-7ca46f1af2cdfb26.rlib" "-
Wl,--end-group" "C:\\Users\\shale\\.rustup\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64
-pc-windows-gnu\\lib\\libcompiler_builtins-13d041c714b5c5f4.rlib" "-Wl,-Bdynamic" "-lcsfml-graphics" "-lcs
fml-window" "-lcsfml-audio" "-lcsfml-system" "-ladvapi32" "-lws2_32" "-luserenv" "-lgcc_eh" "-l:libpthread
.a" "-lmsvcrt" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-luser32" "-lkernel32" "C:\\Users\\shale\\.rust
up\\toolchains\\stable-x86_64-pc-windows-gnu\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsend.o"
  = note: D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld
.exe: D:\tmp\source\rs\rimg\target\debug\deps\libsfml-b9afb2dd96dce8b0.rlib(sfml-b9afb2dd96dce8b0.sfml.5zo
luu9r-cgu.11.rcgu.o): in function `sfml::graphics::render_texture::RenderTexture::with_settings':
          C:\Users\shale\.cargo\registry\src\github.com-1ecc6299db9ec823\sfml-0.16.0\src\graphics/render_t
exture.rs:57: undefined reference to `sfRenderTexture_createWithSettings'
          collect2.exe: error: ld returned 1 exit status


error: aborting due to previous error

error: could not compile `rimg`

Windows 10
Gnu Tool Chain
Rust 1.52.1

jule

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Unable to use RSFML
« Reply #1 on: June 02, 2021, 12:40:19 am »
Hi, I am having a similar error but on MSVC toolchain:

Code: [Select]
error: linking with `link.exe` failed: exit code: 1120
= note: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30037\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "/NXCOMPAT" "/LIBPATH:C:\\Users\\<me>\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib"
...
= note: libsfml-ef036890d6e5e265.rlib(sfml-ef036890d6e5e265.sfml.29hhr9o3-cgu.11.rcgu.o) : error LNK2019: unresolved external symbol sfRenderTexture_createWithSettings referenced in function _ZN4sfml8graphics14render_texture13RenderTexture13with_settings17hb4dc85121be46492E
          C:\dev\<my-project>\target\debug\deps\<my-project>.exe : fatal error LNK1120: 1 unresolved externals
error: aborting due to previous error

Might this error actually be specific to sfRenderTexture_createWithSettings (e.g. it's missing in the SFML library because I am using a wrong SFML version, or what ever) or rather a general linking error caused by my/our setup(s)?

Setup:
  • Windows 10
  • Rust 1.52.1
  • rust-sfml 0.16.0
  • SFML 2.5.1 - Visual C++ 15 (2017) - 64-bit
  • CSFML 2.5 - Visual C++ / GCC - 64-bit

I followed the guide at https://github.com/jeremyletang/rust-sfml/wiki/Windows to install SFML, but didn't know how to deal with the different types of SFML .lib files (e.g. those with -s, -d suffixes) so I only copied the variants without any suffix (actually also tried other variants, resulting in the same error).

Also I obviously am using Visual Studio 2019 build tools while the SFML library I downloaded is for VS2017 (due to non-existent variant for VS2019).

Just to do some more trial-n-error-ing I downloaded the SFML for 32-bit (although, apparently I am trying to build for 64-bit architecture) and this caused many more error lines:
Code: [Select]
...
libsfml-ef036890d6e5e265.rlib(sfml-ef036890d6e5e265.sfml.29hhr9o3-cgu.15.rcgu.o) : error LNK2019: unresolved external symbol sfRectangleShape_getSize referenced in function _ZN4sfml8graphics15rectangle_shape14RectangleShape4size17hc79499150836d7bcE
... [dozens of these lines, all for different "symbols" from SFML]
That makes me confident that my initial setup was a little bit more correct as it only gave this one missing symbol "sfRenderTexture_createWithSettings".  8)

I Hope this helps anyone and maybe also someone can help me  ;)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10801
    • View Profile
    • development blog
    • Email
Re: Unable to use RSFML
« Reply #2 on: June 02, 2021, 09:01:30 am »
Hi, I am having a similar error but on MSVC toolchain:
Might this error actually be specific to sfRenderTexture_createWithSettings (e.g. it's missing in the SFML library because I am using a wrong SFML version, or what ever) or rather a general linking error caused by my/our setup(s)?
We had a broken signature in CSFML, which was fixed, as such you'll have to rebuild CSFML.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

jule

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Unable to use RSFML
« Reply #3 on: June 02, 2021, 06:32:51 pm »

Ragbot

  • Newbie
  • *
  • Posts: 24
    • View Profile
    • Email
Re: Unable to use RSFML
« Reply #4 on: June 03, 2021, 02:38:39 pm »
I can't seem to find the FindSFML.cmake file...
or do I have to make it myself?

if so how do I do that,
I am inexperienced in CMake.
« Last Edit: June 03, 2021, 02:51:11 pm by Ragbot »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10801
    • View Profile
    • development blog
    • Email
Re: Unable to use RSFML
« Reply #5 on: June 03, 2021, 02:58:37 pm »
Since SFML 2.5 there's no FindSFML.cmake anymore, instead you define SFML_DIR and point it to the folder containing the CMake config files (usually lib/cmake/SFML).

See also https://en.sfml-dev.org/forums/index.php?topic=24070.0
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Ragbot

  • Newbie
  • *
  • Posts: 24
    • View Profile
    • Email
Re: Unable to use RSFML
« Reply #6 on: June 19, 2021, 03:59:06 pm »
Um sorry I'm late a lot has been happening but I seem to be getting this error after I add set(SMFL_DIR "<SFML_SRC_DIR>")

Quote
CMake Error at D:/msys64/mingw64/lib/cmake/SFML/SFMLConfig.cmake:139 (message):
  SFML found but some of its dependencies are missing ( FreeType OpenAL
  VorbisFile VorbisEnc Vorbis Ogg FLAC)
Call Stack (most recent call first):
  src/SFML/CMakeLists.txt:25 (find_package)


CMake Error at src/SFML/CMakeLists.txt:25 (find_package):
  Found package configuration file:

    D:/msys64/mingw64/lib/cmake/SFML/SFMLConfig.cmake

  but it set SFML_FOUND to FALSE so package "SFML" is considered to be NOT
  FOUND.


-- Configuring incomplete, errors occurred!

I really don't understand CMake

it seems to have found SFML but SFML_FOUND is set to false
but I went through the entire CMakeLists.txt file but I found no SMFL_FOUND anywhere

Grundkurs

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
Re: Unable to use RSFML
« Reply #7 on: July 31, 2022, 12:34:48 pm »