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

FreeCAD (RT Fork) #19175

Closed
1 of 6 tasks
wsteffe opened this issue Nov 24, 2023 · 57 comments
Closed
1 of 6 tasks

FreeCAD (RT Fork) #19175

wsteffe opened this issue Nov 24, 2023 · 57 comments

Comments

@wsteffe
Copy link

wsteffe commented Nov 24, 2023

Package name

FreeCAD Link

Brief description of package

It is the Link branch FreeCAD, with lots of new features and enhancement.
I need RT branch instead of master because I have to extrude multiple solids in a single body which is not allowed on FC master.
My layoutDD project which is an extension of klayout project (https://www.klayout.de/) imports python modules from FreeCAD LinkMerge fork. Currently it works on Linux but not on Windows platform because the python parser of klayout is built with Mingw64 and it is not compatible with windows realeses of FC (which are built with MS VS).

URL for package's homepage

https://github.com/realthunder/FreeCAD/tree/LinkMerge

Provide a basic test case to validate the package's functionality.

No response

MINGW environments where you need the package

  • MINGW64
  • MINGW32
  • UCRT64
  • CLANG64
  • CLANG32
  • CLANGARM64

Are you willing to submit a PR?

No response

@MehdiChinoune
Copy link
Collaborator

Well, there are two issues:

  • We don't package forks unless origin is unmaintained.
  • FreeCAD doesn't build with mingw-w64-gcc

It's recommended to use UCRT64 instead of MINGW64.

@sskras
Copy link

sskras commented Nov 24, 2023

@MehdiChinoune writes:

  • FreeCAD doesn't build with mingw-w64-gcc

Do you confirm that their page is wrong about using "mingw-w64 GCC toolchain" ?
https://wiki.freecad.org/Compile_on_MinGW#Install_basic_development_tools

You also state:

It's recommended to use UCRT64 instead of MINGW64.

This again contradicts a bit to what the aforementioned page says:

When launching MSYS2, use the "MSYS2 MinGW 64-bit" runtime unless you know what you are doing and have a specific reason not to. If you use the UCRT console, make sure to adapt your installation to use the UCRT packages instead.

If they write misleading things, it might be worth filing a corresponding issue in (or mentioning an existing one from) their repo.

EDIT: Ah, I get the 2nd part – you meant it's MSYS2 who recommend using UCRT64 instead of MINGW64.

@wsteffe
Copy link
Author

wsteffe commented Nov 24, 2023

RT fork includes anyway several improvements which have not yet been ported into master. One of these improvements is TopoNaming which porting is underway but not yet done.

If FreeCAD doesn't build with mingw-w64-gcc how was made the package
https://packages.msys2.org/base/mingw-w64-freecad ?

@MehdiChinoune
Copy link
Collaborator

Do you confirm that their page is wrong about using "mingw-w64 GCC toolchain" ?
https://wiki.freecad.org/Compile_on_MinGW#Install_basic_development_tools

I think It's unmaintained/outdated, try yourself building it on MINGW64 or UCRT64.
I tried packaging freecad for them but it failed, It needs some fixes for dll-import/export pragmas.

@wsteffe
Copy link
Author

wsteffe commented Nov 24, 2023

After a more careful insight I have understood that the FreeCAD package was done using CLANG64 (and not MINGW64) environment. The package name is misleading.

@MehdiChinoune
Copy link
Collaborator

There is a possibility to backport some patches if they are not that much. But I see the fork highly diverged from the upstream.
Maybe you could ask the fork maintainer to rebase his fork on the latest release/tag.

@wsteffe
Copy link
Author

wsteffe commented Nov 24, 2023

The LinkMerge Branch is the closest one to Master. It was rebased more or less in May 2023 (that is the reason of "Merge" tag added to the Branch name) but yes it is still very different.
The most important thing I need ported to master is the possibility to have more solids in the same Body. This was also asked at FreeCAD/FreeCAD#9747 from adrianinsaval but nobody is working on that and I don't think it will happen soon.

@wsteffe
Copy link
Author

wsteffe commented Nov 25, 2023

Hi MehdiChinoune
I confirm that FreeCAD can't be build with Mingw64. I have tried with RT Fork but I think it would be the same with master. With the RT Fork I had also to disable build_FEM because of an incompatibility between salomesmesh and VTK-9.3.0. I have applied the patch suggested by adrianinsaval but it was not enough.
Anyway here I would like to point to the following error that I get (among many others):

C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot export
_ZTVN3App8DocumentE: symbol not defined
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/Fre
eCADApp.dir/objects.a(Document.cpp.obj):Document.cpp:(.text+0x4cd9): undefined reference to `vtable for App::Document'

I have googled for mingw undefined vtable and I have found the page https://stackoverflow.com/questions/7720205/linking-error-undefined-reference-to-vtable-for-xxx which seems to me quite instructive.

More specifically I would like to point to the lines:

You must provide an implementation for all non-pure virtual functions you declare. In particular, G++ emits the vtable along with the implementation of the first-declared non-inline function in a class. Omitting its implementation means you won't have a vtable, and thus won't be able to construct the class (hence these errors)

But of course if the Mingw64 build problem with FreeCAD is also related with missing implementation of some virtual function it is something that should be fixed by FC developers.

@wwmayer
Copy link

wwmayer commented Nov 27, 2023

Two years ago I fully ported FreeCAD to MinGW64: https://forum.freecad.org/viewtopic.php?t=62169

At that time I was able to build the complete project. However, I couldn't get it working with gcc but clang. The build process gets stuck when it should link the FreeCADApp library. Actually, I don't get an error message but a never ending output message that I cancel after 20 minutes.

With clang I don't get this problem and I can still build FreeCAD with it (did it just yesterday) but I have to disable some modules now:

  • FEM/MeshPart because after an upgrade of my MinGW64 installation some months ago vtk causes several linking errors with the smesh code
  • Start/Web because QWebkit has been replaced with QWebEngine which isn't available for MinGW

@MehdiChinoune
Copy link
Collaborator

MehdiChinoune commented Nov 27, 2023

@wwmayer we have already freecad for clang64.

@wsteffe
Copy link
Author

wsteffe commented Nov 27, 2023

Yes I too had disabled those two modules (FEM and Web).
Regarding the gcc unfortunately I need it because I need to have a FC python module that is compatible with klayout (https://www.klayout.de). Klayout has an internal python interpreter. On windows platform it is built with mingw64 and, I think, with gcc compiler.

Here following cleaner output (just first lines of a long sequence) captured with make &> tmp

C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/FreeCADApp.dir/objects.a(Annotation.cpp.obj):Annotation.cpp:(.text+0x57): undefined reference to `Base::Type::Type(Base::Type const&)'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/FreeCADApp.dir/objects.a(Annotation.cpp.obj):Annotation.cpp:(.text+0x85): undefined reference to `Base::Type::Type(Base::Type const&)'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/FreeCADApp.dir/objects.a(Annotation.cpp.obj):Annotation.cpp:(.text+0x135): undefined reference to `Base::BaseClass::initSubclass(Base::Type&, char const*, char const*, void* (*)())'

@wsteffe
Copy link
Author

wsteffe commented Nov 27, 2023

Here is more detailed info obtained with
VERBOSE=1 make &> tmp

[  5%] Linking CXX shared library ../../bin/libFreeCADApp.dll
cd /C/msys64/home/walter/Software/FreeCad/FreeCAD/build/src/App && "/C/Program Files/CMake/bin/cmake.exe" -E rm -f CMakeFiles/FreeCADApp.dir/objects.a
cd /C/msys64/home/walter/Software/FreeCad/FreeCAD/build/src/App && /C/msys64/mingw64/bin/ar.exe qc CMakeFiles/FreeCADApp.dir/objects.a @CMakeFiles/FreeCADApp.dir/objects1.rsp
cd /C/msys64/home/walter/Software/FreeCad/FreeCAD/build/src/App && /C/msys64/mingw64/bin/c++.exe -Wall -Wextra -Wno-write-strings  -DBOOST_REGEX_NO_W32 -DBOOST_CORE_USE_GENERIC_CMATH -Wno-attributes -Wl,--dependency-file,CMakeFiles/FreeCADApp.dir/link.d -shared -o ../../bin/libFreeCADApp.dll -Wl,--out-implib,libFreeCADApp.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -Wl,--whole-archive CMakeFiles/FreeCADApp.dir/objects.a -Wl,--no-whole-archive @CMakeFiles/FreeCADApp.dir/linkLibs.rsp
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/FreeCADApp.dir/objects.a(Annotation.cpp.obj):Annotation.cpp:(.text+0x57): undefined reference to `Base::Type::Type(Base::Type const&)'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/FreeCADApp.dir/objects.a(Annotation.cpp.obj):Annotation.cpp:(.text+0x85): undefined reference to `Base::Type::Type(Base::Type const&)'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/FreeCADApp.dir/objects.a(Annotation.cpp.obj):Annotation.cpp:(.text+0x135): undefined reference to `Base::BaseClass::initSubclass(Base::Type&, char const*, char const*, void* (*)())'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/FreeCADApp.dir/objects.a(Annotation.cpp.obj):Annotation.cpp:(.text+0x281): undefined reference to `Base::Vector3<double>::Vector3(double, double, double)'

I think that the problem is that libFreeCADBase.dll.a is missing in the linking command.

It would also be better if dependent libraries were enclosed in:

"-Wl,--start-group"
"-Wl,--end-group"

In the past I had already experienced linking problems with MINGW import libraries (dll.a) when not eclosed in such a group.

@wwmayer
Copy link

wwmayer commented Nov 27, 2023

Just to make it clear: I do NOT use CLANG64 or CLANG32 but exclusively MINGW64. Although, inside my MSYS2 installation I have the directories clang32, clang64, clangarm64, mingw32 and ucrt64 with each of them having the sub-directories bin, etc, include, lib and share but all these sub-directories are completely empty.

All installed packages are in the sub-directories of mingw64.

The clang compiler is provided by the package mingw-w64-clang-x86_64-clang. So, when building FreeCAD it links the same Python library as when building with gcc.

So, you should give it a try to see if this way you can still use the Klayout stuff.

@wwmayer
Copy link

wwmayer commented Nov 27, 2023

@MehdiChinoune
Haven't you said that the vtk linking error has been reported to upstream and that it's already fixed?

@MehdiChinoune
Copy link
Collaborator

@MehdiChinoune Haven't you said that the vtk linking error has been reported to upstream and that it's already fixed?

It was another issue with FreeCAD.

@wsteffe
Copy link
Author

wsteffe commented Nov 29, 2023

Hi @MehdiChinoune,
I have seen that with the help of wwmayer and yours the gcc build problem for FreeCAD master have been solved.
I have applied all those patches to my local LinkMerge but I still have a problem with linkage of libFreeCADApp.dll. The undefined references are all related with boost::signals2, boost::bimap ...

I have seen that the package mingw-w64-x86_64-boost
doesn't include a library named libboost_signals2-mt.dll and signals2 can't be found as a separate component. But there is the include directory "/mingw64/include/boost/signals2/"
The code of boost::signals2 should then be placed somwhere. But where and how may I link against it with migw64 ?

@wwmayer
Copy link

wwmayer commented Nov 29, 2023

Not every boost component provides a shared library and one of them is signals2. For such components the whole implementation is available inside the sub-directory "details".

What are the linker errors related to signals2?

@wsteffe
Copy link
Author

wsteffe commented Nov 29, 2023

Here is an example (undefined reference to `vtable for boost::signals2::signal near the end of following lines):


C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/FreeCADApp.dir/objects.a(Document.cpp.obj):Document.cpp:(.text$_ZN5boost8signals26s
ignalIFvRN4Base9XMLReaderEENS0_19optional_last_valueIvEEiSt4lessIiENS_8functionIS5_EENSA_IFvRKNS0_10connectionES4_EEENS0_5mutexEED1Ev[_ZN5boost8signals26signalIFvRN4Base9XMLReaderEENS0_19optional_
last_valueIvEEiSt4lessIiENS_8functionIS5_EENSA_IFvRKNS0_10connectionES4_EEENS0_5mutexEED1Ev]+0xf): undefined reference to `vtable for boost::signals2::signal<void (Base::XMLReader&), boost::signal
s2::optional_last_value<void>, int, std::less<int>, boost::function<void (Base::XMLReader&)>, boost::function<void (boost::signals2::connection const&, Base::XMLReader&)>, boost::signals2::mutex>'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/FreeCADApp.dir/objects.a(Document.cpp.obj):Document.cpp:(.text$_ZN5boost8signals26s
ignalIFvRKSt6vectorIPN3App14DocumentObjectESaIS5_EERN4Base6WriterEENS0_19optional_last_valueIvEEiSt4lessIiENS_8functionISD_EENSI_IFvRKNS0_10connectionES9_SC_EEENS0_5mutexEEC1ERKSF_RKSH_[_ZN5boost8
signals26signalIFvRKSt6vectorIPN3App14DocumentObjectESaIS5_EERN4Base6WriterEENS0_19optional_last_valueIvEEiSt4lessIiENS_8functionISD_EENSI_IFvRKNS0_10connectionES9_SC_EEENS0_5mutexEEC1ERKSF_RKSH_]
+0x28): undefined reference to `vtable for boost::signals2::signal<void (std::vector<App::DocumentObject*, std::allocator<App::DocumentObject*> > const&, Base::Writer&), boost::signals2::optional_
last_value<void>, int, std::less<int>, boost::function<void (std::vector<App::DocumentObject*, std::allocator<App::DocumentObject*> > const&, Base::Writer&)>, boost::function<void (boost::signals2
::connection const&, std::vector<App::DocumentObject*, std::allocator<App::DocumentObject*> > const&, Base::Writer&)>, boost::signals2::mutex>'

@wsteffe
Copy link
Author

wsteffe commented Nov 29, 2023

But now I have seen that at the beginning of link command there are also other kind of errors:


C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot export _ZTVN3App8DocumentE: symbol not defined
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/FreeCADApp.dir/objects.a(Document.cpp.obj):Document.cpp:(.text+0x4cd9): undefined reference to `vtable for App::Document'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/FreeCADApp.dir/objects.a(Document.cpp.obj):Document.cpp:(.text+0x6da3): undefined reference to `vtable for App::Document'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/FreeCADApp.dir/objects.a(Document.cpp.obj):Document.cpp:(.text+0x220d7): undefined reference to `DocExportStatus::~DocExportStatus()'
CMakeFiles/FreeCADApp.dir/objects.a(Document.cpp.obj):Document.cpp:(.rdata+0x8c00): relocation truncated to fit: IMAGE_REL_AMD64_REL32 against `.text$_ZN3fmt3v106detail18write_int_noinlineIcNS0_8appenderEjEET0_S4_NS1_13write_int_argIT1_EERKNS0_12format_specsIT_EENS1_10locale_refE'
CMakeFiles/FreeCADApp.dir/objects.a(Document.cpp.obj):Document.cpp:(.rdata+0x8c04): relocation truncated to fit: IMAGE_REL_AMD64_REL32 against `.text$_ZN3fmt3v106detail18write_int_noinlineIcNS0_8appenderEjEET0_S4_NS1_13write_int_argIT1_EERKNS0_12format_specsIT_EENS1_10locale_refE'
CMakeFiles/FreeCADApp.dir/objects.a(Document.cpp.obj):Document.cpp:(.rdata+0x8c08): relocation truncated to fit: IMAGE_REL_AMD64_REL32 against `.text$_ZN3fmt3v106detail18write_int_noinlineIcNS0_8appenderEjEET0_S4_NS1_13write_int_argIT1_EERKNS0_12format_specsIT_EENS1_10locale_refE'

@MehdiChinoune
Copy link
Collaborator

Consider doing a clean build. delete the source and build folders, re-applied the patches and rebuild.

@wsteffe
Copy link
Author

wsteffe commented Nov 30, 2023

Consider doing a clean build. delete the source and build folders, re-applied the patches and rebuild.

Now I have cloned current FreeCAD from official repository which should have all patches. Then I have created a build folder inside of it and, from this folder I entered:

cmake -G "MSYS Makefiles" -DPYTHON_EXECUTABLE=${MINGW_PREFIX}/bin/python ..

I had a configuration error due to missing QtWebEngine in Qt5.
So I disabled the WEB module. To do that I used a cmake GUI which is not part of MSYS2. I launched it from windows and pointed to the FC build directory. Then I entered configurate/generate from the GUI and the make cmd from the mingw64 console.
I encontered a compilation problem with Salomesmesh/VTK 9_3 so I disabled also FEM module and made a second configure/generate in cmake GUI.
The build finished with folowing errors (I am listintg just the first lines):

[  5%] Linking CXX shared library ../../bin/libFreeCADApp.dll
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot export _ZTVN3App8DocumentE: symbol not defined
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/FreeCADApp.dir/objects.a(Document.cpp.obj):Document.cpp:(.text+0x44b1): undefined reference to `vtable for App::Document'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/FreeCADApp.dir/objects.a(Document.cpp.obj):Document.cpp:(.text+0x611d): undefined reference to `vtable for App::Document'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/FreeCADApp.dir/objects.a(Document.cpp.obj):Document.cpp:(.text+0x1b237): undefined reference to `DocExportStatus::~DocExportStatus()'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/FreeCADApp.dir/objects.a(Document.cpp.obj):Document.cpp:(.text$_ZN5boost8signals26signalIFvRKN3App14DocumentObjectEPNS2_11TransactionEENS0_19optional_last_valueIvEEiSt4lessIiENS_8functionIS8_EENSD_IFvRKNS0_10connectionES5_S7_EEENS0_5mutexEEC1ERKSA_RKSC_[_ZN5boost8signals26signalIFvRKN3App14DocumentObjectEPNS2_11TransactionEENS0_19optional_last_valueIvEEiSt4lessIiENS_8functionIS8_EENSD_IFvRKNS0_10connectionES5_S7_EEENS0_5mutexEEC1ERKSA_RKSC_]+0x28): undefined reference to `vtable for boost::signals2::signal<void (App::DocumentObject const&, App::Transaction*), boost::signals2::optional_last_value<void>, int, std::less<int>, boost::function<void (App::DocumentObject const&, App::Transaction*)>, boost::function<void (boost::signals2::connection const&, App::DocumentObject const&, App::Transaction*)>, boost::signals2::mutex>'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/FreeCADApp.dir/objects.a(Document.cpp.obj):Document.cpp:(.text$_ZN5boost8signals26signalIFvRKN3App14DocumentObjectEPNS2_11TransactionEENS0_19optional_last_valueIvEEiSt4lessIiENS_8functionIS8_EENSD_IFvRKNS0_10connectionES5_S7_EEENS0_5mutexEED1Ev[_ZN5boost8signals26signalIFvRKN3App14DocumentObjectEPNS2_11TransactionEENS0_19optional_last_valueIvEEiSt4lessIiENS_8functionIS8_EENSD_IFvRKNS0_10connectionES5_S7_EEENS0_5mutexEED1Ev]+0xf): undefined reference to `vtable for boost::signals2::signal<void (App::DocumentObject const&, App::Transaction*), boost::signals2::optional_last_value<void>, int, std::less<int>, boost::function<void (App::DocumentObject const&, App::Transaction*)>, boost::function<void (boost::signals2::connection const&, App::DocumentObject const&, App::Transaction*)>, boost::signals2::mutex>'

It seems to me that nothing has changed.

@wwmayer
Copy link

wwmayer commented Nov 30, 2023

I had a configuration error due to missing QtWebEngine in Qt5.

This is normal because it's not available for MSYS. So, you have to switch off the Start and Web modules.

I encontered a compilation problem with Salomesmesh/VTK 9_3 so I disabled also FEM module and made a second configure/generate in cmake GUI.

My latest upgrade of MSYS was from March or so and the vtk version is 9.2.7. With gcc it works fine and with clang I get linking errors but no compile errors.

undefined reference to `DocExportStatus::~DocExportStatus()

I wonder how this can be possible. DocExportStatus is a struct defined in App/Document.cpp with only two members. A destructor should be generated by the compiler.

@wsteffe
Copy link
Author

wsteffe commented Nov 30, 2023

Hi @wwmayer,
I do not know if it can make a difference but, considering that MehdiChinoune has packaged FreCAD with ucrt64, I will also try to build FreeCAD in this environment. Up to know I was used with mingw64 for my project but i think it is time to switch.

@MehdiChinoune
Copy link
Collaborator

Could you post cmake-log (What was cmake showing during configuration)

@wsteffe
Copy link
Author

wsteffe commented Nov 30, 2023

Hi MehdiChinoune, here it is what I see in cmake GUI after cmd Configure:

Compiler: GNU, version: 13.2.0
prefix: C:/Program Files (x86)/FreeCAD
bindir: bin
datadir: data
docdir: doc
includedir: include
libdir: lib
cmake: 3.27.0-rc3
Compiling with Qt 5
BUILD_MESH_PART requires BUILD_SMESH to be ON, but it is ""
BUILD_FLAT_MESH requires BUILD_MESH_PART to be ON, but it is "OFF"
BUILD_OPENSCAD requires BUILD_MESH_PART to be ON, but it is "OFF"
BUILD_START requires BUILD_WEB to be ON, but it is "OFF"
Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
=====================================================
Doxygen not found, will not build documentation.     
=====================================================

find_package() was used to locate fmt version 10.1.0
PyCXX found:
  Headers:  C:/msys64/home/walter/Software/FreeCad/FreeCADmaster/src
  Sources:  C:/msys64/home/walter/Software/FreeCad/FreeCADmaster/src/CXX
  Version:  7.1.7
-- Found OCE/OpenCASCADE version: 7.7.2
-- OCE/OpenCASCADE include directory: C:/msys64/mingw64/include/opencascade
-- OCE/OpenCASCADE shared libraries directory: C:/msys64/mingw64/lib
Found Boost: C:/msys64/mingw64/lib/cmake/Boost-1.83.0/BoostConfig.cmake (found suitable version "1.83.0", minimum required is "1.65") found components: filesystem program_options regex system thread date_time 
Set up to compile with Qt 5.15.11
Shiboken2Config: Using default python: .cp311-mingw_x86_64
CMake Warning (dev) at C:/msys64/mingw64/lib/cmake/Shiboken2-5.15.11/shiboken_helpers.cmake:318 (find_package):
  Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
  are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
  the cmake_policy command to set the policy and suppress this warning.

Call Stack (most recent call first):
  C:/msys64/mingw64/lib/cmake/Shiboken2-5.15.11/Shiboken2Config.cp311-mingw_x86_64.cmake:44 (shiboken_find_required_python)
  C:/msys64/mingw64/lib/cmake/Shiboken2-5.15.11/Shiboken2Config.cmake:5 (include)
  cMake/FreeCAD_Helpers/SetupShibokenAndPyside.cmake:22 (find_package)
  CMakeLists.txt:86 (SetupShibokenAndPyside)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at C:/msys64/mingw64/lib/cmake/Shiboken2-5.15.11/shiboken_helpers.cmake:319 (find_package):
  Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
  are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
  the cmake_policy command to set the policy and suppress this warning.

Call Stack (most recent call first):
  C:/msys64/mingw64/lib/cmake/Shiboken2-5.15.11/Shiboken2Config.cp311-mingw_x86_64.cmake:44 (shiboken_find_required_python)
  C:/msys64/mingw64/lib/cmake/Shiboken2-5.15.11/Shiboken2Config.cmake:5 (include)
  cMake/FreeCAD_Helpers/SetupShibokenAndPyside.cmake:22 (find_package)
  CMakeLists.txt:86 (SetupShibokenAndPyside)
This warning is for project developers.  Use -Wno-dev to suppress it.

SHIBOKEN_PYTHON_INCLUDE_DIRS computed to value: 'C:/msys64/mingw64/include/python3.11'
SHIBOKEN_PYTHON_LIBRARIES computed to value: ''
libshiboken built for Release
PySide 5.15.11 Python module found at C:\msys64\mingw64\lib\python3.11\site-packages\PySide2.

=====================================================
Matplotlib not found, Plot module won't be available.
=====================================================

Platform is 64-bit, set -D_OCC64
[E57] Revison ID: E57Format-2.2.1-AMD64-windows-mgw132
[E57] Building static library
setting gcc options: -Wall -Werror -Wno-deprecated -pedantic-errors
Found Boost: C:/msys64/mingw64/lib/cmake/Boost-1.83.0/BoostConfig.cmake (found version "1.83.0") found components: python311 
found Boost: 1_83
boost-incude dirs are: C:/msys64/mingw64/include
boost-python lib is: 
boost_LIBRARY_DIRS is: C:/msys64/mingw64/lib
Boost_LIBRARIES is: Boost::python
area module (for Path Workbench) will be installed to: lib
Performing Test _flag_found
Performing Test _flag_found - Success
Performing Test _flag_found
Performing Test _flag_found - Success

   ==============
     System
   ==============

bindir:                      bin
BLAS:                        -undefined-
CMAKE_VERSION:               3.27.0-rc3
Compiler:                    C:/msys64/mingw64/bin/c++.exe (13.2.0)
datadir:                     data
docdir:                      doc
includedir:                  include
libdir:                      lib
prefix:                      C:/Program Files (x86)/FreeCAD
Python:                      3.11.6 [C:/msys64/mingw64/bin/python3.11.exe] Suffix: [.cp311-mingw_x86_64]

   ==============
     Config
   ==============

BUILD_FEM:                   OFF 
BUILD_GUI:                   ON
BUILD_SMESH:                 -undefined-
BUILD_START:                 OFF 
BUILD_TECHDRAW:              ON
BUILD_VR:                    OFF 
BUILD_WEB:                   OFF 
CMAKE_BUILD_TYPE:            OFF 
CMAKE_CXX_FLAGS:             -Wall -Wextra -Wno-write-strings  -Wno-attributes
CMAKE_CXX_STANDARD:          17
CMAKE_INSTALL_PREFIX:        C:/Program Files (x86)/FreeCAD
CMAKE_PREFIX_PATH:           -undefined-
ENABLE_DEVELOPER_TESTS:      ON
FREECAD_CREATE_MAC_APP:      -undefined-
FREECAD_LIBPACK_USE:         OFF 
FREECAD_QT_VERSION:          Auto
FREECAD_USE_EXTERNAL_KDL:    OFF 
FREECAD_USE_EXTERNAL_SMESH:  OFF 
FREECAD_USE_FREETYPE:        ON
FREECAD_USE_PYBIND11:        OFF 
PYTHON_EXECUTABLE:           C:/msys64/mingw64/bin/python3.11.exe
PYTHON_LIBRARY:              C:/msys64/mingw64/lib/libpython3.11.dll.a
USE_CUDA:                    -undefined-
USE_OPENCV:                  -undefined-

   ==============
     Libraries
   ==============

Boost:                       1.83.0
Coin3D:                      4.0.1 [C:/msys64/mingw64/lib/libCoin.dll.a] [C:/msys64/mingw64/include]
Coin3D_DOC:                  not found
DesignerPlugin:              not built (BUILD_DESIGNER_PLUGIN is OFF)
Doxygen:                     not found
Eigen3:                      3.4.0
fmt:                         10.1.0
Freetype:                    2.13.2
Matplotlib:                  not found
NETGEN:                      not enabled
OCC:                         7.7.2 [C:/msys64/mingw64/lib] [C:/msys64/mingw64/include/opencascade]
OCC_Libs:                    [TKFillet;TKMesh;TKernel;TKG2d;TKG3d;TKMath;TKIGES;TKSTL;TKShHealing;TKXSBase;TKBool;TKBO;TKBRep;TKTopAlgo;TKGeomAlgo;TKGeomBase;TKOffset;TKPrim;TKSTEPBase;TKSTEPAttr;TKSTEP209;TKSTEP;TKHLR;TKFeat]
OpenGL_Lib:                  [opengl32]
OpenGLU_Incl:                []
OpenGLU_Lib:                 [glu32]
pivy:                        0.6.8
pybind11:                    not enabled
PYCXX:                       7.1.7 Incl: C:/msys64/home/walter/Software/FreeCad/FreeCADmaster/src Src:C:/msys64/home/walter/Software/FreeCad/FreeCADmaster/src/CXX
PySide:                      5.15.11 [C:/msys64/mingw64/include/PySide2]
PySideTools:                 v: 2  uic: [C:/msys64/mingw64/bin/uic.exe]  rcc: [C:/msys64/mingw64/bin/rcc.exe]
QtConcurrent:                5.15.11
QtCore:                      5.15.11
QtNetwork:                   5.15.11
QtOpenGL:                    5.15.11
QtPrintSupport:              5.15.11
QtSvg:                       5.15.11
QtTest:                      5.15.11
QtUiTools:                   5.15.11
QtWebEngineWidgets:          not needed (BUILD_WEB is OFF)
QtWidgets:                   5.15.11
QtXml:                       5.15.11
Rift:                        not enabled (BUILD_VR)
Shiboken:                    5.15.11 [C:/msys64/mingw64/include/shiboken2;C:/msys64/mingw64/include/python3.11]
SMESH:                       do not build
SWIG:                        4.1.1
XercesC:                     3.2.4 [C:/msys64/mingw64/lib/libxerces-c.dll.a] [C:/msys64/mingw64/include]
ZLIB:                        1.3.#define ZLIB_VERSION "1.3"

=================================================
Now run 'cmake --build C:/msys64/home/walter/Software/FreeCad/FreeCADmaster/build' to build FreeCAD
=================================================

Configuring done (19.4s)

@MehdiChinoune
Copy link
Collaborator

MehdiChinoune commented Nov 30, 2023

Please, purge your build directory and use mingw-w64-cmake, you are using cmake 3.27.0-rc3
Please show the entire log.

@wsteffe
Copy link
Author

wsteffe commented Nov 30, 2023

Initilally I used mingw-w64-cmake. In fact the command:

cmake -G "MSYS Makefiles" -DPYTHON_EXECUTABLE=${MINGW_PREFIX}/bin/python ..

was entered from mingw-64 console.

I used ccmake 3.27.0-rc3 to change the build option and to reconfigure.
It seems to me that MSYS2-mingw64 doesn't have the ccmake command (that you may find in a normal linux distribution) to do this job. The reported log is all what I can see in the cmake GUI.

@MehdiChinoune
Copy link
Collaborator

This is not the full log
something like:

  -- The C compiler identification is GNU 13.2.0
  -- The CXX compiler identification is GNU 13.2.0
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: D:/M/msys64/ucrt64/bin/gcc.exe - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: D:/M/msys64/ucrt64/bin/g++.exe - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Compiler: GNU, version: 13.2.0
  -- Looking for GL/gl.h
...

@wsteffe
Copy link
Author

wsteffe commented Nov 30, 2023

The log you are showing is similar to the following log I see in the first run with a new build directory:


  cmake -G "MSYS Makefiles" -DPYTHON_EXECUTABLE=${MINGW_PREFIX}/bin/python ..
-- The C compiler identification is GNU 13.2.0
-- The CXX compiler identification is GNU 13.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/msys64/mingw64/bin/cc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/msys64/mingw64/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Compiler: GNU, version: 13.2.0
-- Looking for GL/gl.h
-- Looking for GL/gl.h - found
-- Looking for C++ include istream
-- Looking for C++ include istream - found
-- Looking for C++ include ostream
-- Looking for C++ include ostream - found
-- Looking for C++ include fstream
-- Looking for C++ include fstream - found
-- Looking for C++ include sstream
-- Looking for C++ include sstream - found
-- Looking for C++ include ios
-- Looking for C++ include ios - found
-- Looking for C++ include iostream
-- Looking for C++ include iostream - found
-- Looking for C++ include iomanip
-- Looking for C++ include iomanip - found
-- Looking for C++ include iostream
-- Looking for C++ include iostream - found
-- Check for STD namespace
-- Check for STD namespace - found
-- prefix: C:/Program Files (x86)/FreeCAD
-- bindir: bin
-- datadir: data
-- docdir: doc
-- includedir: include
-- libdir: lib
-- cmake: 3.27.8
-- Compiling with Qt 5
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
=====================================================
Doxygen not found, will not build documentation.
=====================================================

-- find_package() was used to locate fmt version 10.1.0
-- Found Python3: C:/msys64/mingw64/bin/python3.11.exe (found version "3.11.6") found components: Interpreter Development Development.Module Development.Embed
-- Found XercesC: C:/msys64/mingw64/lib/libxerces-c.dll.a (found version "3.2.4")
-- Found ZLIB: C:/msys64/mingw64/lib/libz.dll.a (found version "1.3")
-- PyCXX found:
--   Headers:  C:/msys64/home/walter/Software/FreeCad/FreeCADmaster/src
--   Sources:  C:/msys64/home/walter/Software/FreeCad/FreeCADmaster/src/CXX
--   Version:  7.1.7
-- Found OCC: C:/msys64/mingw64/include/opencascade (found version "7.7.2")
-- -- Found OCE/OpenCASCADE version: 7.7.2
-- -- OCE/OpenCASCADE include directory: C:/msys64/mingw64/include/opencascade
-- -- OCE/OpenCASCADE shared libraries directory: C:/msys64/mingw64/lib
-- Found OpenGL: opengl32
-- Found OpenGLU: glu32
CMake Deprecation Warning at C:/msys64/mingw64/lib/cmake/vtk/vtk-config.cmake:79 (message):
  The new name for the 'vtkCommonCore' component is 'CommonCore'
Call Stack (most recent call first):
  cMake/FreeCAD_Helpers/SetupSalomeSMESH.cmake:29 (find_package)
  CMakeLists.txt:69 (SetupSalomeSMESH)


-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found OpenMP_C: -fopenmp (found version "4.5")
-- Found OpenMP_CXX: -fopenmp (found version "4.5")
-- Found OpenMP: TRUE (found version "4.5")
-- Could NOT find utf8cpp (missing: utf8cpp_INCLUDE_DIR)
-- VTK components: CommonCore;CommonDataModel;FiltersVerdict;IOXML;FiltersCore;FiltersGeneral;IOLegacy;FiltersExtraction;FiltersSources;FiltersGeometry;hdf5;FiltersParallelDIY2;RenderingC
ore;InteractionStyle;RenderingFreeType;RenderingOpenGL2
-- Found HDF5: C:/msys64/mingw64/lib/libhdf5.dll.a (found version "1.14.2") found components: C HL
-- Found GLEW: C:/msys64/mingw64/lib/libglew32.dll.a
-- Found OpenGL: opengl32  found components: OpenGL
-- Found EXPAT: C:/msys64/mingw64/lib/libexpat.dll.a (found version "2.5.0")
-- Found LZMA: C:/msys64/mingw64/lib/liblzma.dll.a (found version "5.4.5")
-- Found LZ4: C:/msys64/mingw64/lib/liblz4.dll.a (found version "1.9.4")
-- Found double-conversion: C:/msys64/mingw64/lib/libdouble-conversion.dll.a
-- Found Eigen3: C:/msys64/mingw64/include/eigen3 (found version "3.4.0")
-- Found TIFF: C:/msys64/mingw64/lib/libtiff.dll.a (found version "4.6.0")
-- Found PNG: C:/msys64/mingw64/lib/libpng.dll.a (found version "1.6.40")
-- Found JPEG: C:/msys64/mingw64/lib/libjpeg.dll.a (found version "80")
-- Could NOT find freetype (missing: freetype_DIR)
-- Found Freetype: C:/msys64/mingw64/lib/libfreetype.dll.a (found version "2.13.2")
-- Found OpenMP_C: -fopenmp (found version "4.5")
-- Found OpenMP_CXX: -fopenmp (found version "4.5")
-- Could NOT find utf8cpp (missing: utf8cpp_INCLUDE_DIR)
-- Check for medfile (libmed and libmedc) ...
-- Found MEDFile: C:/msys64/mingw64/include
CMake Error at cMake/FreeCAD_Helpers/SetupSalomeSMESH.cmake:79 (find_package):
  Could not find a package configuration file provided by "HDF5" with any of
  the following names:

    HDF5Config.cmake
    hdf5-config.cmake

  Add the installation prefix of "HDF5" to CMAKE_PREFIX_PATH or set
  "HDF5_DIR" to a directory containing one of the above files.  If "HDF5"
  provides a separate development package or SDK, be sure it has been
  installed.
Call Stack (most recent call first):
  CMakeLists.txt:69 (SetupSalomeSMESH)


-- Configuring incomplete, errors occurred!


To fix it I have to set HDF5_DIR=C:\msys64\mingw64\lib\cmake in the cmake-gui.

@MehdiChinoune
Copy link
Collaborator

@wsteffe
Copy link
Author

wsteffe commented Nov 30, 2023

Applied the pathes from from https://github.com/msys2/MINGW-packages/blob/e6f025815/mingw-w64-freecad/001-fix-build-on-mingw.patch but it ddn't fix the linkage of libFreeCADApp.dll and neither the problem with salomesmesh/VTK-9-3.

The only difference was that it was not necessary to set HDF5_DIR=C:\msys64\mingw64\lib\cmake in cmake-gui.

@wwmayer
Copy link

wwmayer commented Nov 30, 2023

@MehdiChinoune
What is the defined(_LIBCPP_VERSION) good for?

@MehdiChinoune
Copy link
Collaborator

@MehdiChinoune What is the defined(_LIBCPP_VERSION) good for?

For libc++ which used on CLANG64 which is uses llvm+clang+libc++

@wwmayer
Copy link

wwmayer commented Nov 30, 2023

OK, thanks.

@wsteffe
Copy link
Author

wsteffe commented Nov 30, 2023

I tried with ucrt64 but I got again the same errors at the linkage of libFreeCADApp.dll (and also same problem with WEB and FEM modules):

[  7%] Building CXX object src/App/CMakeFiles/FreeCADApp.dir/PreCompiled.cpp.obj
[  7%] Linking CXX shared library ../../bin/libFreeCADApp.dll
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot export _ZTVN3App8Docum
entE: symbol not defined
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/FreeCADApp.dir/obj
ects.a(Document.cpp.obj):Document.cpp:(.text+0x44b1): undefined reference to `vtable for App::Document'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/FreeCADApp.dir/obj
ects.a(Document.cpp.obj):Document.cpp:(.text+0x611d): undefined reference to `vtable for App::Document'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/FreeCADApp.dir/obj
ects.a(Document.cpp.obj):Document.cpp:(.text+0x1b237): undefined reference to `DocExportStatus::~DocExportStatus()'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/FreeCADApp.dir/obj
ects.a(Document.cpp.obj):Document.cpp:(.text$_ZN5boost8signals26signalIFvRKN3App14DocumentObjectEPNS2_11TransactionEENS0_19optiona
l_last_valueIvEEiSt4lessIiENS_8functionIS8_EENSD_IFvRKNS0_10connectionES5_S7_EEENS0_5mutexEEC1ERKSA_RKSC_[_ZN5boost8signals26signa
lIFvRKN3App14DocumentObjectEPNS2_11TransactionEENS0_19optional_last_valueIvEEiSt4lessIiENS_8functionIS8_EENSD_IFvRKNS0_10connectio
nES5_S7_EEENS0_5mutexEEC1ERKSA_RKSC_]+0x28): undefined reference to `vtable for boost::signals2::signal<void (App::DocumentObject
const&, App::Transaction*), boost::signals2::optional_last_value<void>, int, std::less<int>, boost::function<void (App::DocumentOb
ject const&, App::Transaction*)>, boost::function<void (boost::signals2::connection const&, App::DocumentObject const&, App::Trans
action*)>, boost::signals2::mutex>'

@wsteffe
Copy link
Author

wsteffe commented Dec 1, 2023

Hi @wwmayer

I wonder how this can be possible. DocExportStatus is a struct defined in App/Document.cpp with only two members. A destructor should be generated by the compiler.

Undefined ref to ~DocExportStatus() disappears if I add ~DocExportStatus(){} in the struct DocExportStatus {...} but the undefined reference to `vtable for App::Document' is still there:

[  5%] Linking CXX shared library ../../bin/libFreeCADApp.dll
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot export _ZTVN3App8DocumentE: symbol not defined
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/FreeCADApp.dir/objects.a(Document.cpp.obj):Document.cpp:(.text+0x44b1): undefined reference to `vtable for App::Document'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/FreeCADApp.dir/objects.a(Document.cpp.obj):Document.cpp:(.text+0x611d): undefined reference to `vtable for App::Document'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/FreeCADApp.dir/objects.a(Document.cpp.obj):Document.cpp:(.text$_ZN5boost8signals26signalIFvRKN3App14DocumentObjectEPNS2_11TransactionEENS0_19optional_last_valueIvEEiSt4lessIiENS_8functionIS8_EENSD_IFvRKNS0_10connectionES5_S7_EEENS0_5mutexEEC1ERKSA_RKSC_[_ZN5boost8signals26signalIFvRKN3App14DocumentObjectEPNS2_11TransactionEENS0_19optional_last_valueIvEEiSt4lessIiENS_8functionIS8_EENSD_IFvRKNS0_10connectionES5_S7_EEENS0_5mutexEEC1ERKSA_RKSC_]+0x28): undefined reference to `vtable for boost::signals2::signal<void (App::DocumentObject const&, App::Transaction*), boost::signals2::optional_last_value<void>, int, std::less<int>, boost::function<void (App::DocumentObject const&, App::Transaction*)>, boost::function<void (boost::signals2::connection const&, App::DocumentObject const&, App::Transaction*)>, boost::signals2::mutex>'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/FreeCADApp.dir/objects.a(Document.cpp.obj):Document.cpp:(.text$_ZN5boost8signals26signalIFvRKN3App14DocumentObjectEPNS2_11TransactionEENS0_19optional_last_valueIvEEiSt4lessIiENS_8functionIS8_EENSD_IFvRKNS0_10connectionES5_S7_EEENS0_5mutexEED1Ev[_ZN5boost8signals26signalIFvRKN3App14DocumentObjectEPNS2_11TransactionEENS0_19optional_last_valueIvEEiSt4lessIiENS_8functionIS8_EENSD_IFvRKNS0_10connectionES5_S7_EEENS0_5mutexEED1Ev]+0xf): undefined reference to `vtable for boost::signals2::signal<void (App::DocumentObject const&, App::Transaction*), boost::signals2::optional_last_value<void>, int, std::less<int>, boost::function<void (App::DocumentObject const&, App::Transaction*)>, boost::function<void (boost::signals2::connection const&, App::DocumentObject const&, App::Transaction*)>, boost::signals2::mutex>'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/FreeCADApp.dir/objects.a(Document.cpp.obj):Document.cpp:(.text$_ZN5boost8signals26signalIFvRN4Base6WriterEENS0_19optional_last_valueIvEEiSt4lessIiENS_8functionIS5_EENSA_IFvRKNS0_10connectionES4_EEENS0_5mutexEEC1ERKS7_RKS9_[_ZN5boost8signals26signalIFvRN4Base6WriterEENS0_19optional_last_valueIvEEiSt4lessIiENS_8functionIS5_EENSA_IFvRKNS0_10connectionES4_EEENS0_5mutexEEC1ERKS7_RKS9_]+0x28): undefined reference to `vtable for boost::signals2::signal<void (Base::Writer&), boost::signals2::optional_last_value<void>, int, std::less<int>, boost::function<void (Base::Writer&)>, boost::function<void (boost::signals2::connection const&, Base::Writer&)>, boost::signals2::mutex>'

Undefined ref to ~DocExportStatus() doesn't disappears if I set ~DocExportStatus() =default;

Does it mean that the problem is in the destruction of status or in the destruction of objs ?

Document::ExportStatus status;
std::set<const App::DocumentObject*> objs

@wsteffe
Copy link
Author

wsteffe commented Dec 1, 2023

Looking inside build/src/App/CmakeFiles/FreeCADApp.dir/Document.cpp.obj I can see that _ZTVN3App8DocumentE is really not defined (U stays for Undefined) which explains the first error

[ 7%] Linking CXX shared library ../../bin/libFreeCADApp.dll
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot export _ZTVN3App8DocumentE: symbol not defined

nm Document.cpp.obj | grep _ZTVN3
U .rdata$_ZTVN3App16ObjectIdentifierE
U .rdata$_ZTVN3App17ExpressionVisitorE
U .rdata$_ZTVN3App17PropertyListsBaseE
U .rdata$_ZTVN3App8DocumentE

@MehdiChinoune
Copy link
Collaborator

MehdiChinoune commented Dec 1, 2023

I couldn't reproduce the failure.

  • clone the upstream repo.
$ git clone https://github.com/FreeCAD/FreeCAD
$ git submodule update --init
  • Install requirements:
$ pacboy -S boost:p coin:p fmt:p openscad:p opencascade:p vtk:p pyside6:p qt6-svg:p xerces-c:p python-numpy:p python-pivy:p python-packaging:p med:p freetype:p cmake:p ninja:p cc:p eigen3:p qt6-tools:p swig:p fast_float:p utf8cpp:p python-matplotlib:p yaml-cpp:p
  • Configure the project:
$ cmake .. -DCMAKE_BUILD_TYPE=Release -DFREECAD_QT_VERSION=6 -DBUILD_TEST=OFF -DBUILD_WEB=OFF -DENABLE_DEVELOPER_TESTS=OFF -DPython3_EXECUTABLE=${MINGW_PREFIX}/bin/python -DPYTHON_EXECUTABLE=${MINGW_PREFIX}/bin/python
  • Build it:
$ ninja FreeCADApp

It built successfully, something wrong with your setup

@wsteffe
Copy link
Author

wsteffe commented Dec 2, 2023

Hi MehdiChinoune, many thanks for your help. With Ninja worked also for me.
It was also necessary to

add -G "Ninja" to cmake ..
set HDF5_DIR=C:\msys64\mingw64\lib\cmake in the cmake-gui

But FreeCADApp was successfully built.

@wwmayer
Copy link

wwmayer commented Dec 2, 2023

Which CMake generator did you use before?

@wsteffe
Copy link
Author

wsteffe commented Dec 2, 2023

I was using MSYS Makefiles.

@wwmayer
Copy link

wwmayer commented Dec 3, 2023

I am using MSYS Makefiles, too.

@wsteffe
Copy link
Author

wsteffe commented Dec 4, 2023

Now I am trying to build LinkMerge but I have a problem with

C:/msys64/home/walter/Software/FreeCad/FreeCAD/src/Gui/PythonWrapper.cpp:77:11: fatal error: basewrapper.h: No such file or directory
77 | # include <basewrapper.h>

This line is triggered by #ifdef HAVE_SHIBOKEN2 and this is the first strange point.
Why is it set True when I do not have installed shiboken2.
I have instead installed shiboken6 as required by FreeCAD dependences reported at
https://packages.msys2.org/package/mingw-w64-ucrt-x86_64-freecad?repo=ucrt64.

The second question is about pyside. Having installed shiboken6, I had to install also pyside6
and pyside6-tools which prevented me to install pyside2 and pyside2-tools. But I think that
pyside6 is not compatible with Qt5 which is also installed and I linked with my FC build (also for FC master) even if not mentioned in dependences at
https://packages.msys2.org/package/mingw-w64-ucrt-x86_64-freecad?repo=ucrt64.
In fact I think that shiboken6,pyside6,Qt6.. was used only to build salomesmesh/FEM module.

How was this dependence incompatibility handled in the build of FC master ?

@wwmayer
Copy link

wwmayer commented Dec 4, 2023

Why is it set True when I do not have installed shiboken2.

I don't know how the LinkMerge branch handles it but in the official branch there is this line in Gui/CMakeLists.txt:
add_definitions(-DHAVE_SHIBOKEN${PYSIDE_MAJOR_VERSION})
PYSIDE_MAJOR_VERSION is set in SetupShibokenAndPyside.cmake according to the used Qt version.

The second question is about pyside. Having installed shiboken6, I had to install also pyside6
and pyside6-tools which prevented me to install pyside2 and pyside2-tools.

IIRC there was a name collision with the pyside6-tools package. I simply renamed the conflicting file.

How was this dependence incompatibility handled in the build of FC master ?

It's not a FreeCAD issue at all but a msys issue.

@wsteffe
Copy link
Author

wsteffe commented Dec 4, 2023

Thanks @wwmayer
In LinkMerge it is more or less the same. And Qt version is selected in ChooseQtVersion.cmake which gives a higher priority to Qt5 when both Qt5 and Qt6 are installed (as it is my case). So I guess that I shoud have defined HAVE_SHIBOKEN2.

But the next question is how is it that the building of FreeCAD master was succesful without having installed pyside2 and pyside2-tools (because of the MSYS issue). This question holds also for the official build at https://packages.msys2.org/package/mingw-w64-ucrt-x86_64-freecad?repo=ucrt64. Perhaps MehdiChinoune, was able to build using only Qt6. In the first run I also tried this way but I had configuration errors (which now I don't remember).

@MehdiChinoune
Copy link
Collaborator

@wsteffe take a look at https://github.com/msys2/MINGW-packages/blob/317b892db/mingw-w64-freecad/PKGBUILD#L80
You have to pass -DFREECAD_QT_VERSION="6" to cmake to build against Qt6

@wsteffe
Copy link
Author

wsteffe commented Dec 4, 2023

I had already passed this option because you suggested it in your previous post in this same thread.
Not I will remove my Qt5 installation from ucrt64 and reconfigure again to see the reported errors that forced me to install also Qt5.

@MehdiChinoune
Copy link
Collaborator

Is your MSYS2 up-to-date.
Make sure to update it:

pacman -Syu

@wsteffe
Copy link
Author

wsteffe commented Dec 4, 2023

No sorry, now I have understood.

I don't know why but I have reconfigured again inside the cmake-gui after cmd:

cmake .. -DCMAKE_BUILD_TYPE=Release -DFREECAD_QT_VERSION=6 -DBUILD_TEST=OFF -DBUILD_WEB=OFF -DENABLE_DEVELOPER_TESTS=OFF -DPython3_EXECUTABLE=${MINGW_PREFIX}/bin/python -DPYTHON_EXECUTABLE=${MINGW_PREFIX}/bin/python

I think there is a problem in the cmake-gui because it has automatically set FREECAD_QT_VERSION="auto" overwriting the command line options. Now I have removed Qt5 (exept base,swg and multimedia which are required by opencascade) set FREECAD_QT_VERSION=6 in gui and the reconfiguration was completed without errors.

@wwmayer
Copy link

wwmayer commented Dec 4, 2023

But the next question is how is it that the building of FreeCAD master was succesful without having installed pyside2 and pyside2-tools (because of the MSYS issue). This question holds also for the official build at https://packages.msys2.org

shiboken & PySide is not a strict build dependency. If it's installed then by default (see also the option FREECAD_USE_SHIBOKEN and FREECAD_USE_PYSIDE) it tries to link the shared library but if it's not installed then it tries to load its Python modules at runtime. This is because shiboken provides a C++ and a Python API to convert between C++ and Python types.

@wsteffe
Copy link
Author

wsteffe commented Dec 5, 2023

Hi @wwmayer, thanks for hint. In fact I have built LinkMerge branch (patched as in https://github.com/wsteffe/FreeCAD/tree/LinkMerge) using FREECAD_QT_VERSION=5 without SHIBOKEN.

To do that I removed shiboken from my system and configured with:

cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DFREECAD_QT_VERSION=5 -DBUILD_TEST=OFF -DBUILD_WEB=OFF -DENABLE_DEVELOPER_TESTS=OFF -DPython3_EXECUTABLE=${MINGW_PREFIX}/bin/python -DPYTHON_EXECUTABLE=${MINGW_PREFIX}/bin/python

But it would be better to set FREECAD_USE_SHIBOKEN=False in the comand line if possible.

@wsteffe
Copy link
Author

wsteffe commented Dec 13, 2023

Hi @wwmayer,
I am trying to package FreeCAD Python Modules because I would like to import them from klayout environment. I have run pyinstaller on the following file which imports the functions used in my klayout package (see https://github.com/wsteffe/layoutDD):

test.py

#! /ucrt64/bin/python
import sys
import FreeCAD
import Part
import Import
from BOPTools.ShapeMerge import mergeShapes
from BOPTools.GeneralFuseResult import GeneralFuseResult
Import.readDXF("pippo.dxf")

The dist/test.exe is executed without errors but when I want to make similar imports from the inside of klayout python parser I have to put all modules in the dist/_internal folder that is generated by pyinstaller. Also the subfolders of Mod/Part had to be moved up in this place (otherwise BOPTools module was not found). These changes fixed all imports but I am still having an error in the last line.
More precisely this error was detected with the following file executed in the klayout macro debugger.

test1.py

import pya
from pya import *
import sys,os
FCpath = os.path.realpath(os.path.join(os.path.dirname(_file_), "../salt/layoutDD/python/FreeCAD/_internal"))
sys.path.append(FCpath)
import FreeCAD
import Part
import Import
from BOPTools.ShapeMerge import mergeShapes
from BOPTools.GeneralFuseResult import GeneralFuseResult
Import.readDXF("pippo.dxf")

import pya is related with the klayout python interpeter. pya has to be imported in all klayout packages:

The macro debugger gives the following error:

Running macro C:/Users/walter/KLayout/pymacros\test1.py
module 'Import' has no attribute 'readDXF'

The problem could well be specific to klayout environment but perhaps you may have an idea of what could be missing. Klayout and FC were both built in the same environment (MSYS2/ucrt64).

@wsteffe
Copy link
Author

wsteffe commented Dec 14, 2023

Hi @wwmayer,
I think it is a klayout specific problem because the packaged FreeCAD modules can be imported from a different python interpreter. See also at https://www.klayout.de/forum/discussion/2367/domain-decomposition#latest

@MehdiChinoune
Copy link
Collaborator

MSYS2 doesn't package forks when the original project is still maintained.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants