jamoma / JamomaCore

Jamoma Frameworks for Audio and Control Structure
Other
36 stars 14 forks source link

__do_string_hash undefined with Clang on Linux #380

Closed avilleret closed 8 years ago

avilleret commented 8 years ago

While trying to workaround #371 I tried to build Jamoma with clang 3.6 and 3.5 under Linux (resp. Ubuntu 15.04 and Raspbian Jessie) Both ends with this error :

In file included from /home/antoine/lib-src/Jamoma/Implementations/PureData/JamomaCore/Foundation/library/includes/TTFoundation.h:15:
/home/antoine/lib-src/Jamoma/Implementations/PureData/JamomaCore/Foundation/library/includes/TTString.h:447:12: error: 
      use of undeclared identifier '__do_string_hash'
                                return __do_string_hash(__val.data(), __val.data() + __val.size());
tap commented 8 years ago

I believe that we determined earlier in the year that it would be safe to change TTString to be an alias to std::string. I did work on this in the "tap/cleanup" branch, but I did a poor job of keeping issues separate on that branch -- so there are many tasks tangled together and it might be easiest just to take such a conversion as a new task.

The primary question is what to do with additions to TTString which are not a part of std::string. My impression is that these would be better suited as free-standing functions rather than subclassing std::string, but I'm not entirely sure.

Doing a TTString conversion to std::string might also be considered a tedious distraction that we don't want to do...

avilleret commented 8 years ago

the key is to use -stdlib=libc++ flag when configuring :

cmake .. -G Ninja -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_FLAGS="-stdlib=libc++"
jcelerier commented 8 years ago

I think that this should go in : https://github.com/jamoma/JamomaCore/blob/master/Shared/CMake/JamomaPlatformSpecific.cmake

One can easily test for clang with

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")

endif()

in the part around line 40.

Note : this has the important consequence that a plugin built with g++ will not be loadable with a Jamoma that was built with libc++. (Well, it technically would be but it will cause a lot of crashes - it's akin to using two different versions of the msvcrt*\ in a software windows, which generally does not end well).

On Mon, Oct 19, 2015 at 7:05 PM, Antoine Villeret notifications@github.com wrote:

the key is to use -stdlib=libc++ flag when configuring :

cmake .. -G Ninja -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_FLAGS="-stdlib=libc++"

— Reply to this email directly or view it on GitHub https://github.com/jamoma/JamomaCore/issues/380#issuecomment-149283199.