Developer forums (C::B DEVELOPMENT STRICTLY!) > Contributions to C::B

Can't compile debuggergdb.o on Mac OS Yosemite!

<< < (2/2)

oBFusCATed:
This is a very complex matter.
First we should know which c++ std lib is used to compile all dependencies of cb (wxwidgets in particular).
Then we'll have to compile everything with that library.

Do you know if the libstdc++ available on osx has the tr1 extensions?

Easior Lars:

--- Quote from: oBFusCATed on August 26, 2015, 12:11:17 pm ---This is a very complex matter.
First we should know which c++ std lib is used to compile all dependencies of cb (wxwidgets in particular).
Then we'll have to compile everything with that library.

--- End quote ---

Firstly, I means that I can successfully build Code::Blocks from SVN repository by the below command lines

--- Code: (bash) ---$ ./configure --prefix="${HOME}/Developer/CodeBlocks" \
             --with-contrib-plugins="yes,-FileManager,-NassiShneiderman,-spellchecker" \
                   CXXFLAGS='-std=c++11'
$ make
--- End code ---
with wxWidgets 3.0.2 installed from homebrew. The following codes

--- Code: (c++) ---// Add std::shared_ptr in a namespace, so different implementations can be used with different compilers
namespace cb
{
#if __cplusplus >= 201103L || defined(_LIBCPP_VERSION)
    using std::shared_ptr;
    using std::static_pointer_cast;
    using std::weak_ptr;
#else
    using std::tr1::shared_ptr;
    using std::tr1::static_pointer_cast;
    using std::tr1::weak_ptr;
#endif
}
--- End code ---
in prep.h are why I have said that the different c++ standard has different implement of share_ptr.


--- Quote from: oBFusCATed ---Do you know if the libstdc++ available on osx has the tr1 extensions?

--- End quote ---
I can't answer your question because my c++ knowledge is not enough to properly use smart point. Maybe, you can give me a example to check whether libstdc++ is available on OS X. However, I guess it's Yes.

Till tonight, I have made a lot of *.cbps for Code::Blocks source codes and CB plugins on Mac OS X. The mac_pack under src directory of source codes was updated to mac_pack30 by me. I don't know how to commit them to the CB repository. In virtue of those files likewise on MS Windows, I have made a SVN version of CB binary bundle on Yosemite. Unfortunately, The CodeBlocks.app is full of bugs. For examples, a lots of *.xrc for plugins are lost. Changing font size of CB Editor makes CodeBlocks.app crash. Is it a proper way to discuss those problems in this thread on CB forum?

Easior Lars:

--- Quote from: oBFusCATed on August 26, 2015, 12:11:17 pm ---Do you know if the libstdc++ available on osx has the tr1 extensions?

--- End quote ---
I do some research. The quick answer is
http://stackoverflow.com/questions/13445742/apple-and-shared-ptr.
I also look at the directory of Xcode SDK for tr1/memory, 

--- Code: (bash) ---$ cd /Applications/Xcode.app/Contents/
$ find  . -iname 'memory' | grep  MacOSX
./Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/c++/4.2.1/ext/memory
./Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/c++/4.2.1/memory
./Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/c++/4.2.1/tr1/memory
./Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/ext/memory
./Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/memory
./Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/tr1/memory
--- End code ---
It assures my guess.

Easior Lars:

--- Quote from: oBFusCATed on August 26, 2015, 12:11:17 pm ---This is a very complex matter.
First we should know which c++ std lib is used to compile all dependencies of cb (wxwidgets in particular).
Then we'll have to compile everything with that library.

--- End quote ---
Now, everything seems clear to me. My wxWidgets is installed by homebrew with clang's default c++ std library, i.e.

--- Code: (bash) ---$ otool -L libwx_osx_cocoau_core-3.0.dylib | grep libc
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
--- End code ---
The g++ compiler afforded by Xcode is the same as clang++. Let's check the default c++ standard and _LIBCPP_VERSION:

--- Code: (bash) ---$ nano -w teststd.cpp
#include <iostream>
int main() {
  std::cout << __cplusplus << "\n";
  std::cout << _LIBCPP_VERSION << "\n";
}
$ g++ teststd.cpp
$ ./a.out
199711
1101
--- End code ---
it means that smart points in cb namespace should be offered by C++ header tr1/memory. The fact that tr1::shared_ptr is included in libstdc++ is why we can't build CB on Mac OS Yosemite. So using -std=c++11 is the solution.

Another solution is to build wxWidgets and Code::Blocks along with options -stdlib=libstdc++.

Navigation

[0] Message Index

[*] Previous page

Go to full version