Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linker errors on Windows msvc #9

Closed
fowlmouth opened this issue May 1, 2015 · 4 comments
Closed

Linker errors on Windows msvc #9

fowlmouth opened this issue May 1, 2015 · 4 comments

Comments

@fowlmouth
Copy link
Contributor

I get errors at the linking stage about the stb_image functions

[Linking]
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.31101 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 12.00.31101.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/debug
/stack:33554432
/out:c:\users\phowl_000\src\nimx\test\main.exe
c:\users\phowl_000\src\nimx\test\nimcache\nimx_linkage_details.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_sdl_window.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_table_view.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_scroll_view.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_render_to_image.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_unistring.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_text_field.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_view_event_handling.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_window_event_handling.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_app.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_window.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_event.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_control.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_button.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_animation.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_write_image_impl.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_load_image_impl.obj
c:\users\phowl_000\src\nimx\test\nimcache\sdl2_sdl2.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_resource.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_image.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_portable_gl.obj
c:\users\phowl_000\src\nimx\test\nimcache\ttf_ttf.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_rect_packer.obj
c:\users\phowl_000\src\nimx\test\nimcache\stdlib_hashes.obj
c:\users\phowl_000\src\nimx\test\nimcache\stdlib_tables.obj
c:\users\phowl_000\src\nimx\test\nimcache\stdlib_unicode.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_font.obj
c:\users\phowl_000\src\nimx\test\nimcache\stdlib_math.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_matrixes.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_logging.obj
c:\users\phowl_000\src\nimx\test\nimcache\stdlib_unsigned.obj
c:\users\phowl_000\src\nimx\test\nimcache\stdlib_dynlib.obj
c:\users\phowl_000\src\nimx\test\nimcache\stdlib_times.obj
c:\users\phowl_000\src\nimx\test\nimcache\stdlib_parseutils.obj
c:\users\phowl_000\src\nimx\test\nimcache\stdlib_strutils.obj
c:\users\phowl_000\src\nimx\test\nimcache\stdlib_os.obj
c:\users\phowl_000\src\nimx\test\nimcache\stdlib_winlean.obj
c:\users\phowl_000\src\nimx\test\nimcache\stdlib_sequtils.obj
c:\users\phowl_000\src\nimx\test\nimcache\stdlib_macros.obj
c:\users\phowl_000\src\nimx\test\nimcache\opengl_opengl.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_context.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_types.obj
c:\users\phowl_000\src\nimx\test\nimcache\stdlib_typetraits.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_view.obj
c:\users\phowl_000\src\nimx\test\nimcache\stdlib_system.obj
c:\users\phowl_000\src\nimx\test\nimcache\nimx_main.obj
nimx_image.obj : error LNK2019: unresolved external symbol @stbi_load@20 referen
ced in function @imagewithcontentsoffile_769309@4
nimx_image.obj : error LNK2019: unresolved external symbol @stbi_image_free@4 re
ferenced in function @imagewithcontentsoffile_769309@4
nimx_image.obj : error LNK2019: unresolved external symbol @stbi_load_from_memor
y@24 referenced in function @imagewithresource_769326@8
nimx_image.obj : error LNK2019: unresolved external symbol @stbi_write_tga@20 re
ferenced in function @writetofile_770036@12
nimx_image.obj : error LNK2019: unresolved external symbol @stbi_write_hdr@20 re
ferenced in function @writetofile_770036@12
nimx_image.obj : error LNK2019: unresolved external symbol @stbi_write_bmp@20 re
ferenced in function @writetofile_770036@12
nimx_image.obj : error LNK2019: unresolved external symbol @stbi_write_png@24 re
ferenced in function @writetofile_770036@12
nimx_font.obj : error LNK2019: unresolved external symbol @stbtt_FindGlyphIndex@
8 referenced in function @bakechars_748115@8
nimx_font.obj : error LNK2019: unresolved external symbol @stbtt_GetGlyphBitmapB
ox@32 referenced in function @bakechars_748115@8
nimx_font.obj : error LNK2019: unresolved external symbol @stbtt_MakeGlyphBitmap
@32 referenced in function @bakechars_748115@8
c:\users\phowl_000\src\nimx\test\main.exe : fatal error LNK1120: 10 unresolved e
xternals
Error: execution of an external program failed

I tried making a .def file and compiling with nim c --passL:"/DEF:win.def" --parallelBuild:1 main that was all I could think of doing

@yglukhov
Copy link
Owner

yglukhov commented May 1, 2015

This seems a lot like mangling problem. These are all the FFI functions. Unfortunately I don't have windows machine to play with it. Could you please provide the generated nimcache\ttf_ttf.c and nimcache\nimx_font.c?

@fowlmouth
Copy link
Contributor Author

@yglukhov
Copy link
Owner

yglukhov commented May 2, 2015

So indeed this looks like a mangling problem because of fastcall convention, that nim generates. Could I ask you to try and mark some C function (e.g. stbi_load in load_image_impl.nim) as N_RAW_NIMCALL? And test whether it helps the linker find it?

STBIDEF stbi_uc * N_RAW_NIMCALL stbi_load(char const *filename, int *x, int *y, int *comp, int req_comp)
{
...

@fowlmouth
Copy link
Contributor Author

Thanks @yglukhov that fixed the linker error for the first one I tried :) will close after I've fixed them all

fowlmouth added a commit to fowlmouth/ttf that referenced this issue May 3, 2015
rrenderr added a commit to rrenderr/nimx that referenced this issue Apr 24, 2018
* - fix galaxy s9 blue screen

* - fix linux build machine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants