Блог пользователя fahadkabir123

Автор fahadkabir123, история, 4 года назад, По-английски

I recently upgraded to macOS 13 (Ventura) public, and updated brew and gcc, but later I found this error and now I am unable to run any c++ code with gcc g++-11: warning: could not understand version '13.00.00'

ld: -rpath can only be used when targeting Mac OS X 10.5 or later collect2: error: ld returned 1 exit status [Finished in 660ms with exit code 1]

Previously i used to run my c++ code with this sublime build.

{ "cmd" : ["g++-10 $file_name -o $file_base_name && gtimeout 4s ./$file_base_name<inputf.in>outputf.in"], "selector" : "source.c", "shell": true, "working_dir" : "$file_path" }

source : https://github.com/luvk1412/Competitive-Programming/blob/master/C%2B%2B14_os_x.sublime-build

but currently is not working. Now i'm facing this problem below.

/bin/sh: g++-10: command not found [Finished in 18ms with exit code 127] [cmd: ['g++-10 map_practice.cpp -o map_practice && gtimeout 4s ./map_practice<inputf.in>outputf.in']]

I've already installed gcc-12 through Homebrew. What can i do now. Please Help me.

  • Проголосовать: нравится
  • +7
  • Проголосовать: не нравится

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by fahadkabir123 (previous revision, new revision, compare).

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Have you tried g++-12?

  • »
    »
    4 года назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    YES.

    But when i run this command [ gcc-12 -v ] on terminal it shows-

    Using built-in specs. COLLECT_GCC=gcc-12 COLLECT_LTO_WRAPPER=/opt/homebrew/Cellar/gcc/12.2.0/bin/../libexec/gcc/aarch64-apple-darwin22/12/lto-wrapper Target: aarch64-apple-darwin22 Configured with: ../configure --prefix=/opt/homebrew/opt/gcc --libdir=/opt/homebrew/opt/gcc/lib/gcc/current --disable-nls --enable-checking=release --with-gcc-major-version-only --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-12 --with-gmp=/opt/homebrew/opt/gmp --with-mpfr=/opt/homebrew/opt/mpfr --with-mpc=/opt/homebrew/opt/libmpc --with-isl=/opt/homebrew/opt/isl --with-zstd=/opt/homebrew/opt/zstd --with-pkgversion='Homebrew GCC 12.2.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --with-system-zlib --build=aarch64-apple-darwin22 --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 12.2.0 (Homebrew GCC 12.2.0)

    but when i use this command [ gcc --version ]

    it shows-

    gcc: warning: could not understand version '13.00.00' gcc (Homebrew GCC 11.3.0) 11.3.0 Copyright (C) 2021 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.

    • »
      »
      »
      4 года назад, скрыть # ^ |
       
      Проголосовать: нравится 0 Проголосовать: не нравится

      I'm not sure but I think you aliased your gcc to something else before, which after the update cannot be found on the system.
      What you can do to run your code is, in your sublime build change g++-10 to g++-12

      • »
        »
        »
        »
        4 года назад, скрыть # ^ |
         
        Проголосовать: нравится +1 Проголосовать: не нравится

        I wrote a simple hello world program (sublime build changed g++-10 to g++-12)

        but it shows-

        In file included from /opt/homebrew/Cellar/gcc/12.2.0/include/c++/12/aarch64-apple-darwin22/bits/stdc++.h:33, from map_practice.cpp:2: /opt/homebrew/Cellar/gcc/12.2.0/include/c++/12/cassert:44:10: fatal error: assert.h: No such file or directory 44 | #include <assert.h> | ^~~~~~~~~~ compilation terminated. [Finished in 98ms with exit code 1]

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I'm also facing an issue after upgrading my os -> 0 0x1044841a0 __assert_rtn + 140 1 0x10430ba8c mach_o::relocatable::Parser::parse(mach_o::relocatable::ParserOptions const&) + 4536 2 0x1042ddd38 mach_o::relocatable::Parser::parse(unsigned char const*, unsigned long long, char const*, long, ld::File::Ordinal, mach_o::relocatable::ParserOptions const&) + 148 3 0x1043464ac ld::tool::InputFiles::makeFile(Options::FileInfo const&, bool) + 1468 4 0x104349360 ___ZN2ld4tool10InputFilesC2ER7Options_block_invoke + 56 5 0x1b44d41f4 _dispatch_client_callout2 + 20 6 0x1b44e8f8c _dispatch_apply_invoke_and_wait + 224 7 0x1b44e826c _dispatch_apply_with_attr_f + 1152 8 0x1b44e847c dispatch_apply + 108 9 0x1043491f4 ld::tool::InputFiles::InputFiles(Options&) + 616 10 0x1042cb6c0 main + 552

I don't have any idea what this is...I have googled it and people are getting this error but there seems to be no solution for this. Also this error only appears when i add this line in my code-> void _print(string t) {cerr << t <<ln;} // to debug a string ig. Also sometimes when i take map of pair as keys etc.