tpaviot / oce

OpenCASCADE Community Edition (OCE): a community driven fork of the Open CASCADE library.
http://groups.google.com/group/oce-dev
GNU Lesser General Public License v2.1
806 stars 283 forks source link

msys2/mingw64 build fails #653

Open sanderboer opened 7 years ago

sanderboer commented 7 years ago

Hi,

On windows10, msys2/mingw64, trying to build the git repo cloned fresh on 16jan 2017, the build fails complaining about "external linkage required" :

`[ 42%] Building CXX object adm/cmake/TKTopAlgo/CMakeFiles/TKTopAlgo.dir///__/src/BRepBuilderAPI/BRepBuilderAPI_FastSewing.cxx.obj In file included from D:/OpenCascade/oce/inc/Handle_TopoDS_TShape.hxx:10:0, from D:/OpenCascade/oce/inc/TopoDS_Shape.hxx:13, from D:/OpenCascade/oce/drv/BRepBuilderAPI/BRepBuilderAPI_Copy.jxx:1, from D:/OpenCascade/oce/drv/BRepBuilderAPI/BRepBuilderAPI_Copy.ixx:6, from D:/OpenCascade/oce/src/BRepBuilderAPI/BRepBuilderAPI_Copy.cxx:17: D:/OpenCascade/oce/src/Standard/Standard_DefineHandle.hxx:94:54: error: external linkage required for symbol 'const Handle_Standard_Type& {anonymous}::BRepBuilderAPI_Copy_Modification::DynamicType() const' because of 'dllexport' attribute Standard_EXPORT virtual const Handle(Standard_Type)& DynamicType() const; ^ D:/OpenCascade/oce/src/BRepBuilderAPI/BRepBuilderAPI_Copy.cxx:139:3: note: in expansion of macro 'DEFINE_STANDARD_RTTI' DEFINE_STANDARD_RTTI(BRepBuilderAPI_Copy_Modification) ^~~~~~~~ D:/OpenCascade/oce/src/Standard/Standard_DefineHandle.hxx:76:37: error: external linkage required for symbol 'static {anonymous}::Handle_BRepBuilderAPI_Copy_Modification {anonymous}::Handle_BRepBuilderAPI_Copy_Modification::DownCast(const Handle_Standard_Transient&)' because of 'dllexport' attribute Standard_EXPORT static Handle(C1) DownCast(const Handle(BC)& AnObject); \ ^ D:/OpenCascade/oce/src/Standard/Standard_DefineHandle.hxx:81:39: note: in expansion of macro 'DEFINE_STANDARD_HANDLECLASS'

define DEFINE_STANDARD_HANDLE(C1,C2) DEFINE_STANDARD_HANDLECLASS(C1,C2,Standard_Transient)

                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~

D:/OpenCascade/oce/src/BRepBuilderAPI/BRepBuilderAPI_Copy.cxx:146:1: note: in expansion of macro 'DEFINE_STANDARD_HANDLE' DEFINE_STANDARD_HANDLE(BRepBuilderAPI_Copy_Modification, BRepTools_Modification) ^~~~~~ make[2]: [adm/cmake/TKTopAlgo/CMakeFiles/TKTopAlgo.dir/build.make:4339: adm/cmake/TKTopAlgo/CMakeFiles/TKTopAlgo.dir///__/src/BRepBuilderAPI/BRepBuilderAPI_Copy.cxx.obj] Error 1 make[2]: Waiting for unfinished jobs.... make[1]: [CMakeFiles/Makefile2:1420: adm/cmake/TKTopAlgo/CMakeFiles/TKTopAlgo.dir/all] Error 2 make: [Makefile:161: all] Error 2`

Any suggestions ?

gr. Sander

sanderboer commented 7 years ago

I just succesfully compiled 0.17.2 from the packaged source zip with this msys2/mingw64 setup. Trying to compile 0.18 from the packaged zip results in the same error, however.

tpaviot commented 7 years ago

@sanderboer thank you for your report

strange, mingw64 uses to work see https://ci.appveyor.com/project/tpaviot/oce

which gcc version is it ? can you please copy/paste the full trace

tpaviot commented 7 years ago

@sanderboer did u have a look at https://github.com/tpaviot/oce/issues/631 ?

mat127 commented 7 years ago

Hi, I have encoutered nearly the same error while building the 0.18.1 on Win7:

