[fixed] master no longer compilable because of wrong boost declaration

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

[fixed] master no longer compilable because of wrong boost declaration

Post by uwestoehr »

curent master does not compile, because line

Code: Select all

boost::tokenizer<boost::char_separator<char> > tokens(view, sep);
in src/Base/Builder3D.cpp
triggers this error:

Code: Select all

1>D:/FreeCAD-build/LibPack-OCC76-V2/include\boost/tokenizer.hpp(63,15): error C2665: 'std::_String_const_iterator<std::_String_val<std::_Simple_types<_Elem>>>::_String_const_iterator': none of the 4 overloads could convert all the argument types
1>        with
1>        [
1>            _Elem=char
1>        ]
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\xstring(2069,1): message : could be 'std::_String_const_iterator<std::_String_val<std::_Simple_types<_Elem>>>::_String_const_iterator(std::_String_const_iterator<std::_String_val<std::_Simple_types<_Elem>>> &&)'
1>        with
1>        [
1>            _Elem=char
1>        ]
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\xstring(2069,1): message : or       'std::_String_const_iterator<std::_String_val<std::_Simple_types<_Elem>>>::_String_const_iterator(const std::_String_const_iterator<std::_String_val<std::_Simple_types<_Elem>>> &)'
1>        with
1>        [
1>            _Elem=char
1>        ]
1>D:/FreeCAD-build/LibPack-OCC76-V2/include\boost/tokenizer.hpp(63,15): message : 'std::_String_const_iterator<std::_String_val<std::_Simple_types<_Elem>>>::_String_const_iterator(const std::_String_const_iterator<std::_String_val<std::_Simple_types<_Elem>>> &)': cannot convert argument 1 from 'std::_String_view_iterator<_Traits>' to 'const std::_String_const_iterator<std::_String_val<std::_Simple_types<_Elem>>> &'
1>        with
1>        [
1>            _Elem=char
1>        ]
1>        and
1>        [
1>            _Traits=std::char_traits<char>
1>        ]
1>        and
1>        [
1>            _Elem=char
1>        ]
1>D:/FreeCAD-build/LibPack-OCC76-V2/include\boost/tokenizer.hpp(63,44): message : Reason: cannot convert from 'std::_String_view_iterator<_Traits>' to 'const std::_String_const_iterator<std::_String_val<std::_Simple_types<_Elem>>>'
1>        with
1>        [
1>            _Traits=std::char_traits<char>
1>        ]
1>        and
1>        [
1>            _Elem=char
1>        ]
1>D:/FreeCAD-build/LibPack-OCC76-V2/include\boost/tokenizer.hpp(63,23): message : No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\xstring(2069,1): message : see declaration of 'std::_String_const_iterator<std::_String_val<std::_Simple_types<_Elem>>>::_String_const_iterator'
1>        with
1>        [
1>            _Elem=char
1>        ]
1>D:/FreeCAD-build/LibPack-OCC76-V2/include\boost/tokenizer.hpp(63,44): message : while trying to match the argument list '(std::_String_view_iterator<_Traits>)'
1>        with
1>        [
1>            _Traits=std::char_traits<char>
1>        ]
1>D:\FreeCAD-git\src\Base\Builder3D.cpp(1132): message : see reference to function template instantiation 'boost::tokenizer<boost::char_separator<char,std::char_traits<char>>,std::_String_const_iterator<std::_String_val<std::_Simple_types<_Elem>>>,std::string>::tokenizer<std::string_view>(const Container &,const TokenizerFunc &)' being compiled
1>        with
1>        [
1>            _Elem=char,
1>            Container=std::string_view,
1>            TokenizerFunc=boost::char_separator<char,std::char_traits<char>>
1>        ]
1>D:\FreeCAD-git\src\Base\Builder3D.cpp(1132): message : see reference to function template instantiation 'boost::tokenizer<boost::char_separator<char,std::char_traits<char>>,std::_String_const_iterator<std::_String_val<std::_Simple_types<_Elem>>>,std::string>::tokenizer<std::string_view>(const Container &,const TokenizerFunc &)' being compiled
1>        with
1>        [
1>            _Elem=char,
1>            Container=std::string_view,
1>            TokenizerFunc=boost::char_separator<char,std::char_traits<char>>
1>        ]
1>D:/FreeCAD-build/LibPack-OCC76-V2/include\boost/tokenizer.hpp(63,33): error C2665: 'std::_String_const_iterator<std::_String_val<std::_Simple_types<_Elem>>>::_String_const_iterator': none of the 4 overloads could convert all the argument types
1>        with
1>        [
1>            _Elem=char
1>        ]
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\xstring(2069,1): message : could be 'std::_String_const_iterator<std::_String_val<std::_Simple_types<_Elem>>>::_String_const_iterator(std::_String_const_iterator<std::_String_val<std::_Simple_types<_Elem>>> &&)'
1>        with
1>        [
1>            _Elem=char
1>        ]
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\xstring(2069,1): message : or       'std::_String_const_iterator<std::_String_val<std::_Simple_types<_Elem>>>::_String_const_iterator(const std::_String_const_iterator<std::_String_val<std::_Simple_types<_Elem>>> &)'
1>        with
1>        [
1>            _Elem=char
1>        ]
1>D:/FreeCAD-build/LibPack-OCC76-V2/include\boost/tokenizer.hpp(63,33): message : 'std::_String_const_iterator<std::_String_val<std::_Simple_types<_Elem>>>::_String_const_iterator(const std::_String_const_iterator<std::_String_val<std::_Simple_types<_Elem>>> &)': cannot convert argument 1 from 'std::_String_view_iterator<_Traits>' to 'const std::_String_const_iterator<std::_String_val<std::_Simple_types<_Elem>>> &'
1>        with
1>        [
1>            _Elem=char
1>        ]
1>        and
1>        [
1>            _Traits=std::char_traits<char>
1>        ]
1>        and
1>        [
1>            _Elem=char
1>        ]
1>D:/FreeCAD-build/LibPack-OCC76-V2/include\boost/tokenizer.hpp(63,44): message : Reason: cannot convert from 'std::_String_view_iterator<_Traits>' to 'const std::_String_const_iterator<std::_String_val<std::_Simple_types<_Elem>>>'
1>        with
1>        [
1>            _Traits=std::char_traits<char>
1>        ]
1>        and
1>        [
1>            _Elem=char
1>        ]
1>D:/FreeCAD-build/LibPack-OCC76-V2/include\boost/tokenizer.hpp(63,39): message : No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\xstring(2069,1): message : see declaration of 'std::_String_const_iterator<std::_String_val<std::_Simple_types<_Elem>>>::_String_const_iterator'
1>        with
1>        [
1>            _Elem=char
1>        ]
1>D:/FreeCAD-build/LibPack-OCC76-V2/include\boost/tokenizer.hpp(63,44): message : while trying to match the argument list '(std::_String_view_iterator<_Traits>)'
1>        with
1>        [
1>            _Traits=std::char_traits<char>
1>        ]
If I change the definition of "view" to

