Skip to content

Fails to build with MinGW #169

Description

@NTULINUX
[ 20%] Building CXX object fmt-11.2.0/CMakeFiles/dsoal.fmt.dir/src/os.cc.obj
cd /home/fedora/dev/dsoal/fmt-11.2.0 && /home/fedora/llvm-mingw/bin/i686-w64-mingw32-clang++ -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST @CMakeFiles/dsoal.fmt.dir/includes_CXX.rsp -O3 -DNDEBUG -std=gnu++20 -fvisibility=hidden -MD -MT fmt-11.2.0/CMakeFiles/dsoal.fmt.dir/src/os.cc.obj -MF CMakeFiles/dsoal.fmt.dir/src/os.cc.obj.d -o CMakeFiles/dsoal.fmt.dir/src/os.cc.obj -c /home/fedora/dev/dsoal/fmt-11.2.0/src/os.cc
In file included from /home/fedora/dev/dsoal/fmt-11.2.0/src/os.cc:13:
In file included from /home/fedora/dev/dsoal/fmt-11.2.0/include/fmt/os.h:11:
/home/fedora/dev/dsoal/fmt-11.2.0/include/fmt/format.h:747:28: error: use of undeclared identifier 'malloc'
  747 |     T* p = static_cast<T*>(malloc(n * sizeof(T)));
      |                            ^~~~~~
/home/fedora/dev/dsoal/fmt-11.2.0/include/fmt/format.h:752:35: error: call to function 'free' that is neither visible in the template definition nor found by argument-dependent
      lookup
  752 |   void deallocate(T* p, size_t) { free(p); }
      |                                   ^
/home/fedora/dev/dsoal/fmt-11.2.0/include/fmt/format.h:812:46: note: in instantiation of member function 'fmt::detail::allocator<int>::deallocate' requested here
  812 |     if (old_data != self.store_) self.alloc_.deallocate(old_data, old_capacity);
      |                                              ^
/home/fedora/llvm-mingw/i686-w64-mingw32/include/stdlib.h:456:16: note: 'free' should be declared prior to the call site
  456 |   void __cdecl free(void *_Memory);
      |                ^
In file included from /home/fedora/dev/dsoal/fmt-11.2.0/src/os.cc:13:
In file included from /home/fedora/dev/dsoal/fmt-11.2.0/include/fmt/os.h:11:
/home/fedora/dev/dsoal/fmt-11.2.0/include/fmt/format.h:752:35: error: call to function 'free' that is neither visible in the template definition nor found by argument-dependent
      lookup
  752 |   void deallocate(T* p, size_t) { free(p); }
      |                                   ^
/home/fedora/dev/dsoal/fmt-11.2.0/include/fmt/format.h:812:46: note: in instantiation of member function 'fmt::detail::allocator<char>::deallocate' requested here
  812 |     if (old_data != self.store_) self.alloc_.deallocate(old_data, old_capacity);
      |                                              ^
/home/fedora/llvm-mingw/i686-w64-mingw32/include/stdlib.h:456:16: note: 'free' should be declared prior to the call site
  456 |   void __cdecl free(void *_Memory);
      |                ^
In file included from /home/fedora/dev/dsoal/fmt-11.2.0/src/os.cc:13:
In file included from /home/fedora/dev/dsoal/fmt-11.2.0/include/fmt/os.h:11:
/home/fedora/dev/dsoal/fmt-11.2.0/include/fmt/format.h:752:35: error: call to function 'free' that is neither visible in the template definition nor found by argument-dependent
      lookup
  752 |   void deallocate(T* p, size_t) { free(p); }
      |                                   ^
/home/fedora/dev/dsoal/fmt-11.2.0/include/fmt/format.h:812:46: note: in instantiation of member function 'fmt::detail::allocator<unsigned int>::deallocate' requested here
  812 |     if (old_data != self.store_) self.alloc_.deallocate(old_data, old_capacity);
      |                                              ^
/home/fedora/llvm-mingw/i686-w64-mingw32/include/stdlib.h:456:16: note: 'free' should be declared prior to the call site
  456 |   void __cdecl free(void *_Memory);
      |                ^
4 errors generated.
make[2]: *** [fmt-11.2.0/CMakeFiles/dsoal.fmt.dir/build.make:95: fmt-11.2.0/CMakeFiles/dsoal.fmt.dir/src/os.cc.obj] Error 1
make[2]: Leaving directory '/home/fedora/dev/dsoal'
make[1]: *** [CMakeFiles/Makefile2:208: fmt-11.2.0/CMakeFiles/dsoal.fmt.dir/all] Error 2
make[1]: Leaving directory '/home/fedora/dev/dsoal'
make: *** [Makefile:156: all] Error 2

I had to make this file called mingw.conf:

set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_C_COMPILER i686-w64-mingw32-clang)
set(CMAKE_CXX_COMPILER i686-w64-mingw32-clang++)
set(CMAKE_RC_COMPILER i686-w64-mingw32-windres)
set(CMAKE_FIND_ROOT_PATH /home/fedora/llvm-mingw/generic-w64-mingw32/include)

and then specified -DCMAKE_TOOLCHAIN_FILE=mingw.conf on cmake line. Not sure how you're supposed to build DSOAL outside of MSVC so I might have hooked this up wrong. I am on Linux but intend to use with Wine, thanks!

Btw, my exact toolchain is hosted here: https://github.com/NTULINUX/llvm-mingw/releases/tag/03122026

For now I will just use your binary release. If you have any info on building with MinGW please let me know!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions