11

macOS Ventura issue : g++-11: warning: could not understand version '13.00.00'

 1 year ago
source link: http://codeforces.com/blog/entry/108492
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

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.

44 hours ago, # |

Have you tried g++-12?

  • 44 hours ago, # ^ |

    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.

    • 43 hours ago, # ^ |

      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

      • 43 hours ago, # ^ |

        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]

        • 43 hours ago, # ^ |

          Rev. 2  

          0

          This is the same issue I'm facing right now (even I updated to Ventura yesterday and before everything used to work) but I did not find anything helpful yet.

          Currently, I'm using clang++, but it does not have bits/stdc++.h, so you have to manually add it to the directory (btw I'm still facing some issues in it, but hopefully you won't, so try atleast).

          Steps to add bits/stdc++.h
          • 41 hour(s) ago, # ^ |

            Would you please explain a little bit about the step 1? I'm bit confused about this.how do i download? or else just copy it & make a file in my include folder?

            When i put the command of 3rd step- [cd Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/]

            i got - no such file or directory: Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/

            (I put the stdc++.h file directly in include folder)

            • 41 hour(s) ago, # ^ |

              Yeah, just make a new file in Downloads with the name stdc++.h and copy the content from the link. That would be easier.

              About 3rd step, I forgot to add a '/' before Library/... . I have edited the above comment and you can try again.

              Also let me know if this works out for you :) Good luck!

              • 41 hour(s) ago, # ^ |

                Now it is showing :)

                fatal error: 'bits/stdc++.h' file not found

                include <bits/stdc++.h>

                ^~~~~~~~~~~~~~~
                • 40 hours ago, # ^ |

                  Let's move this to Discord. I have DM'ed you.

        • 18 hours ago, # ^ |

          You need to install the XCode Command Line tools. Run xcode-select --install and follow the prompts.

          • 18 hours ago, # ^ |

            Would you please elborate the steps. thank you.

            • 18 hours ago, # ^ |

              Rev. 2  

              0

              Post upgrade to Ventura you need to install XCode command line tools to get the primitive C Headers. Run the command I mentioned in your terminal. A dialog will appear, in which you have to agree to every prompt. The tools will get installed (takes some time with a decent internet).

              Plus make sure to delete any bits/stdc++.h that you have created as the other comment suggested. It is not necessary.

              • 18 hours ago, # ^ |

                Yes Xcode Command Line tools are already installed. then?

                • 18 hours ago, # ^ |

                  If its already installed then you shouldn't be getting any error. I had the same error as you, but simply installing the Command Line Tools worked for me.

                • 18 hours ago, # ^ |

                  Can you just run this in your terminal ? Just to check what version is installed. pkgutil --pkg-info=com.apple.pkg.CLTools_Executables Output should be something like:

                  package-id: com.apple.pkg.CLTools_Executables
                  version: 14.1.0.0.1.1663981106
                  volume: /
                  location: /
                  install-time: 1667055789
                  groups: com.apple.FindSystemFiles.pkg-group
                • 18 hours ago, # ^ |

                  package-id: com.apple.pkg.CLTools_Executables version: 14.0.0.0.1.1661618636 volume: / location: / install-time: 1666798366 groups: com.apple.FindSystemFiles.pkg-group

                • 17 hours ago, # ^ |

                  how do i get this update?

                • 17 hours ago, # ^ |

                  Rev. 2  

                  0

                  Follow the steps I mentioned in this comment to get the latest beta. Since you have the tools installed your error must have resolved, but might run into a linker issue for which follow the linked comment.

                • 18 minutes ago, # ^ |

                  I have installed Command Line Tools for Xcode 14.1 beta 3 as you mentioned. But now it showing this -

                  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/bits/stdc++.h:55:10: fatal error: 'cstdalign' file not found

                  include

                  ^~~~~~~~~~~

                  1 error generated.

  • 43 hours ago, # ^ |

    Should i change sublime build for this problem ? if yes , would you please provide me if you currently using.

42 hours ago, # |

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.

  • 25 hours ago, # ^ |

    Same issue but only if I use std::map. Also #include <assert.h> error with g++-12. Currently I'm using clang, but it does not support auto keyword :sob:

    • 24 hours ago, # ^ |

      Just add -std=c++14 after clang++ in your build. The 'auto' warning would go away.

      • 18 hours ago, # ^ |

        Rev. 3  

        0

        getting this error now /Library/Developer/CommandLineTools/usr/include/bits/stdc++.h:55:10: fatal error: 'cstdalign' file not found

        +can you send your sublime build?

        • 17 hours ago, # ^ |

          In your stdc++.h file, comment line 55 -> #include <cstdalign>. Then, it would work perfectly.

          Sublime Build
  • 18 hours ago, # ^ |

    Did you really Google Search? There is an entire GitHub issue thread for the issue you mentioned. Link here.

    The gist of the long thread, in order to fix the problem, head over to this link, and install Command Line Tools for Xcode 14.1 beta 3. You can restart your Mac once (but worked for me without the restart).

    Cheers!

12 hours ago, # |

Hey, I am also facing similar issues. While compiling, terminal throws error : assert.h: No such file or directory

Were you able to solve your issue? What worked for you?


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK