x32 Win build failure

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

x32 Win build failure

Post by sgrogan »

Alternate Topic: wmayer can you have a look?
32 bit specific problem

Code: Select all

Error	1	error LNK2019: unresolved external symbol _insoar_@20 referenced in function "void __cdecl aptrte(long,double,long,long *,class R2 *,long,class R2 *,long &,class R2 * &,long &,long * &,long &)" (?aptrte@@YAXJNJPAJPAVR2@@J1AAJAAPAV1@2AAPAJ2@Z)	C:\Users\Chris\GitHub\fc-medtest-x6-build\src\3rdParty\salomesmesh\aptrte.obj	MEFISTO2
Error	2	error LNK2019: unresolved external symbol _azeroi_@8 referenced in function "void __cdecl aptrte(long,double,long,long *,class R2 *,long,class R2 *,long &,class R2 * &,long &,long * &,long &)" (?aptrte@@YAXJNJPAJPAVR2@@J1AAJAAPAV1@2AAPAJ2@Z)	C:\Users\Chris\GitHub\fc-medtest-x6-build\src\3rdParty\salomesmesh\aptrte.obj	MEFISTO2
Error	3	error LNK2019: unresolved external symbol _fasoar_@48 referenced in function "void __cdecl aptrte(long,double,long,long *,class R2 *,long,class R2 *,long &,class R2 * &,long &,long * &,long &)" (?aptrte@@YAXJNJPAJPAVR2@@J1AAJAAPAV1@2AAPAJ2@Z)	C:\Users\Chris\GitHub\fc-medtest-x6-build\src\3rdParty\salomesmesh\aptrte.obj	MEFISTO2
Error	4	error LNK2019: unresolved external symbol _teajte_@32 referenced in function "void __cdecl aptrte(long,double,long,long *,class R2 *,long,class R2 *,long &,class R2 * &,long &,long * &,long &)" (?aptrte@@YAXJNJPAJPAVR2@@J1AAJAAPAV1@2AAPAJ2@Z)	C:\Users\Chris\GitHub\fc-medtest-x6-build\src\3rdParty\salomesmesh\aptrte.obj	MEFISTO2
Error	5	error LNK2019: unresolved external symbol _tehote_@44 referenced in function "void __cdecl aptrte(long,double,long,long *,class R2 *,long,class R2 *,long &,class R2 * &,long &,long * &,long &)" (?aptrte@@YAXJNJPAJPAVR2@@J1AAJAAPAV1@2AAPAJ2@Z)	C:\Users\Chris\GitHub\fc-medtest-x6-build\src\3rdParty\salomesmesh\aptrte.obj	MEFISTO2
Error	6	error LNK2019: unresolved external symbol _tetrte_@72 referenced in function "void __cdecl aptrte(long,double,long,long *,class R2 *,long,class R2 *,long &,class R2 * &,long &,long * &,long &)" (?aptrte@@YAXJNJPAJPAVR2@@J1AAJAAPAV1@2AAPAJ2@Z)	C:\Users\Chris\GitHub\fc-medtest-x6-build\src\3rdParty\salomesmesh\aptrte.obj	MEFISTO2
Error	7	error LNK2019: unresolved external symbol _aisoar_@16 referenced in function "void __cdecl aptrte(long,double,long,long *,class R2 *,long,class R2 *,long &,class R2 * &,long &,long * &,long &)" (?aptrte@@YAXJNJPAJPAVR2@@J1AAJAAPAV1@2AAPAJ2@Z)	C:\Users\Chris\GitHub\fc-medtest-x6-build\src\3rdParty\salomesmesh\aptrte.obj	MEFISTO2
Error	8	error LNK2019: unresolved external symbol _tedela_@48 referenced in function "void __cdecl aptrte(long,double,long,long *,class R2 *,long,class R2 *,long &,class R2 * &,long &,long * &,long &)" (?aptrte@@YAXJNJPAJPAVR2@@J1AAJAAPAV1@2AAPAJ2@Z)	C:\Users\Chris\GitHub\fc-medtest-x6-build\src\3rdParty\salomesmesh\aptrte.obj	MEFISTO2
Error	9	error LNK2019: unresolved external symbol _terefr_@72 referenced in function "void __cdecl aptrte(long,double,long,long *,class R2 *,long,class R2 *,long &,class R2 * &,long &,long * &,long &)" (?aptrte@@YAXJNJPAJPAVR2@@J1AAJAAPAV1@2AAPAJ2@Z)	C:\Users\Chris\GitHub\fc-medtest-x6-build\src\3rdParty\salomesmesh\aptrte.obj	MEFISTO2
Error	10	error LNK2019: unresolved external symbol _tesuex_@68 referenced in function "void __cdecl aptrte(long,double,long,long *,class R2 *,long,class R2 *,long &,class R2 * &,long &,long * &,long &)" (?aptrte@@YAXJNJPAJPAVR2@@J1AAJAAPAV1@2AAPAJ2@Z)	C:\Users\Chris\GitHub\fc-medtest-x6-build\src\3rdParty\salomesmesh\aptrte.obj	MEFISTO2
Error	11	error LNK2019: unresolved external symbol _teamqt_@96 referenced in function "void __cdecl aptrte(long,double,long,long *,class R2 *,long,class R2 *,long &,class R2 * &,long &,long * &,long &)" (?aptrte@@YAXJNJPAJPAVR2@@J1AAJAAPAV1@2AAPAJ2@Z)	C:\Users\Chris\GitHub\fc-medtest-x6-build\src\3rdParty\salomesmesh\aptrte.obj	MEFISTO2
Error	12	error LNK2019: unresolved external symbol _nusotr_@24 referenced in function "void __cdecl aptrte(long,double,long,long *,class R2 *,long,class R2 *,long &,class R2 * &,long &,long * &,long &)" (?aptrte@@YAXJNJPAJPAVR2@@J1AAJAAPAV1@2AAPAJ2@Z)	C:\Users\Chris\GitHub\fc-medtest-x6-build\src\3rdParty\salomesmesh\aptrte.obj	MEFISTO2
Error	13	error LNK2019: unresolved external symbol _qutr2d_@16 referenced in function _qualitetrte_@40	C:\Users\Chris\GitHub\fc-medtest-x6-build\src\3rdParty\salomesmesh\aptrte.obj	MEFISTO2
Error	14	error LNK2019: unresolved external symbol _surtd2_@12 referenced in function _qualitetrte_@40	C:\Users\Chris\GitHub\fc-medtest-x6-build\src\3rdParty\salomesmesh\aptrte.obj	MEFISTO2
Error	15	error LNK2019: unresolved external symbol _areteideale_ referenced in function _teamqa_	C:\Users\Chris\GitHub\fc-medtest-x6-build\src\3rdParty\salomesmesh\trte.obj	MEFISTO2
Error	16	error LNK2019: unresolved external symbol _qualitetrte_ referenced in function _teamqt_	C:\Users\Chris\GitHub\fc-medtest-x6-build\src\3rdParty\salomesmesh\trte.obj	MEFISTO2
Error	17	error LNK1120: 16 unresolved externals	C:\Users\Chris\GitHub\fc-medtest-x6-build\bin\MEFISTO2.dll	MEFISTO2
I think I've compiled hdf5 and med the same as x64, where there are no problems.
This build still uses oce 0.17.0 and I'm linking to the hdf5 and med libraries in cmake-gui, the libs are not yet folded into the libpack.
This procedure worked for x64.
"fight the good fight"
wmayer
Founder
Posts: 20319
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: x32 Win build failure

Post by wmayer »

I think I've compiled hdf5 and med the same as x64, where there are no problems.
It doesn't look like it's related to medc or hdf5. The linking errors appear when trying to build the Mefisto library where it can't find the functions insoar, azeroi, fasoar, teajte, tehote, tetrte, aisoar, tedela, terefr, tesuex, teamqt, nusotr, qutr2d, surtd2, areteideale, qualitetrte

However, all of these functions are provided by trte.c. Now when comparing the source code between old and new smesh many changes have been applied to aptrte.h and aptrte.cpp and I can't really see why. I guess it's best to ask vemarie why this has been changed. Especially I don't see where "F2C_BUILD" is defined.
wmayer
Founder
Posts: 20319
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: x32 Win build failure

Post by wmayer »

To compare it with x64 I renamed the method insoar_ to force a linking error. The linker then said:

Code: Select all

aptrte.cpp.obj : error LNK2019: unresolved external symbol insoar_ referenced in function "void __cdecl aptrte(long,double,long,long *,class R2 *,long
,class R2 *,long &,class R2 * &,long &,long * &,long &)" (?aptrte@@YAXJNJPEAJPEAVR2@@J1AEAJAEAPEAV1@2AEAPEAJ2@Z)
You see the difference? On x64 it can't resolve "insoar_" while on x86 it can't resolve "_insoar_@20". So, there must be a name mangling somewhere for x86 and this I guess must be caused by a change of a pre-processor define.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: x32 Win build failure

Post by sgrogan »

wmayer wrote:You see the difference?
I see. Thanks for taking the time to look. I will get in touch with vejmarie.
"fight the good fight"
User avatar
vejmarie
Posts: 713
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: x32 Win build failure

Post by vejmarie »

@sgrogan, sorry for the delay into my reply I was focused on fixing an issue with the meshing stuff. I have some time to have a look to your issue. So to be sure, this is happening on windows ? (sorry for the stupid question, but as I do not have it on linux / MacOS, this is my expectation). I will try to reproduce it on linux 32 bits and have a quick look to the source code !
User avatar
vejmarie
Posts: 713
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: x32 Win build failure

Post by vejmarie »

@sgrogan, just a quick question what is your compiler on Windows for this part of the code is this a C compiler or C++ ? The mangling comes probably from a C++ compiler, while F2C shall be probably compiled as a native C code, which won't generate any "extra" symbol into the function name. Can you share with me the compiler flag used ? I will try to build up tomorrow a windows build environment, but it will take me time probably.
wmayer
Founder
Posts: 20319
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: x32 Win build failure

Post by wmayer »

In the file aptrte.h add this little block

Code: Select all

#ifdef WIN32
#define F2C_BUILD
#endif
after the define of MEFISTO2D_EXPORT. This makes exactly the difference between old and new smesh, i.e. the keyword "__stdcall" is not set.
wmayer
Founder
Posts: 20319
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: x32 Win build failure

Post by wmayer »

Btw, there is another issue with Mefisto:
when using it inside the Mesh workbench to create a mesh from a cylinder then it fails with this error:
MEFISTO_2D failed on sub-shape #3 with error 2 "Error in Triangulation (aptrte())"
MEFISTO_2D failed on sub-shape #10 with error 2 "Error in Triangulation (aptrte())"
MEFISTO_2D failed on sub-shape #12 with error 2 "Error in Triangulation (aptrte())"
It happens on Windows and Linux. I wonder whether we should restore the Mefisto sources from the old smesh.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: x32 Win build failure

Post by sgrogan »

vejmarie wrote:@sgrogan, just a quick question what is your compiler on Windows for this part of the code is this a C compiler or C++
Yes Windows, and only a problem with 32 bit. I'm using the VS2013 IDE so I have both C and C++ compiler. I didn't set any flags so I have all the defaults.
wmayer wrote: after the define of MEFISTO2D_EXPORT. This makes exactly the difference between old and new smesh, i.e. the keyword "__stdcall" is not set.
I don't have any of the 32 bit libraries on this computer I will try later today.
"fight the good fight"
User avatar
vejmarie
Posts: 713
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: x32 Win build failure

Post by vejmarie »

@wmayer, I will have a look to your mefisto issue, it is far much easier for me to fix it as it appears on linux ;). Let's try to understand from where it comes before rewinding ;).
Post Reply