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

Static linking of libui #22

Closed
nshtg opened this issue Jun 9, 2018 · 10 comments
Closed

Static linking of libui #22

nshtg opened this issue Jun 9, 2018 · 10 comments
Labels
c-enhancement New feature or request k-dependencies Issues with the crate's dependencies p-medium Medium Priority x-help wanted Extra attention is needed
Milestone

Comments

@nshtg
Copy link

nshtg commented Jun 9, 2018

I looked around but I did not see any option to build a static version of libui and link it directly in our binary. I would prefer this to shipping libui.dll with my exectuable.

Have you looked into this before?

@NoraCodes NoraCodes added c-enhancement New feature or request x-help wanted Extra attention is needed p-medium Medium Priority k-dependencies Issues with the crate's dependencies labels Jun 11, 2018
@NoraCodes
Copy link
Collaborator

I looked into it briefly in the ui days, before iui became a thing. I would also prefer to have this. If you can figure out how and submit a PR, that would be awesome; if not, I'll look into it when I have time.

@masche842
Copy link
Contributor

Looks like someone already forked iui and added static build capabilities: https://github.com/th0rex/libui-rs
I'm not sure about Mac OS, but it should at least cover Windows and Linux.

@cyberpunkbln
Copy link

@masche842
Hello, do you know how can i enable static building in this repo whe i use cargo-deps?
thx
ps: @th0rex don't have an issues.

@torkleyy
Copy link

@NoraCodes Any preferences for the configuration? (Or do you even want dynamic linking?)

I'd go with two features (static and dynamic). If no flag is enabled, the "platform default" is used. If one of both is enabled, it will be respected and if both are enabled the build script would error. How does that sound to you?

@NoraCodes
Copy link
Collaborator

@torkleyy I was hoping to be able to easily test this on a Mac and a Windows machine but haven't been able to set things up as much as I would like. Your approach sounds like a good one, though.

@NoraCodes NoraCodes added this to the 0.5 Release milestone Feb 26, 2019
@leo60228
Copy link

I'm not sure if it works on Windows or macOS, but I made leo60228@e2d8dcf before I saw this issue and it works fine for me.

@barzamin
Copy link
Member

barzamin commented Mar 13, 2019

@NoraCodes sorry, just saw this. i will test on macOS and Windows if you write the patch :)

@woelper
Copy link

woelper commented Mar 25, 2019

@leo60228 I don't know if that's helpful but I tested your fork on Windows 10 and got this error:

libui_sys-71a5194c1d011b77.rlib(init.obj) : error LNK2019: unresolved external symbol __imp_CoUninitialize referenced in function uiUninit
          libui_sys-71a5194c1d011b77.rlib(init.obj) : error LNK2019: unresolved external symbol __imp_CoInitialize referenced in function uiInit
          libui_sys-71a5194c1d011b77.rlib(init.obj) : error LNK2019: unresolved external symbol __imp_InitCommonControlsEx referenced in function uiInit
          libui_sys-71a5194c1d011b77.rlib(entry.obj) : error LNK2019: unresolved external symbol __imp_SetWindowTheme referenced in function uiNewSearchEntry
          libui_sys-71a5194c1d011b77.rlib(group.obj) : error LNK2019: unresolved external symbol SetWindowSubclass referenced in function uiNewGroup
          libui_sys-71a5194c1d011b77.rlib(d2dscratch.obj) : error LNK2001: unresolved external symbol SetWindowSubclass
          libui_sys-71a5194c1d011b77.rlib(group.obj) : error LNK2019: unresolved external symbol RemoveWindowSubclass referenced in function "__int64 __cdecl groupSubProc(struct HWND__ *,unsigned int,unsigned __int64,__int64,unsigned __int64,unsigned __int64)" (?groupSubProc@@YA_JPEAUHWND__@@I_K_J11@Z)
          libui_sys-71a5194c1d011b77.rlib(group.obj) : error LNK2019: unresolved external symbol DefSubclassProc referenced in function "__int64 __cdecl groupSubProc(struct HWND__ *,unsigned int,unsigned __int64,__int64,unsigned __int64,unsigned __int64)" (?groupSubProc@@YA_JPEAUHWND__@@I_K_J11@Z)
          libui_sys-71a5194c1d011b77.rlib(stddialogs.obj) : error LNK2019: unresolved external symbol __imp_CoCreateInstance referenced in function "char * __cdecl commonItemDialog(struct HWND__ *,struct _GUID const &,struct _GUID const &,unsigned long)" (?commonItemDialog@@YAPEADPEAUHWND__@@AEBU_GUID@@1K@Z)
          libui_sys-71a5194c1d011b77.rlib(image.obj) : error LNK2001: unresolved external symbol __imp_CoCreateInstance
          libui_sys-71a5194c1d011b77.rlib(stddialogs.obj) : error LNK2019: unresolved external symbol __imp_CoTaskMemFree referenced in function "char * __cdecl commonItemDialog(struct HWND__ *,struct _GUID const &,struct _GUID const &,unsigned long)" (?commonItemDialog@@YAPEADPEAUHWND__@@AEBU_GUID@@1K@Z)
          libui_sys-71a5194c1d011b77.rlib(stddialogs.obj) : error LNK2019: unresolved external symbol __imp_TaskDialog referenced in function "void __cdecl msgbox(struct HWND__ *,char const *,char const *,int,wchar_t const *)" (?msgbox@@YAXPEAUHWND__@@PEBD1HPEB_W@Z)
          libui_sys-71a5194c1d011b77.rlib(draw.obj) : error LNK2019: unresolved external symbol D2D1CreateFactory referenced in function "long __cdecl initDraw(void)" (?initDraw@@YAJXZ)
          libui_sys-71a5194c1d011b77.rlib(image.obj) : error LNK2019: unresolved external symbol IID_IWICImagingFactory referenced in function "long __cdecl uiprivInitImage(void)" (?uiprivInitImage@@YAJXZ)
          libui_sys-71a5194c1d011b77.rlib(dwrite.obj) : error LNK2019: unresolved external symbol __imp_DWriteCreateFactory referenced in function "long __cdecl uiprivInitDrawText(void)" (?uiprivInitDrawText@@YAJXZ)
          libui_sys-71a5194c1d011b77.rlib(areaevents.cpp.obj) : error LNK2019: unresolved external symbol __imp__TrackMouseEvent referenced in function "int __cdecl areaDoEvents(struct uiArea *,unsigned int,unsigned __int64,__int64,__int64 *)" (?areaDoEvents@@YAHPEAUuiArea@@I_K_JPEA_J@Z)
          libui_sys-71a5194c1d011b77.rlib(tabpage.obj) : error LNK2019: unresolved external symbol __imp_EnableThemeDialogTexture referenced in function "struct tabPage *
__cdecl newTabPage(struct uiControl *)" (?newTabPage@@YAPEAUtabPage@@PEAUuiControl@@@Z)
          libui_sys-71a5194c1d011b77.rlib(drawmatrix.obj) : error LNK2019: unresolved external symbol D2D1MakeRotateMatrix referenced in function uiDrawMatrixRotate
          libui_sys-71a5194c1d011b77.rlib(drawmatrix.obj) : error LNK2019: unresolved external symbol D2D1MakeSkewMatrix referenced in function uiDrawMatrixSkew
          libui_sys-71a5194c1d011b77.rlib(drawmatrix.obj) : error LNK2019: unresolved external symbol D2D1IsMatrixInvertible referenced in function uiDrawMatrixInvertible

@MOZGIII
Copy link

MOZGIII commented Jan 26, 2020

See #70. Switching to meson effectively solves the static linkage issues.

@xobs
Copy link
Contributor

xobs commented Apr 7, 2020

Also see #86 which solves the same issue without relying on an external build tool.

@nshtg nshtg closed this as completed Mar 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c-enhancement New feature or request k-dependencies Issues with the crate's dependencies p-medium Medium Priority x-help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

10 participants