Skip to content

Compilation Issues with IfcOpenShell in MSys2 Environment #6568

@VMajorczyk

Description

@VMajorczyk

Bug Description

I followed the installation instructions provided at https://docs.ifcopenshell.org/ifcopenshell/installation.html for using IfcOpenShell with MSys2. After installing MSys2 as specified (and installing mingw-w64-ucrt-x86_64-gcc cf. https://www.msys2.org/) and attempting to compile the project, I encountered a series of issues mostly related to the MSys2 environment. While I was able to resolve some of these issues, the compilation process ultimately failed due to errors requiring modifications to the IfcOpenShell code, which I am not supposed to alter.

Below is a detailed list of the problems encountered during the setup and compilation process, along with the steps I took to resolve them. The purpose of listing these actions is to ensure there wasn’t a mistake in the setup process that could have caused these errors.

1. Initial Error

error: failed to init transaction (unable to lock database)
error: could not lock database: Permission denied

Resolution: This issue was resolved by starting MSys2 with administrator privileges.

2. Missing Git and CMake Recognition:

Despite Git and CMake being installed on my system, MSys2 did not recognize them initially. To resolve this, I installed these tools within the MSys2 environment using the following commands:

pacman -S git  
pacman -S mingw-w64-x86_64-cmake

3. Compilation Failure:

When running the following command:

./build-deps.sh

I encountered the following compilation errors:

C:/Users/...

[trace.txt](https://github.com/user-attachments/files/19792590/trace.txt)

/IfcOpenshell/deps/OpenCOLLADA/common/libBuffer/include/CommonFWriteBufferFlusher.h:44:9: error: 'int64_t' does not name a type
   44 | typedef int64_t __int64;
C:/Users/.../IfcOpenshell/deps/OpenCOLLADA/Externals/LibXML/threads.c:452:43: error: passing argument 1 of '_InterlockedCompareExchangePointer' from incompatible pointer type [-Wincompatible-pointer-types]
  452 |         InterlockedCompareExchangePointer(&global_init_lock, cs, NULL);
      |                                           ^~~~~~~~~~~~~~~~~
      |                                           |
      |                                           struct _RTL_CRITICAL_SECTION * volatile*

Request: Could you please provide guidance on resolving the compilation errors? Alternatively, if the issue stems from the MSys2 environment, I would appreciate recommendations for adjustments or an alternative setup.

Attachments

No response

Debug and Error Output

WSys2 > ./build-deps.sh

:: There are 13 members in group mingw-w64-x86_64-toolchain:
:: Repository mingw64
   1) mingw-w64-x86_64-binutils  2) mingw-w64-x86_64-crt-git  3) mingw-w64-x86_64-gcc  4) mingw-w64-x86_64-gdb  5) mingw-w64-x86_64-gdb-multiarch
   6) mingw-w64-x86_64-headers-git  7) mingw-w64-x86_64-libmangle-git  8) mingw-w64-x86_64-libwinpthread-git  9) mingw-w64-x86_64-make
   10) mingw-w64-x86_64-pkgconf  11) mingw-w64-x86_64-tools-git  12) mingw-w64-x86_64-winpthreads-git  13) mingw-w64-x86_64-winstorecompat-git

