Closed Lyuu17 closed 7 months ago
I researched a bit, it would be this /SUBSYSTEM linker flag and "Console" is the current one used by "binary", with "Windows" the one I need.
This is not a bug, xmake doesn't set the /subsystem flag, /subsystem:console is just the default value from MSVC.
You can use add_ldflags("/subsystem:windows")
in this case
You can use
add_ldflags("/subsystem:windows")
in this case
Still builds like a console instead of windows, and vscode seems to not recognize it either
add_ldflags("/subsystem:windows", {force = true})
binary
kind will not add any flags. if you want to build windows app. you should use "win.sdk.application"
rule, it will set binary kind and windows subsystem.
https://xmake.io/#/guide/project_examples?id=winsdk-application-program
add_ldflags("/subsystem:windows", {force = true})
Still compiles as "console"
binary
kind will not add any flags. if you want to build windows app. you should use"win.sdk.application"
rule, it will set binary kind and windows subsystem.https://xmake.io/#/guide/project_examples?id=winsdk-application-program
Thanks, docs are a bit confusing, but still, same as ldflags, compiles as console (I think so, I'm comparing with Visual Studio generating the cmakelists and then .sln)
[ 92%]: linking.release ServerBrowserApplicationWX.exe
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.38.33130\\bin\\HostX86\\x86\\link.exe" -nologo -dynamicbase -nxcompat -machine:x86 -libpath:C:\Users\lucx\AppData\Local\.xmake\packages\l\libcurl\8.5.0\9298462f501e4bdfb979fcd6fbb97d01\lib -libpath:C:\Users\lucx\AppData\Local\.xmake\packages\w\wxwidgets\master\af705bc0e66f4f108a3a47c7ee859189\lib -libpath:build\windows\x86\release -libpath:C:\Users\lucx\AppData\Local\.xmake\packages\t\tinyxml2\10.0.0\f114b247ea1e417493c76700ae5c1c5f\lib -libpath:C:\Users\lucx\AppData\Local\.xmake\packages\f\fmt\10.2.1\0897ead68a554e21b2546cd5fd4492a6\lib /opt:ref /opt:icf libcurl.lib wxbase33u.lib wxbase33u_net.lib wxbase33u_xml.lib wxexpat.lib wxjpeg.lib wxlexilla.lib wxmsw33u_adv.lib wxmsw33u_aui.lib wxmsw33u_core.lib wxmsw33u_gl.lib wxmsw33u_html.lib wxmsw33u_media.lib wxmsw33u_propgrid.lib wxmsw33u_qa.lib wxmsw33u_ribbon.lib wxmsw33u_richtext.lib wxmsw33u_stc.lib wxmsw33u_webview.lib wxmsw33u_xrc.lib wxpng.lib wxregexu.lib wxscintilla.lib wxtiff.lib wxzlib.lib LauncherLibrary.lib CoreLibrary.lib tinyxml2.lib fmt.lib kernel32.lib gdi32.lib winspool.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib comdlg32.lib setupapi.lib shlwapi.lib strsafe.lib crypt32.lib wldap32.lib winmm.lib ws2_32.lib user32.lib advapi32.lib ole32.lib shell32.lib -subsystem:windows /manifestinput:applications\ServerBrowserApplicationWX\ServerBrowserApplicationWX.manifest /manifestuac:no /manifest:embed -out:build\windows\x86\release\ServerBrowserApplicationWX.exe build\.objs\ServerBrowserApplicationWX\windows\x86\release\applications\ServerBrowserApplicationWX\src\dialogs\AboutDialog.cpp.obj build\.objs\ServerBrowserApplicationWX\windows\x86\release\applications\ServerBrowserApplicationWX\src\dialogs\AddServerDialog.cpp.obj build\.objs\ServerBrowserApplicationWX\windows\x86\release\applications\ServerBrowserApplicationWX\src\dialogs\SettingsDialog.cpp.obj build\.objs\ServerBrowserApplicationWX\windows\x86\release\applications\ServerBrowserApplicationWX\src\Browser.cpp.obj build\.objs\ServerBrowserApplicationWX\windows\x86\release\applications\ServerBrowserApplicationWX\src\main.cpp.obj build\.objs\ServerBrowserApplicationWX\windows\x86\release\applications\ServerBrowserApplicationWX\src\MyApp.cpp.obj build\.objs\ServerBrowserApplicationWX\windows\x86\release\applications\ServerBrowserApplicationWX\src\MyFrame.cpp.obj build\.objs\ServerBrowserApplicationWX\windows\x86\release\applications\ServerBrowserApplicationWX\ServerBrowserApplicationWX.rc.obj build\.objs\ServerBrowserApplicationWX\windows\x86\release\gens\applications\ServerBrowserApplicationWX\src\cxx\pch.hpp.pch.obj
No, it does compile with /subsystem:windows.
Why are you generating a cmakelists then a .sln? You can generate a Visual Studio project using either vs or vsxmake project generator.
No, it does compile with /subsystem:windows.
It compiles, it links, but it doesn't run. Once I changed manually in the project settings generated by xmake (and cmake) to Subsystem: Windows I assumed it was a linking issue
Why are you generating a cmakelists then a .sln? You can generate a Visual Studio project using either vs or vsxmake project generator.
My bad, sorry. Generating through vsxmake setups correctly the Subsystem:
Trying to run it:
Somehow vsxmake is different than doing xmake > cmake > sln?
If possible, use xmake to build the project directly.
If possible, use xmake to build the project directly.
Visual Studio used xmake in the background
yeah, vsxmake will use it. please use vsxmake or use xmake directly.
yeah, vsxmake will use it. please use vsxmake or use xmake directly.
Ok, but program doesn't work using xmake anyway, and I don't know why. It used to work in the cmake, and if I generate the cmakefiles it does indeed work if Subsystem is changed manually
Ok, but program doesn't work using xmake anyway
please show me your xmake.lua and all logs.
xmake f -cvD
xmake -rvD
Bot detected the issue body's language is not English, translate it automatically.
xmake.lua
xmake f -cvD first.log
xmake -rvD second.log
-subsystem:windows /manifestinput:applications\ServerBrowserApplicationWX\ServerBrowserApplicationWX.manifest /manifestuac:no /manifest:embed -out:build\windows\x86\release\ServerBrowserApplicationWX.exe
-subsystem:windows
has been added.
-subsystem:windows /manifestinput:applications\ServerBrowserApplicationWX\ServerBrowserApplicationWX.manifest /manifestuac:no /manifest:embed -out:build\windows\x86\release\ServerBrowserApplicationWX.exe
-subsystem:windows
has been added.
yes, and trying to run it:
you can debug it, maybe .dll PATH issues, maybe your code has bug, or ...
you can debug it, maybe .dll PATH issues, maybe your code has bug, or ...
works fine in cmake, no code changed and linking against the wxwidgets lib generated by xmake
you can check ldflags difference between cmake and xmake.
Or you can provide a complete reproducible project and I'll take a look at it.
Found the issue, adding this flag fixes it.
This flag is enabled by default (see https://learn.microsoft.com/en-us/cpp/build/reference/incremental-link-incrementally), I doubt it changes anything.
This flag is enabled by default (see https://learn.microsoft.com/en-us/cpp/build/reference/incremental-link-incrementally), I doubt it changes anything.
maybe /opt:ref /opt:icf
will disable this flag by default? set_strip(true)
or release mode will add them.
Most programs can be linked incrementally. However, some changes are too great, and some options are incompatible with incremental linking. LINK performs a full link if any of the following options are specified:
Link Incrementally isn't selected (/INCREMENTAL:NO) /OPT:REF is selected /OPT:ICF is selected
Found the issue, adding this flag fixes it.
you can try debug mode. xmake f -m debug; xmake ; xmake run
Found the issue, adding this flag fixes it.
you can try debug mode.
xmake f -m debug; xmake ; xmake run
I'm having some issues building with debug mode, they're building with MT instead of MTd runtime in debug mode, same with tests
Try
set_runtimes(is_mode("debug") and "MDd" or "MD")
Try
set_runtimes(is_mode("debug") and "MDd" or "MD")
thanks, it works
now i have made a a clean build and seems like /incremental doesn't fix anything, probably it's a wxwidgets linking issue (i rewrote the script to build as static)
Xmake Version
2.8.7
Operating System Version and Architecture
Windows 11
Describe Bug
set_kind doesn't have any configuration property like CMake does so attempting to run the .exe, it just doesn't work.
Expected Behavior
A fully working Windows application
Project Configuration
Additional Information and Error Logs
Trying to run it with xmake run gives: