Discussion:
[Boost-users] [clang-win][bjam][context] '-c' is not recognized as an internal or external command
Mikhail Strelnikov
2017-02-05 10:33:44 UTC
Permalink
Hello Boost,

I'd like to build Boost.Context with clang on Windows with BB.

There are my files:


site-config.jam:

using clang-win : : "C:/Program Files/LLVM/bin/clang-cl.exe" :
<compatibility>vc14 <cxxflags>-Xclang <cxxflags>-std=c++1z
<cxxflags>-DBOOST_USE_WINDOWS_H <cxxflags>-DNOMINMAX
<cxxflags>-DWIN32_LEAN_AND_MEAN <cxxflags>-D_HAS_AUTO_PTR_ETC=1 ;


Jamroot:

local BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ;

project main
: source-location .
: requirements
<include>$(BOOST_ROOT)

<define>BOOST_ALL_NO_LIB=1
;

use-project /boost : $(BOOST_ROOT) ;

exe main : main.cpp /boost//coroutine /boost//date_time ;


main.cpp

int main() {}


I run the command:

b2.exe -d+2 toolset=clang-win address-model=64 link=static
runtime-link=static release -sBOOST_ROOT=D:\path\to\boost


This gives me following error:

clang-win.compile.asm
D:\path\to\boost\bin.v2\libs\context\build\clang-vc14-win\release\link-static\runtime-link-static\threading-multi\asm\make_x86_64_ms_pe_gas.obj

-c -Zp4 -Cp -Cx -DBOOST_ALL_NO_LIB=1 -DBOOST_CONTEXT_SOURCE
-DBOOST_DISABLE_ASSERTS -DNDEBUG -DBOOST_ALL_NO_LIB=1
-DBOOST_CONTEXT_SOURCE -DBOOST_DISABLE_ASSERTS -DNDEBUG /W3 -Fo
"D:\path\to\boost\bin.v2\libs\context\build\clang-vc14-win\release\link-static\runtime-link-static\threading-multi\asm\make_x86_64_ms_pe_gas.obj"
"D:\path\to\boost\libs\context\src\asm\make_x86_64_ms_pe_gas.asm"

'-c' is not recognized as an internal or external command,

Am I doing something wrong?

Thanks.
Oliver Kowalke
2017-02-05 11:17:57 UTC
Permalink
Post by Mikhail Strelnikov
'-c' is not recognized as an internal or external command,
clang on Win does not recognize cmd line option '-c' that might be set by
boost.build
Mikhail Strelnikov
2017-02-05 12:34:18 UTC
Permalink
Oliver, thank you for your answer.

But clang does recognize '-c' on Windows as it uses it to compile all
other files.

When I invoke b2.exe with "toolset=msvc-14.0", the command looks like this:

ml64 -nologo -c -Zp4 -Cp -Cx -DBOOST_ALL_NO_LIB=1
-DBOOST_CONTEXT_EXPORT= -DBOOST_CONTEXT_SOURCE -DBOOST_DISABLE_ASSERTS
-DNDEBUG -DBOOST_ALL_NO_LIB=1 -DBOOST_CONTEXT_EXPORT=
-DBOOST_CONTEXT_SOURCE -DBOOST_DISABLE_ASSERTS -DNDEBUG /W3 -Fo
"D:\path\to\boost\bin.v2\libs\context\build\msvc-14.0\release\address-model-64\link-static\runtime-link-static\threading-multi\asm\make_x86_64_ms_pe_masm.obj"
"D:\path\to\boost\libs\context\src\asm\make_x86_64_ms_pe_masm.asm"

But when "toolset=clang-win" the command becomes:

-c -Zp4 -Cp -Cx -DBOOST_ALL_NO_LIB=1 -DBOOST_CONTEXT_SOURCE
-DBOOST_DISABLE_ASSERTS -DNDEBUG -DBOOST_ALL_NO_LIB=1
-DBOOST_CONTEXT_SOURCE -DBOOST_DISABLE_ASSERTS -DNDEBUG /W3 -Fo
"D:\path\to\boost\bin.v2\libs\context\build\clang-vc14-win\release\link-static\runtime-link-static\threading-multi\asm\make_x86_64_ms_pe_gas.obj"
"D:\path\to\boost\libs\context\src\asm\make_x86_64_ms_pe_gas.asm"

I see two problems here:

1) BB does not know the name of assembler when clang-win is used;
2) BB tries to use command arguments from ml64.exe (all those -Zp4,
-Cp and -Fo belong to Microsoft Assembler) to compile gas source.
2017-02-05 11:33 GMT+01:00 Mikhail Strelnikov
Post by Mikhail Strelnikov
'-c' is not recognized as an internal or external command,
clang on Win does not recognize cmd line option '-c' that might be set by
boost.build
_______________________________________________
Boost-users mailing list
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Oliver Kowalke
2017-02-06 12:40:15 UTC
Permalink
try following modification:

file context/build/Jamfile.v2

for X86_64/MS/PE change '<toolset>clang' into '<toolset>clang-win' (should
be line 799)
Mikhail Strelnikov
2017-02-06 17:18:16 UTC
Permalink
This helps. Now I'm getting command:

ml64 /c /Fo"D:\path\to\boost\bin.v2\libs\context\build\clang-vc14-win\release\link-static\runtime-link-static\threading-multi\asm\make_x86_64_ms_pe_masm.o"
"D:\path\to\boost\libs\context\src\asm\make_x86_64_ms_pe_masm.asm"

And new error is:

'ml64' is not recognized as an internal or external command, operable
program or batch file.

I think this happens because, for some reason, "$(setup-script)" is
not invoked. I'm reading file boost\tools\build\src\tools\msvc.jam,
line 1176 (I assume clang-win inherits from msvc):

toolset.flags msvc.compile .ASM <windows-api>$(api)/$(cpu-conditions)
: $(setup-script)$(cpu-assembler) -nologo ;

And also all those "-Zp4 -Cp -C" etc. are gone. How is that happening?
Post by Oliver Kowalke
file context/build/Jamfile.v2
for X86_64/MS/PE change '<toolset>clang' into '<toolset>clang-win' (should
be line 799)
_______________________________________________
Boost-users mailing list
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Continue reading on narkive:
Loading...