首页 > 其他分享 >MinGW GCC 编译Glog0.6.0

MinGW GCC 编译Glog0.6.0

时间:2024-07-06 16:12:37浏览次数:5  
标签:tmp src GCC google Glog0.6 MinGW glog internal 0.7

 GCC版本: gcc version 5.3.0 (i686-posix-dwarf-rev0, Built by MinGW-W64 project)

glog 0.6.0地址: https://github.com/google/glog/tree/v0.6.0

 编译很顺利,直接

 然后进入C:/tmp/glog-0.6.0/Build2目录,执行命令:

 编译完成后,在目录下存在libglog.dll和libglog.dll.a:

 已编译好的glog0.6.0 32位:

https://wwp.lanzoue.com/imurS23obnxc
密码:6v53

 

最新是0.7.1,发现编译0.7.1报错::error: enclosing class of constexpr non-static member function 'google::glog_internal_namespace_::FileDescriptor::operator bool() const' is not a literal type

完整报错:

C:\tmp\glog-0.7.1\Build>mingw32-make
[  3%] Building CXX object CMakeFiles/glog_internal.dir/src/demangle.cc.obj
In file included from C:\tmp\glog-0.7.1\glog-0.7.1\src\demangle.cc:43:0:
C:\tmp\glog-0.7.1\glog-0.7.1\src\utilities.h:210:22: error: enclosing class of constexpr non-static member function 'google::glog_internal_namespace_::FileDescriptor::operator bool() const' is not a literal type
   constexpr explicit operator bool() const noexcept {
                      ^
C:\tmp\glog-0.7.1\glog-0.7.1\src\utilities.h:190:22: note: 'google::glog_internal_namespace_::FileDescriptor' is not literal because:
 class GLOG_NO_EXPORT FileDescriptor final {
                      ^
C:\tmp\glog-0.7.1\glog-0.7.1\src\utilities.h:190:22: note:   'google::glog_internal_namespace_::FileDescriptor' has a non-trivial destructor
C:\tmp\glog-0.7.1\glog-0.7.1\src\utilities.h:214:17: error: enclosing class of constexpr non-static member function 'int google::glog_internal_namespace_::FileDescriptor::get() const' is not a literal type
   constexpr int get() const noexcept { return fd_; }
                 ^
C:\tmp\glog-0.7.1\glog-0.7.1\src\utilities.h: In function 'constexpr bool google::glog_internal_namespace_::operator==(const google::glog_internal_namespace_::FileDescriptor&, int)':
C:\tmp\glog-0.7.1\glog-0.7.1\src\utilities.h:243:17: error: call to non-constexpr function 'int google::glog_internal_namespace_::FileDescriptor::get() const'
   return lhs.get() == rhs;
                 ^
C:\tmp\glog-0.7.1\glog-0.7.1\src\utilities.h: In function 'constexpr bool google::glog_internal_namespace_::operator==(const google::glog_internal_namespace_::FileDescriptor&, std::nullptr_t)':
C:\tmp\glog-0.7.1\glog-0.7.1\src\utilities.h:259:11: error: call to non-constexpr function 'google::glog_internal_namespace_::FileDescriptor::operator bool() const'
   return !lhs;
           ^
C:\tmp\glog-0.7.1\glog-0.7.1\src\utilities.h: In function 'constexpr bool google::glog_internal_namespace_::operator==(std::nullptr_t, const google::glog_internal_namespace_::FileDescriptor&)':
C:\tmp\glog-0.7.1\glog-0.7.1\src\utilities.h:263:11: error: call to non-constexpr function 'google::glog_internal_namespace_::FileDescriptor::operator bool() const'
   return !rhs;
           ^
C:\tmp\glog-0.7.1\glog-0.7.1\src\utilities.h: In function 'constexpr bool google::glog_internal_namespace_::operator!=(const google::glog_internal_namespace_::FileDescriptor&, std::nullptr_t)':
C:\tmp\glog-0.7.1\glog-0.7.1\src\utilities.h:267:31: error: call to non-constexpr function 'google::glog_internal_namespace_::FileDescriptor::operator bool() const'
   return static_cast<bool>(lhs);
                               ^
C:\tmp\glog-0.7.1\glog-0.7.1\src\utilities.h: In function 'constexpr bool google::glog_internal_namespace_::operator!=(std::nullptr_t, const google::glog_internal_namespace_::FileDescriptor&)':
C:\tmp\glog-0.7.1\glog-0.7.1\src\utilities.h:271:31: error: call to non-constexpr function 'google::glog_internal_namespace_::FileDescriptor::operator bool() const'
   return static_cast<bool>(rhs);
                               ^
C:\tmp\glog-0.7.1\glog-0.7.1\src\utilities.h: At global scope:
C:\tmp\glog-0.7.1\glog-0.7.1\src\utilities.h:279:13: error: specialization of 'template<class _Tp> struct std::default_delete' in different namespace [-fpermissive]
 struct std::default_delete<std::FILE> {
             ^
In file included from C:/Develop/i686-5.3.0-release-posix-dwarf-rt_v4-rev0/mingw32/i686-w64-mingw32/include/c++/memory:81:0,
                 from C:\tmp\glog-0.7.1\glog-0.7.1\src\utilities.h:40,
                 from C:\tmp\glog-0.7.1\glog-0.7.1\src\demangle.cc:43:
C:/Develop/i686-5.3.0-release-posix-dwarf-rt_v4-rev0/mingw32/i686-w64-mingw32/include/c++/bits/unique_ptr.h:54:12: error:   from definition of 'template<class _Tp> struct std::default_delete' [-fpermissive]
     struct default_delete
            ^
mingw32-make[2]: *** [CMakeFiles\glog_internal.dir\build.make:76: CMakeFiles/glog_internal.dir/src/demangle.cc.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:860: CMakeFiles/glog_internal.dir/all] Error 2
mingw32-make: *** [Makefile:165: all] Error 2

 使用GCC 7.4以上进行编译,亲测使用8.1.0编译通过.

注意CMake执行时第一句是否是GCC 7.4以上,我就犯了这个错误,CMake默认读取的是系统环境变量GCC,系统环境变量配置的GCC使用的是GCC 5.3.0,即使生成Makefile后在执行mingw32-make编译使用的GCC 8.1.0的mingw32-make,也是会报错。

 所以解决这个问题,首先需要下载>GCC 7.4的版本,并且在CMake中正确配置GCC 新版本,并且在执行mingw32-make时要保证最终的mingw32-make是新版本中的MinGW(>7.4 GCC版本中),而不是旧版本MinGW

可以通过在CMake界面中点击Environment修改PATH环境变量,并把新GCC版本bin路径添加到最前:

 并且在生成Makefile,执行mingw32-make时,也可以通过set 命令临时修改PATH环境变量,让执行mingw32-make时指向最新的GCC编译器:

 

标签:tmp,src,GCC,google,Glog0.6,MinGW,glog,internal,0.7
From: https://www.cnblogs.com/GengMingYan/p/18287329

相关文章

  • MinGW GCC Windows下编译libmodbus
    最近项目从MSVC切换到GCC,libmodbus官网没提供MinGW下GCC如何编译,官网推荐在类UNIX环境下MSYS下编译,个人更偏向直接拿源文件编译。编译libmodbus版本:libmodbus-3.1.10GCC编译器版本: 5.3.0(i686-posix-dwarf-rev0,BuiltbyMinGW-W64project)CMake版本: 3.29.0在随笔最......
  • Install gcc-14 on Ubuntu 22.04
    Installgcc-14onUbuntu22.04 Thesteps:1sudoaptinstallbuild-essential2sudoaptinstalllibmpfr-devlibgmp3-devlibmpc-dev-y3wgethttp://ftp.gnu.org/gnu/gcc/gcc-14.1.0/gcc-14.1.0.tar.gz4tar-xfgcc-14.1.0.tar.gz5cdgcc-14.1.06./configur......
  • 安装Mingw64
    进入官网:MinGW-w64-for32and64bitWindowsdownload|SourceForge.net点击Files,找到如下所示的这个版本双击即可下载,下载完成后解压在c盘将路径“C:\mingw64\bin”设置为环境变量(选中PATH,点击编译——新建)到此完成安装,在powershell输入命令测......
  • 如何在Windows11下部署Linux子系统中安装GCC编译器
    GCC编译器安装:1:gcc出现命令找不到2.直接按照提示来安装。会发现链接找不到服务器原因是因为默认的服务器在国外,无法直接进行访问,需要切换成国内的服务器3.切换软件源——换成国内的服务器注意:软件源要与版本号一致!演示所用均为22.04版本号,可根据版本号找对应的软件......
  • 【Linux】环境基础开发工具使用(yum、vim、gcc/g++、gdb、make/Makefile)
    文章目录Linux软件包管理器yumLinux开发工具Linux编辑器-vim使用vim的基本概念vim下各模式的切换vim命令模式各命令汇总vim底行模式各命令汇总批量化注释和批量化去注释vim简单的配置解决一个小问题Linux编译器-gcc/g++作用gcc/g++语法预处理编译汇编链接什么是函数......
  • centos7离线升级gcc , 报错:/lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found
     因为需要依赖gcc高版本但是目前服务器版本是4.8.5的然后服务器又是内网所以只能离线升级gcc 分别下载https://ftp.gnu.org/gnu/gcc/gcc-8.3.0/gcc-8.3.0.tar.gzhttps://ftp.gnu.org/pub/gnu/gmp/gmp-6.1.0.tar.bz2https://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gzhttp:......
  • Linux常用命令及或g++(或gcc)编辑器运用
    一.实验内容1.打开VMwareWorkstation虚拟机进入Ubuntu系统,打开终端。练习使用常用的Linux命令,主要包括如下命令:mkdir,rmdir,cd,pwd,ls,clear,cat,rm等。(其中,cat、rm命令请在下面实验内容3完成后再练习。)Linux各命令使用方法可下载ftp中文档《Linux入门常用命令》......
  • gcc编译时报错 fatal error: stdio.h: 没有那个文件或目录
    在kylinV10中使用GCC编译代码时遇到如下问题:首先确认了,自己单词没有拼写错。然后再检查GCC的版本,确实没问题。没有标准的头文件需要安装build-essential来解决。需要安装build-essential。执行以下命令:sudoapt-getinstallbuild-essential如无兼容版本可使用可使用ap......
  • 记一次编译GCC的经历
    背景因为有在Linux环境编译C++程序的需求,故我于近日在电脑上安装了WSL。鉴于APT(Ubuntu的包管理器)提供的GCC版本较老(确切来说,APT会根据Ubuntu版本来下载并安装某个版本的GCC,不一定为最新,例如对Ubuntu22.04而言,从APT获取的最新版本GCC为11.2.0),我便尝试自己编译一套GCC工具链。在......
  • Linux下的gcc命令
    转载:https://blog.csdn.net/weixin_47826078/article/details/120474122文章目录准备:test.c1.编译过程1.1预处理(Pre-Processing)1.2汇编(Assembling)1.3编译(Compiling)*gcc-c1.4链接(Linking)2.简化过程——gcc3.gcc常用选项总结准备:test.c在正式开......