Code: Select all

std::string view = str;
The error vanishes. So apparently our boost (version 1.67) in the LibPack cannot handle std::string_view.

@wmayer , what do you propose, do we need to lift our boost version?
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: master no longer compilable because of wrong boost declaration

Post by uwestoehr »

Googling does not bring much, except of this pending boost issue:
https://github.com/boostorg/tokenizer/issues/15
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: master no longer compilable because of wrong boost declaration

Post by uwestoehr »

Hmm, with my "workaround" of using std::view, I can only compile Base and App but FreeCADGui fails with an unresolved external:

Code: Select all

3>   Creating library D:/FreeCAD-build/src/Gui/Release/FreeCADGui.lib and object D:/FreeCAD-build/src/Gui/Release/FreeCADGui.exp
3>SplitView3DInventor.obj : error LNK2019: unresolved external symbol "class Base::Vector3<float> __cdecl Base::to_vector(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?to_vector@Base@@YA?AV?$Vector3@M@1@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: virtual void __cdecl Gui::AbstractSplitView::OnChange(class Base::Subject<char const *> &,char const *)" (?OnChange@AbstractSplitView@Gui@@UEAAXAEAV?$Subject@PEBD@Base@@PEBD@Z)
3>View3DInventor.obj : error LNK2001: unresolved external symbol "class Base::Vector3<float> __cdecl Base::to_vector(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?to_vector@Base@@YA?AV?$Vector3@M@1@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
3>D:\FreeCAD-build\bin\FreeCADGui.dll : fatal error LNK1120: 1 unresolved externals
3>Done building project "FreeCADGui.vcxproj" -- FAILED.
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: master no longer compilable because of wrong boost declaration

Post by wmayer »

Wait a moment...
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: master no longer compilable because of wrong boost declaration

Post by uwestoehr »

wmayer wrote: Wed Oct 05, 2022 7:52 pm ...git commit 96606c557c
Thanks! However this fixs the compilation up to FreeCADGui, partGui is still not compilable because CMake says me this target contains no files at all.

I spent now some time to find the problem and as strange as it is, this bug is introduced by this commit:
https://github.com/FreeCAD/FreeCAD/comm ... 71adac78a8

But it looks OK. I don't understand why this empties the file list in PartGui.vcxxproj file after running CMake . I already setup the build environment from scratch, meaning removing any build files like *.pch, the CMake cache etc. but the problem persists.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: master no longer compilable because of wrong boost declaration

Post by uwestoehr »

uwestoehr wrote: Wed Oct 05, 2022 8:33 pm I spent now some time to find the problem and as strange as it is, this bug is introduced by this commit:
https://github.com/FreeCAD/FreeCAD/comm ... 71adac78a8
So I get now always this error:

Code: Select all

95>D:\FreeCAD-build\src\Mod\Part\Gui\PartGui.vcxproj(923,5): error MSB4035: The required attribute "Include" is empty or missing from the element <CustomBuild>.
And my PartGui.vcxproj line 922 ff. is this:

Code: Select all

<ItemGroup>
    <CustomBuild Include="">
      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Generating ui_DlgImportExportStep.h</Message>
      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">setlocal
..\..\..\..\LibPack-OCC76-V2\bin\uic.exe -o D:/FreeCAD-build/src/Mod/Part/Gui/ui_DlgImportExportStep.h D:/FreeCAD-git/src/Mod/Part/Gui/DlgImportExportStep.ui
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal &amp; call :cmErrorLevel %errorlevel% &amp; goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd</Command>
      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">D:\FreeCAD-git\src\Mod\Part\Gui\DlgImportExportStep.ui;%(AdditionalInputs)</AdditionalInputs>
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">D:\FreeCAD-build\src\Mod\Part\Gui\ui_DlgImportExportStep.h</Outputs>
      <LinkObjects Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkObjects>
      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Generating ui_DlgImportExportStep.h</Message>
      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">setlocal
..\..\..\..\LibPack-OCC76-V2\bin\uic.exe -o D:/FreeCAD-build/src/Mod/Part/Gui/ui_DlgImportExportStep.h D:/FreeCAD-git/src/Mod/Part/Gui/DlgImportExportStep.ui
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal &amp; call :cmErrorLevel %errorlevel% &amp; goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd</Command>
      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">D:\FreeCAD-git\src\Mod\Part\Gui\DlgImportExportStep.ui;%(AdditionalInputs)</AdditionalInputs>
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">D:\FreeCAD-build\src\Mod\Part\Gui\ui_DlgImportExportStep.h</Outputs>
      <LinkObjects Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkObjects>
      <Message Condition="'$(Configuration)|$(Platform)'=='MinSizeRel|x64'">Generating ui_DlgImportExportStep.h</Message>
      <Command Condition="'$(Configuration)|$(Platform)'=='MinSizeRel|x64'">setlocal
..\..\..\..\LibPack-OCC76-V2\bin\uic.exe -o D:/FreeCAD-build/src/Mod/Part/Gui/ui_DlgImportExportStep.h D:/FreeCAD-git/src/Mod/Part/Gui/DlgImportExportStep.ui
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal &amp; call :cmErrorLevel %errorlevel% &amp; goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd</Command>
      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='MinSizeRel|x64'">D:\FreeCAD-git\src\Mod\Part\Gui\DlgImportExportStep.ui;%(AdditionalInputs)</AdditionalInputs>
      <Outputs Condition="'$(Configuration)|$(Platform)'=='MinSizeRel|x64'">D:\FreeCAD-build\src\Mod\Part\Gui\ui_DlgImportExportStep.h</Outputs>
      <LinkObjects Condition="'$(Configuration)|$(Platform)'=='MinSizeRel|x64'">false</LinkObjects>
      <Message Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|x64'">Generating ui_DlgImportExportStep.h</Message>
      <Command Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|x64'">setlocal
..\..\..\..\LibPack-OCC76-V2\bin\uic.exe -o D:/FreeCAD-build/src/Mod/Part/Gui/ui_DlgImportExportStep.h D:/FreeCAD-git/src/Mod/Part/Gui/DlgImportExportStep.ui
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal &amp; call :cmErrorLevel %errorlevel% &amp; goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd</Command>
      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|x64'">D:\FreeCAD-git\src\Mod\Part\Gui\DlgImportExportStep.ui;%(AdditionalInputs)</AdditionalInputs>
      <Outputs Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|x64'">D:\FreeCAD-build\src\Mod\Part\Gui\ui_DlgImportExportStep.h</Outputs>
      <LinkObjects Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|x64'">false</LinkObjects>
    </CustomBuild>
  </ItemGroup>
So CMake cannot find the include for the target ui_DlgImportExportStep.h Do you have any idea what I can do?
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: master no longer compilable because of wrong boost declaration

Post by uwestoehr »

uwestoehr wrote: Wed Oct 05, 2022 8:45 pm So CMake cannot find the include for the target ui_DlgImportExportStep.h Do you have any idea what I can do?
OK, got it now, this is the fix:

Code: Select all

diff --git "a/src/Mod/Part/Gui/CMakeLists.txt" "b/src/Mod/Part/Gui/CMakeLists.txt"
index 6b389de5fb..5b61d70a85 100644
--- "a/src/Mod/Part/Gui/CMakeLists.txt"
+++ "b/src/Mod/Part/Gui/CMakeLists.txt"
@@ -54,7 +54,6 @@ set(PartGui_UIC_SRCS
     DlgImportStep.ui
     DlgFilletEdges.ui
     DlgImportExportIges.ui
-    DlgImportExportStep.ui
     DlgPartBox.ui
     DlgPartCylinder.ui
     DlgPartImportIges.ui
I will commit later.
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: master no longer compilable because of wrong boost declaration

Post by wmayer »

I have done a full build with MSVC and for me all issues are fixed.

Don't know what's wrong with your PartGui target but you can touch any CMakeLists.txt file and then run a build. This should trigger a CMake configure step and eventually refreshes the invalid vcxproj file.

This line

Code: Select all

..\..\..\..\LibPack-OCC76-V2\bin\uic.exe -o D:/FreeCAD-build/src/Mod/Part/Gui/ui_DlgImportExportStep.h D:/FreeCAD-git/src/Mod/Part/Gui/DlgImportExportStep.ui
is invalid because DlgImportExportStep.ui has been removed with git commit 7bc369932efc
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: master no longer compilable because of wrong boost declaration

Post by uwestoehr »

uwestoehr wrote: Wed Oct 05, 2022 8:51 pm I will commit later.
Done: git commit 920468a8
Post Reply