[ 23%] Building CXX object adm/cmake/TKTopAlgo/CMakeFiles/TKTopAlgo.dir///__/src/BRepBuilderAPI/BRepBuilderAPI_Copy.cxx.obj In file included from C:/Users/Petr.Matousek/Documents/NetBeansProjects/oce/inc/Handle_TopoDS_TShape.hxx:10:0, from C:/Users/Petr.Matousek/Documents/NetBeansProjects/oce/inc/TopoDS_Shape.hxx:13, from C:/Users/Petr.Matousek/Documents/NetBeansProjects/oce/drv/BRepBuilderAPI/BRepBuilderAPI_Copy.jxx:1, from C:/Users/Petr.Matousek/Documents/NetBeansProjects/oce/drv/BRepBuilderAPI/BRepBuilderAPI_Copy.ixx:6, from C:/Users/Petr.Matousek/Documents/NetBeansProjects/oce/src/BRepBuilderAPI/BRepBuilderAPI_Copy.cxx:17: C:/Users/Petr.Matousek/Documents/NetBeansProjects/oce/src/Standard/Standard_DefineHandle.hxx:94:54: error: external linkage required for symbol 'const Handle_Standard_Type& {anonymous}::BRepBuilderAPI_Copy_Modification::DynamicType() const' because of 'dllexport' attribute Standard_EXPORT virtual const Handle(Standard_Type)& DynamicType() const; ^ C:/Users/Petr.Matousek/Documents/NetBeansProjects/oce/src/BRepBuilderAPI/BRepBuilderAPI_Copy.cxx:139:3: note: in expansion of macro 'DEFINE_STANDARD_RTTI' DEFINE_STANDARD_RTTI(BRepBuilderAPI_Copy_Modification) ^~~~~~~~ C:/Users/Petr.Matousek/Documents/NetBeansProjects/oce/src/Standard/Standard_DefineHandle.hxx:76:37: error: external linkage required for symbol 'static {anonymous}::Handle_BRepBuilderAPI_Copy_Modification {anonymous}::Handle_BRepBuilderAPI_Copy_Modification::DownCast(const Handle_Standard_Transient&)' because of 'dllexport' attribute Standard_EXPORT static Handle(C1) DownCast(const Handle(BC)& AnObject); \ ^ C:/Users/Petr.Matousek/Documents/NetBeansProjects/oce/src/Standard/Standard_DefineHandle.hxx:81:39: note: in expansion of macro 'DEFINE_STANDARD_HANDLECLASS'

define DEFINE_STANDARD_HANDLE(C1,C2) DEFINE_STANDARD_HANDLECLASS(C1,C2,Standard_Transient)

                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~

C:/Users/Petr.Matousek/Documents/NetBeansProjects/oce/src/BRepBuilderAPI/BRepBuilderAPI_Copy.cxx:146:1: note: in expansion of macro 'DEFINE_STANDARD_HANDLE' DEFINE_STANDARD_HANDLE(BRepBuilderAPI_Copy_Modification, BRepTools_Modification) ^~~~~~ make[2]: [adm/cmake/TKTopAlgo/CMakeFiles/TKTopAlgo.dir/build.make:4339: adm/cmake/TKTopAlgo/CMakeFiles/TKTopAlgo.dir///__/src/BRepBuilderAPI/BRepBuilderAPI_Copy.cxx.obj] Chyba 1 make[1]: [CMakeFiles/Makefile2:1420: adm/cmake/TKTopAlgo/CMakeFiles/TKTopAlgo.dir/all] Chyba 2 make: *** [Makefile:163: all] Chyba 2

I have a fresh MSYS2 installation, the version of gcc is:

$ gcc --version gcc.exe (Rev3, Built by MSYS2 project) 6.3.0 Copyright (C) 2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I followed the steps described in https://github.com/tpaviot/oce/blob/master/BUILD.MSYS2.md

mat127 commented 7 years ago

According to my exploration this could be related to the version of the gcc as I was not able to compile under mingw-w64 with gcc 6.x too. With gcc 5.x the compilation was successful.

Unfortunately I was not able to downgrade the gcc under the MSys2 as nearly everything (including the core components like e.g. pacman) are dependent on the gcc-libs that has to be downgraded too.

On the other hand the compilation with the gcc 6.3.1 was successful on my Linux machine.

So this is where I got so far, just wanted to share the info.

ArvinShaffer commented 3 years ago

@sanderboer thank you for your report

strange, mingw64 uses to work see https://ci.appveyor.com/project/tpaviot/oce

which gcc version is it ? can you please copy/paste the full trace

I tried the above method to successfully compile Oce, but these libraries are missing -lTKPCAF -lTKXCAFSchema -lTKShapeSchema -lTKPLCAF -lTKNIS -lTKStdLSchema -lTKVoxel -lTKPShape -lTKStdSchema

PS D:\software\oce-OCE-0.18\build> gcc --version
gcc.exe (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
ArvinShaffer commented 2 years ago

I successfully used gcc5.3 to compile oce0.18,solve the error Standard_DefineHandle.hxx:94:54: error: external linkage required for symbol 'const Handle_Standard_Type& {anonymous}::BRepBuilderAPI_Copy_Modification::DynamicType() const' because of 'dllexport' attribute