包是否可以传递编译&链接选项给依赖目标? #3302
MasterBalll
started this conversation in
General
Replies: 3 comments 6 replies
-
加上 |
Beta Was this translation helpful? Give feedback.
3 replies
-
set_xmakever("2.3.6")
set_languages("c99")
add_rules("mode.debug", "mode.release")
if is_plat("windows") then
set_toolchains("msvc")
elseif is_plat("cross") then
if is_arch("xtensa") then
add_rules("xtensa")
set_toolchains("xcc")
end
end
simStr = get_config("sim")
if simStr == "dmx1aRI04" then
add_requires(
"DMX_Signal", "xtcstub"
,{configs = {sim = simStr}, debug = is_mode("debug")}
)
end
target("try")
set_kind("static")
add_packages("xtcstub", "DMX_Signal", {public = true})
add_includedirs("src", {public = true})
add_headerfiles("src/*.h")
add_files("src/*.c")
target_end()
target("try_demo")
set_kind("binary")
add_deps("try")
add_files("*.c")
target_end()
option("sim")
set_default("pc")
option_end() $ xmake f -p windows -a x86 -m release --sim=dmx1aRI04 -c -vD
checking for cl.exe ... C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\bin\HostX86\x86\cl.exe
checking for Microsoft Visual Studio (x86) version ... 2022
checkinfo: cannot runv(dmd --version), No such file or directory
checking for dmd ... no
checkinfo: cannot runv(ldc2 --version), No such file or directory
checking for ldc2 ... no
checkinfo: cannot runv(gdc --version), No such file or directory
checking for gdc ... no
checkinfo: cannot runv(zig version), No such file or directory
checking for zig ... no
checkinfo: cannot runv(zig version), No such file or directory
checking for zig ... no
checking for unzip ... ok
checking for git ... ok
checking for gzip ... ok
checking for tar ... ok
git rev-parse HEAD
finding xtcstub from xmake ..
checking for xmake::xtcstub ... no
finding DMX_Signal from xmake ..
checking for xmake::DMX_Signal ... DMX_Signal @default
note: install or modify (m) these packages (pass -y to skip confirm)?
in ezRepo-loc:
-> xtcstub @default [vs_runtime:"MT", toolcha ..)
please input: y (y/n/m)
checking for ping ... ok
pinging for the host(soundplus.lab) ... 46 ms
git -c core.fsmonitor=false clean -d -f -x
git -c core.fsmonitor=false reset --hard
HEAD is now at c1a84dd add | mode rules
finding xtcstub from xmake ..
checking for xmake::xtcstub ... xtcstub @default
{
version = "@default",
linkdirs = {
"C:\Users\Dell\AppData\Local\.xmake\packages\x\xtcstub\@default\4c8d4d347fc4458b86969cd24e258ee1\lib"
},
static = true,
links = {
"SimulationEnvironment"
},
ldflags = "-nodefaultlib:msvcrt.lib",
sysincludedirs = {
"C:\Users\Dell\AppData\Local\.xmake\packages\x\xtcstub\@default\4c8d4d347fc4458b86969cd24e258ee1\include"
},
libfiles = {
"C:\Users\Dell\AppData\Local\.xmake\packages\x\xtcstub\@default\4c8d4d347fc4458b86969cd24e258ee1\lib\SimulationEnvironment.lib"
}
}
patching C:\Users\Dell\AppData\Local\.xmake\packages\x\xtcstub\@default\4c8d4d347fc4458b86969cd24e258ee1\lib\pkgconfig\xtcstub.pc ..
checking for link.exe ... C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\bin\HostX86\x86\link.exe
checking for the linker (ld) ... link.exe
checking for cl.exe ... C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\bin\HostX86\x86\cl.exe
checking for the c compiler (cc) ... cl.exe
checking for C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\bin\HostX86\x86\cl.exe ... ok
checking for flags (/MT) ... ok
> cl.exe "/MT" "-nologo"
checking for flags (cl_external_includedir) ... ok
> cl.exe "-external:W0" "-external:IC:\Users\Dell\AppData\Local\.xmake\packages\x\xtcstub\@default\4c8d4d347fc4458b86969cd24e258ee1\include" "-nologo"
> "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.31.31103\\bin\\HostX86\\x86\\cl.exe" -c -nologo /MT -external:W0 -external:IC:\Users\Dell\AppData\Local\.xmake\packages\x\xtcstub\@default\4c8d4d347fc4458b86969cd24e258ee1\include -FoC:\Users\Dell\AppData\Local\Temp\.xmake\230117\_7A305A4DB16546108B476249F53C4080.o C:\Users\Dell\AppData\Local\Temp\.xmake\230117\_41D299B78C7446A1B28B9F553FAE85D5.c
> "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.31.31103\\bin\\HostX86\\x86\\link.exe" -nologo -dynamicbase -nxcompat -machine:x86 -nodefaultlib:msvcrt.lib -libpath:C:\Users\Dell\AppData\Local\.xmake\packages\x\xtcstub\@default\4c8d4d347fc4458b86969cd24e258ee1\lib SimulationEnvironment.lib -out:C:\Users\Dell\AppData\Local\Temp\.xmake\230117\_7A305A4DB16546108B476249F53C4080.b C:\Users\Dell\AppData\Local\Temp\.xmake\230117\_7A305A4DB16546108B476249F53C4080.o
> checking for c includes(cstubs.h)
> checking for c links(SimulationEnvironment)
> checking for c snippet(has_cincludes)
=> install xtcstub @default .. ok
configure
{
ndk_stdcxx = true
mode = release
buildir = build
kind = static
vs = 2022
host = windows
arch = x86
sim = dmx1aRI04
plat = windows
ccache = true
clean = true
}
$ xmake -rvD
checking for the c compiler (cc) ... cl.exe
checking for flags (-O2 -fp:fast) ...
ok
> cl.exe "-O2" "-fp:fast"
checking for flags (-DNDEBUG) ... ok
> cl.exe "-DNDEBUG" "-nologo"
[ 25%]: cache compiling.release src\hello.c
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.31.31103\\bin\\HostX86\\x86\\cl.exe" -c -nologo -O2 -fp:fast -TP -Isrc /EHsc -external:W0 -external:IC:\Users\Dell\AppData\Local\.xmake\packages\d\dmx_signal\@default\4c8d4d347fc4458b86969cd24e258ee1\include -external:W0 -external:IC:\Users\Dell\AppData\Local\.xmake\packages\d\dmx_signal\@default\4c8d4d347fc4458b86969cd24e258ee1\include\dsp -external:W0 -external:IC:\Users\Dell\AppData\Local\.xmake\packages\d\dmx_signal\@default\4c8d4d347fc4458b86969cd24e258ee1\include\ml -external:W0 -external:IC:\Users\Dell\AppData\Local\.xmake\packages\x\xtcstub\@default\4c8d4d347fc4458b86969cd24e258ee1\include -DNDEBUG -Fobuild\.objs\try\windows\x86\release\src\hello.c.obj src\hello.c
checking for the c compiler (cc) ... cl.exe
[ 25%]: cache compiling.release main.c"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.31.31103\\bin\\HostX86\\x86\\cl.exe" -c -nologo -O2 -fp:fast -TP -Isrc /EHsc -external:W0 -external:IC:\Users\Dell\AppData\Local\.xmake\packages\d\dmx_signal\@default\4c8d4d347fc4458b86969cd24e258ee1\include -external:W0 -external:IC:\Users\Dell\AppData\Local\.xmake\packages\d\dmx_signal\@default\4c8d4d347fc4458b86969cd24e258ee1\include\dsp -external:W0 -external:IC:\Users\Dell\AppData\Local\.xmake\packages\d\dmx_signal\@default\4c8d4d347fc4458b86969cd24e258ee1\include\ml -external:W0 -external:IC:\Users\Dell\AppData\Local\.xmake\packages\x\xtcstub\@default\4c8d4d347fc4458b86969cd24e258ee1\include -DNDEBUG -Fobuild\.objs\try_demo\windows\x86\release\main.c.obj main.c
checking for flags (cl_sourceDependencies) ... ok
> cl.exe "/sourceDependencies" "C:\Users\Dell\AppData\Local\Temp\.xmake\230117\_27963F682E264B408D231E5C4B9CE470.json" "-nologo"
checking for link.exe ... C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\bin\HostX86\x86\link.exe
checking for the static library archiver (ar) ... link.exe
[ 50%]: archiving.release try.lib
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.31.31103\\bin\\HostX86\\x86\\link.exe" -lib -nologo -machine:x86 /opt:ref /opt:icf -out:build\windows\x86\release\try.lib build\.objs\try\windows\x86\release\src\hello.c.obj
[ 75%]: linking.release try_demo.exe
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.31.31103\\bin\\HostX86\\x86\\link.exe" -nologo -dynamicbase -nxcompat
-machine:x86 -libpath:build\windows\x86\release -libpath:C:\Users\Dell\AppData\Local\.xmake\packages\d\dmx_signal\@default\4c8d4d347fc4458b86969cd24e258ee1\lib -libpath:C:\Users\Dell\AppData\Local\.xmake\packages\x\xtcstub\@default\4c8d4d347fc4458b86969cd24e258ee1\lib /opt:ref /opt:icf try.lib DSPLib.lib MachineLearningLib.lib SimulationEnvironment.lib -out:build\windows\x86\release\try_demo.exe build\.objs\try_demo\windows\x86\release\main.c.obj
error: @programdir\modules\private\async\runjobs.lua:256: @programdir\actions\build\kinds\binary.lua:74: @programdir\modules\core\tools\link.lua:164: LINK : warning LNK4098: 默认库“MSVCRT”与
其他库的使用冲突;请使用 /NODEFAULTLIB:library
LINK : warning LNK4217:符号“_exit”(在“ libucrt.lib(exit.obj)”中定义)已由“SimulationEnvironment.lib(cstubs-0.obj)”(函数“"void __cdecl cstub_ExportState_Internal(struct cstub_Xm_dmx1a_ExportState_Internal *,unsigned int *)" (?cstub_ExportState_Internal@@YAXPAUcstub_Xm_dmx1a_ExportState_Internal@@PAI@Z)”中
)导入
LINK : warning LNK4217:符号“_exit”(在“ libucrt.lib(exit.obj)”中定义)已由“SimulationEnvironment.lib(cstubs-1.obj)”(函数“"void __cdecl cstub_Xm_dmx1a__TIE_dmx1a_common_tie_mir30_storei(class mir30_space::mir30_ const &,class mir30_space::mir30_ const *,int)" (?cstub_Xm_dmx1a__TIE_dmx1a_common_tie_mir30_storei@@YAXABVmir30_@mir30_space@@PBV12@H@Z)”中)导入
LINK : warning LNK4286:符号“_exit”(在“libucrt.lib(exit.obj)”中定义)已由“SimulationEnvironment.lib(cstubs-2.obj)”导
入
LINK : warning LNK4217:符号“___acrt_iob_func”(在“ libucrt.lib(_file.obj)”中
定义)已由“SimulationEnvironment.lib(cstubs-0.obj)”(函数“"void __cdecl cstub_ExportState_Internal(struct cstub_Xm_dmx1a_ExportState_Internal *,unsigned int *)" (?cstub_ExportState_Internal@@YAXPAUcstub_Xm_dmx1a_ExportState_Internal@@PAI@Z)”中)导入
LINK : warning LNK4217:符号“___acrt_iob_func”(在“ libucrt.lib(_file.obj)”中
定义)已由“SimulationEnvironment.lib(cstubs-1.obj)”(函数“"void __cdecl cstub_Xm_dmx1a__TIE_dmx1a_common_tie_cr64_storei(class cr64_space::cr64_ const &,class cr64_space::cr64_ const *,int)" (?cstub_Xm_dmx1a__TIE_dmx1a_common_tie_cr64_storei@@YAXABVcr64_@cr64_space@@PBV12@H@Z)”中)导入
LINK : warning LNK4286:符号“___acrt_iob_func”(在“libucrt.lib(_file.obj)”中定
义)已由“SimulationEnvironment.lib(cstubs-2.obj)”导入
LINK : warning LNK4217:符号“___stdio_common_vfprintf”(在“ libucrt.lib(output.obj)”中定义)已由“SimulationEnvironment.lib(cstubs-0.obj)”(函数“__vfprintf_l”中)导入
LINK : warning LNK4217:符号“___stdio_common_vfprintf”(在“ libucrt.lib(output.obj)”中定义)已由“SimulationEnvironment.lib(cstubs-1.obj)”(函数“"class cr64_space::cr64_ __cdecl cstub_Xm_dmx1a__TIE_dmx1a_common_tie_cr64_loadi(class cr64_space::cr64_ const *,int)" (?cstub_Xm_dmx1a__TIE_dmx1a_common_tie_cr64_loadi@@YA?AVcr64_@cr64_space@@PBV12@H@Z)”中)导入
LINK : warning LNK4286:符号“___stdio_common_vfprintf”(在“libucrt.lib(output.obj)”中定义)已由“SimulationEnvironment.lib(cstubs-2.obj)”导入
MSVCRT.lib(chandler4gs.obj) : error LNK2019: 无法解析的外部符号 __except_handler4_common,函数 __except_handler4
中引用了该符号
build\windows\x86\release\try_demo.exe : fatal error LNK1120: 1 个无法解析的
外部命令
stack traceback:
[C]: in function 'error'
[@programdir\core\base\os.lua:898]:
[@programdir\modules\core\tools\link.lua:164]: in function 'catch'
[@programdir\core\sandbox\modules\try.lua:123]: in function 'try'
[@programdir\modules\core\tools\link.lua:139]:
[C]: in function 'xpcall'
[@programdir\core\base\utils.lua:280]:
[@programdir\actions\build\kinds\binary.lua:74]: in function 'callback'
[@programdir\modules\core\project\depend.lua:193]: in function 'on_changed'
[@programdir\actions\build\kinds\binary.lua:55]: in function '_do_link_target'
[@programdir\actions\build\kinds\binary.lua:102]:
[@programdir\actions\build\kinds\binary.lua:129]: in function '_link_target'
[@programdir\actions\build\kinds\binary.lua:157]: in function 'jobfunc'
[@programdir\modules\private\async\runjobs.lua:232]:
[C]: in function 'xpcall'
[@programdir\core\base\utils.lua:280]: in function 'trycall'
[@programdir\core\sandbox\modules\try.lua:117]: in function 'try'
[@programdir\modules\private\async\runjobs.lua:218]: in function 'cotask'
[@programdir\core\base\scheduler.lua:404]:
stack traceback:
[C]: in function 'error'
@programdir\core\base\os.lua:898: in function 'base/os.raiselevel'
(...tail calls...)
@programdir\modules\private\async\runjobs.lua:256: in field 'catch'
@programdir\core\sandbox\modules\try.lua:123: in global 'try'
@programdir\modules\private\async\runjobs.lua:218: in upvalue 'cotask'
@programdir\core\base\scheduler.lua:404: in function <@programdir\core\base\scheduler.lua:397> |
Beta Was this translation helpful? Give feedback.
1 reply
-
我看里面已经带上了,但是目前 |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
尝试像这样写包描述,结果是不能在目标里生效。
Beta Was this translation helpful? Give feedback.
All reactions