Menu

#322 build error on OS X > 10.8: use of overloaded operator '==' is ambiguous

Undefined
fixed
osx (8)
Bug_Report
2019-06-24
2016-03-30
No

The build of CB succeeds on OS X 10.6-10.8, but fails on 10.9-10.11 where the default stdlib is now libc++.

In file included from debuggergdb.cpp:10:
In file included from ../../../src/include/sdk.h:17:
In file included from ../../../src/include/sdk_precomp.h:13:
In file included from ../../../src/include/sdk_common.h:43:
../../../src/include/prep.h:33:75: error: use of overloaded operator '==' is ambiguous (with operand types 'const std::__1::shared_ptr<GDBWatch>' and 'int')
        template<typename T> bool equals(T const& rhs) const { return rhs == 0; }
                                                                      ~~~ ^  ~
../../../src/include/prep.h:45:99: note: in instantiation of function template specialization 'nullptr_t::equals<std::__1::shared_ptr<GDBWatch> >' requested here
    template<typename T> inline bool operator==(T const& lhs, const nullptr_t& rhs) { return  rhs.equals(lhs); }
                                                                                                  ^
debuggergdb.cpp:504:27: note: in instantiation of function template specialization 'operator==<std::__1::shared_ptr<GDBWatch> >' requested here
        if (m_localsWatch == nullptr)
                          ^

Full log is here, the easiest way to to get it with

wget https://build.macports.org/builders/buildports-elcapitan-x86_64/builds/660/steps/compile/logs/stdio/text

I mentioned this in ticket #13 (but it's a different issue).

Discussion

  • Teodor Petrov

    Teodor Petrov - 2016-03-30

    Have you seen this message: http://forums.codeblocks.org/index.php/topic,19510.msg138971.html#msg138971 and the patch in the following one?

     
  • Teodor Petrov

    Teodor Petrov - 2016-03-30
    • assigned_to: Teodor Petrov
    • Type: Undefined --> Bug_Report
     
  • Mojca Miklavec

    Mojca Miklavec - 2016-03-31

    I didn't see it. But I tried the patch now and it didn't help.

     
  • Teodor Petrov

    Teodor Petrov - 2016-03-31

    What are the steps needed in order to reproduce the problem (I'm new to osx and macports)?

     
  • Mojca Miklavec

    Mojca Miklavec - 2016-03-31

    Install macports, add /opt/local/bin to PATH and then run:

    sudo port selfupdate
    sudo port -v install codeblocks
    

    Other relevant flags are -d for debug (even more verbose output; -v means verbose of course), -k to keep the build files even after the installation is complete, -s to install from source (but you won't get it from binary archive anyway now that it's broken, so you don't need that flag). You can also go to a different stage with

    sudo port -v fetch|patch|configure|build|destroot|install codeblocks
    

    If you want to modify code after the build breaks, this is the easiest way to go to the build tree:

    cd $(port work codeblocks)
    

    and then modify the code and run sudo port install codeblocks again or just run sudo make manually from the build dir.

    If you need help with modifying configuration flags, let me know. Here are the package sources.

    Most likely you would get the same error if you would install CodeBlocks from scratch, but you would need to install all dependencies first, so using a package manager might be helpful to get at least the dependencies right. (You can theoretically also install MacPorts to a user dir, but you need to install it from source to give it the right prefix etc. But that is a lot less tested.)

     
  • Mojca Miklavec

    Mojca Miklavec - 2016-06-09

    Users keep asking if there is any progress on this issue. CB still cannot be compiled on any newer version of OS X.

     
  • Mark Summers

    Mark Summers - 2017-07-03

    Caveat: IANA C++ developer.

    That said, this code appears to be checking whether a pointer (as opposed to the thing being pointed to) has value 0. So, why not cast it to a numeric type that is guaranteed to be large enough?

        template<typename T> bool equals(T const& rhs) const { return (uintptr_t)rhs == 0; }
    

    Works for me.

     
  • Mojca Miklavec

    Mojca Miklavec - 2017-07-04

    It's worth noting though that the trunk version only compiles on >= 10.9, but not on earlier versions. I didn't try compiling as C++11 yet, that would probably work

     
  • Mark Summers

    Mark Summers - 2017-07-04

    Since my last post I found various threads online about other issues. A couple of plugins need to be excluded or ported to FSEventsd, and plugins are being built as .so instead of .dylib, which means that they aren't loaded by CB on startup. I also noticed a bug where Quit on the application menu doesn't work properly, while File|Quit does.

     
  • Teodor Petrov

    Teodor Petrov - 2017-07-05

    I have some fixes for the autotools build, I'll see if I can commit them without causing other problems. And then we can try to fix the other issues reported.

    Does anyone know how I can make an application bundle using the autotools scripts?

     
  • Teodor Petrov

    Teodor Petrov - 2017-07-05
    • labels: --> osx
     
  • Teodor Petrov

    Teodor Petrov - 2019-06-24
    • status: open --> fixed
     
  • Teodor Petrov

    Teodor Petrov - 2019-06-24

    Trunk version of Code::Blocks should build fine on macOS now.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.