Enter a selection (default=all):
warning: mingw-w64-x86_64-binutils-2.44-1 is up to date -- reinstalling
warning: mingw-w64-x86_64-crt-git-12.0.0.r509.g079e6092b-1 is up to date -- reinstalling
warning: mingw-w64-x86_64-gcc-14.2.0-2 is up to date -- reinstalling
warning: mingw-w64-x86_64-gdb-16.2-1 is up to date -- reinstalling
warning: mingw-w64-x86_64-gdb-multiarch-16.2-1 is up to date -- reinstalling
warning: mingw-w64-x86_64-headers-git-12.0.0.r509.g079e6092b-1 is up to date -- reinstalling
warning: mingw-w64-x86_64-libmangle-git-12.0.0.r509.g079e6092b-1 is up to date -- reinstalling
warning: mingw-w64-x86_64-libwinpthread-git-12.0.0.r509.g079e6092b-1 is up to date -- reinstalling
warning: mingw-w64-x86_64-make-4.4.1-3 is up to date -- reinstalling
warning: mingw-w64-x86_64-pkgconf-1~2.3.0-1 is up to date -- reinstalling
warning: mingw-w64-x86_64-tools-git-12.0.0.r509.g079e6092b-1 is up to date -- reinstalling
warning: mingw-w64-x86_64-winpthreads-git-12.0.0.r509.g079e6092b-1 is up to date -- reinstalling
warning: mingw-w64-x86_64-winstorecompat-git-12.0.0.r509.g079e6092b-1 is up to date -- reinstalling
warning: mingw-w64-x86_64-boost-1.87.0-2 is up to date -- reinstalling
warning: make-4.4.1-2 is up to date -- reinstalling
warning: swig-4.2.1-1 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (16) make-4.4.1-2  mingw-w64-x86_64-binutils-2.44-1  mingw-w64-x86_64-boost-1.87.0-2  mingw-w64-x86_64-crt-git-12.0.0.r509.g079e6092b-1
              mingw-w64-x86_64-gcc-14.2.0-2  mingw-w64-x86_64-gdb-16.2-1  mingw-w64-x86_64-gdb-multiarch-16.2-1
              mingw-w64-x86_64-headers-git-12.0.0.r509.g079e6092b-1  mingw-w64-x86_64-libmangle-git-12.0.0.r509.g079e6092b-1
              mingw-w64-x86_64-libwinpthread-git-12.0.0.r509.g079e6092b-1  mingw-w64-x86_64-make-4.4.1-3  mingw-w64-x86_64-pkgconf-1~2.3.0-1
              mingw-w64-x86_64-tools-git-12.0.0.r509.g079e6092b-1  mingw-w64-x86_64-winpthreads-git-12.0.0.r509.g079e6092b-1
              mingw-w64-x86_64-winstorecompat-git-12.0.0.r509.g079e6092b-1  swig-4.2.1-1

Total Installed Size:  721.13 MiB
Net Upgrade Size:        0.00 MiB

:: Proceed with installation? [Y/n]
(16/16) checking keys in keyring                                                            [#####################################################] 100%
(16/16) checking package integrity                                                          [#####################################################] 100%
(16/16) loading package files                                                               [#####################################################] 100%
(16/16) checking for file conflicts                                                         [#####################################################] 100%
(16/16) checking available disk space                                                       [#####################################################] 100%
:: Processing package changes...
( 1/16) reinstalling mingw-w64-x86_64-libwinpthread-git                                     [#####################################################] 100%
( 2/16) reinstalling mingw-w64-x86_64-binutils                                              [#####################################################] 100%
( 3/16) reinstalling mingw-w64-x86_64-headers-git                                           [#####################################################] 100%
( 4/16) reinstalling mingw-w64-x86_64-crt-git                                               [#####################################################] 100%
( 5/16) reinstalling mingw-w64-x86_64-winpthreads-git                                       [#####################################################] 100%
( 6/16) reinstalling mingw-w64-x86_64-gcc                                                   [#####################################################] 100%
( 7/16) reinstalling mingw-w64-x86_64-gdb                                                   [#####################################################] 100%
( 8/16) reinstalling mingw-w64-x86_64-gdb-multiarch                                         [#####################################################] 100%
( 9/16) reinstalling mingw-w64-x86_64-libmangle-git                                         [#####################################################] 100%
(10/16) reinstalling mingw-w64-x86_64-make                                                  [#####################################################] 100%
(11/16) reinstalling mingw-w64-x86_64-pkgconf                                               [#####################################################] 100%
(12/16) reinstalling mingw-w64-x86_64-tools-git                                             [#####################################################] 100%
(13/16) reinstalling mingw-w64-x86_64-winstorecompat-git                                    [#####################################################] 100%
(14/16) reinstalling mingw-w64-x86_64-boost                                                 [#####################################################] 100%
(15/16) reinstalling make                                                                   [#####################################################] 100%
(16/16) reinstalling swig                                                                   [#####################################################] 100%
:: Running post-transaction hooks...
(1/1) Updating the info directory file...
/c/Users/.../IfcOpenshell/deps/OpenCOLLADA /c/Users/.../IfcOpenshell/win
HEAD is now at 064a60b6 Merge pull request #388 from fl4re/maya-physx-export-fix
/c/Users/.../IfcOpenshell/win
/c/Users/.../IfcOpenshell/deps/OpenCOLLADA /c/Users/.../IfcOpenshell/win
/c/Users/.../IfcOpenshell/deps/OpenCOLLADA/build-msys /c/Users/.../IfcOpenshell/deps/OpenCOLLADA /c/Users/.../IfcOpenshell/win
CMake Deprecation Warning at CMakeLists.txt:19 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.


-- Could NOT find LibXml2 (missing: LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR)
WARNING: Native LibXml2 not found, taking LibXml from ./Externals
-- Could NOT find PCRE (missing: PCRE_INCLUDE_DIR PCRE_PCRE_LIBRARY)
WARNING: Native PCRE not found, taking PCRE from ./Externals
-- Configuring done (0.4s)
-- Generating done (0.9s)
-- Build files have been written to: C:/Users/.../IfcOpenshell/deps/OpenCOLLADA/build-msys
[  1%] Built target UTF_static
[  4%] Built target pcre_static
[  5%] Built target ftoa_static
[  5%] [ B u5i%l]d ingB uCiXlXd ionbgj eCcXtX  CoObLjLeAcDtA BCaOsLeLUA[Dt iA Bla6ss%/e]C UMtaiBkluesiF/liCdlMieasnk/gOe pFCeXiXln eso/bCOjOpLeeLcAntD CAOCLBOLLaALsDAAeDUBAtaBisalessUe_tUstitilalst_sis/cCt.MadatikiercF/.isdlirercs///sCOrOpcLe/LnCCAOODLLALLBAAUDDPAAcBrBaeUsCUeotUmitpliisll.sec_dpsPpt.aattotibcej.rd
ni.rc/pspr.co/bCjO
LLADABUPrecompiledHeaders.cpp.obj
[  6%[[[  ]   7 [  7B7[  %u%i8l]%]]%d    ]i8 BnuB%BgiuB]u liu iCllBdXdiduiXiliin ndnlgogigd b n ijCCgCnXXX egXX Co [X cXbX  oob CoXjbj jbXeetc t  oejCeOcbcj8e%cctCLt]tt OL A  CL CDCCOLOAOOLLALBBLuDiAaLALLlBsADALdaeDADAAsUABiDBetBanAaUiasgBstlse aesseUCiUe/UtXitUCtlXlitMis so/al/sibCkle/ljMesFCsCac/iM/MktC aCkelMCaMeFeiOkaFkilLeaseleLsk/FeFs/eOiAi/OFplDlOpieeAepeensB/annCslOsCCO/epeOOLOseULLLL/ntLpAAOCiAeDDpOlsnAAeLnCDOBLC/OLBaAALasCLDBAseMLaADDUAtkeAAaBeiUBBsaFltaaesUstsiiei_sellUlseUUet_sststis_it/iltslaOtpatslsieta_sscn.Ct__ti[dOissac i cttt.Lr9.aaidL/%sttciArDrii.d]/Accc.i sB/d.driaCBidr//sOurirssericr/rLUcl//scLt/dCir/AiCsOncCDlOrLg/OAsLcL CLB_L/ACOLUsAMDXLAStDaAXLDtaAtB AArBBhUoNtiUU/DbajnUgCAiteIRUOBcUcDItLi.HtL.iLvda iclAeisCspsDSrtOtp..copbpj./rL.AhoFsiLcB
burnApUjnccDpMg
/tA.a.tiBoMchoabapMnajtpsst.
.eohcrUb/pitjCpxiO
.3lLoLb.sAjc/DC
pAMpBa.UkMoeabFtjihlV
eesc/tOopre3n.CcOpLpL.AoDbAjBa
seUtils_static.dir/src/Math/COLLADABUMathUtils.cpp.obj
[  9%] Building CXX object COLLADABaseUtils/CMakeFiles/OpenCOLLADABaseUtils_static.dir/src/Math/COLLADABUMathQuaterni[o n .9c%p]p .objBu
ilding CXX object COLLADABaseUtils/CMakeFiles/OpenCOLLADABaseUtils_static.dir/src/Math/COLLADABUMathMatrix4.cpp.obj
[  9%] Building CXX object common/libBuffer/CMakeFiles/buffer_static.dir/src/CommonFWriteBufferFlusher.cpp.obj
In file included from C:/Users/.../IfcOpenshell/deps/OpenCOLLADA/common/libBuffer/src/CommonFWriteBufferFlusher.cpp:11:
C:/Users/.../IfcOpenshell/deps/OpenCOLLADA/common/libBuffer/include/CommonFWriteBufferFlusher.h:44:9: error: 'int64_t' does not name a type
   44 | typedef int64_t __int64;
      |         ^~~~~~~
C:/Users/.../IfcOpenshell/deps/OpenCOLLADA/common/libBuffer/include/CommonFWriteBufferFlusher.h:38:1: note: 'int64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
   37 | #   include <cstdio>  /* FILE */
  +++ |+#include <cstdint>
   38 | #ifdef __FreeBSD__
make[2]: *** [common/libBuffer/CMakeFiles/buffer_static.dir/build.make:107: common/libBuffer/CMakeFiles/buffer_static.dir/src/CommonFWriteBufferFlusher.cpp.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:455: common/libBuffer/CMakeFiles/buffer_static.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
C:/Users/.../IfcOpenshell/deps/OpenCOLLADA/COLLADABaseUtils/src/COLLADABUStringUtils.cpp: In static member function 'static bool COLLADABU::StringUtils::isNameStartChar(wchar_t)':
C:/Users/.../IfcOpenshell/deps/OpenCOLLADA/COLLADABaseUtils/src/COLLADABUStringUtils.cpp:220:45: warning: comparison is always false due to limited range of data type [-Wtype-limits]
  220 |                                 ||      ( c >= 0x10000 && c <= 0xEFFFF);
      |                                           ~~^~~~~~~~~~
C:/Users/.../IfcOpenshell/deps/OpenCOLLADA/COLLADABaseUtils/src/COLLADABUStringUtils.cpp:220:61: warning: comparison is always true due to limited range of data type [-Wtype-limits]
  220 |                                 ||      ( c >= 0x10000 && c <= 0xEFFFF);
      |                                                           ~~^~~~~~~~~~
[ 15%] Built target MathMLSolver_static
[ 15%] Building C object Externals/LibXML/CMakeFiles/xml_static.dir/threads.c.obj
C:/Users/.../IfcOpenshell/deps/OpenCOLLADA/Externals/LibXML/threads.c: In function '__xmlGlobalInitMutexLock':
C:/Users/.../IfcOpenshell/deps/OpenCOLLADA/Externals/LibXML/threads.c:452:43: error: passing argument 1 of '_InterlockedCompareExchangePointer' from incompatible pointer type [-Wincompatible-pointer-types]
  452 |         InterlockedCompareExchangePointer(&global_init_lock, cs, NULL);
      |                                           ^~~~~~~~~~~~~~~~~
      |                                           |
      |                                           struct _RTL_CRITICAL_SECTION * volatile*
In file included from C:/Program Files (x86)/MSys2/mingw64/include/winnt.h:27,
                 from C:/Program Files (x86)/MSys2/mingw64/include/minwindef.h:163,
                 from C:/Program Files (x86)/MSys2/mingw64/include/windef.h:9,
                 from C:/Program Files (x86)/MSys2/mingw64/include/windows.h:69,
                 from C:/Users/.../IfcOpenshell/deps/OpenCOLLADA/Externals/LibXML/threads.c:32:
C:/Program Files (x86)/MSys2/mingw64/include/psdk_inc/intrin-impl.h:1759:58: note: expected 'void * volatile*' but argument is of type 'struct _RTL_CRITICAL_SECTION * volatile*'
 1759 | void *_InterlockedCompareExchangePointer(void *volatile *Destination, void *ExChange, void *Comperand) {
      |                                          ~~~~~~~~~~~~~~~~^~~~~~~~~~~
C:/Users/.../IfcOpenshell/deps/OpenCOLLADA/Externals/LibXML/threads.c: In function 'xmlOnceInit':
C:/Users/.../IfcOpenshell/deps/OpenCOLLADA/Externals/LibXML/threads.c:933:34: warning: pointer targets in passing argument 1 of '_InterlockedIncrement' differ in signedness [-Wpointer-sign]
  933 |         if (InterlockedIncrement(&run_once.control) == 1) {
      |                                  ^~~~~~~~~~~~~~~~~
      |                                  |
      |                                  DWORD * {aka long unsigned int *}
C:/Program Files (x86)/MSys2/mingw64/include/psdk_inc/intrin-impl.h:1693:51: note: expected 'volatile long int *' but argument is of type 'DWORD *' {aka 'long unsigned int *'}
 1693 | __LONG32 _InterlockedIncrement(__LONG32 volatile *Addend) {
      |                                                   ^
make[2]: *** [Externals/LibXML/CMakeFiles/xml_static.dir/build.make:387: Externals/LibXML/CMakeFiles/xml_static.dir/threads.c.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:359: Externals/LibXML/CMakeFiles/xml_static.dir/all] Error 2
[ 16%] Linking CXX static library ../lib/libOpenCOLLADABaseUtils.a
[ 16%] Built target OpenCOLLADABaseUtils_static
make: *** [Makefile:136: all] Error 2

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions