[odb-users] C++11 with clang on OSX 10.8

Philipp Maluta fil.the.ensoreus at gmail.com
Thu Aug 29 06:03:46 EDT 2013


Ok, I built all the libs with the flags you mentioned. 
Still I have linker errors about absent symbols

Undefined symbols for architecture x86_64:
"odb::sqlite::delete_statement::delete_statement(odb::sqlite::connection&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, odb::sqlite::binding&)", referenced from:
odb::access::object_traits_impl<NoteEntity, (odb::database_id)1>::erase_query(odb::database&, odb::sqlite::query_base const&) in NoteEntity-odb.cxx.o
"odb::sqlite::select_statement::select_statement(odb::sqlite::connection&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, odb::sqlite::binding&, odb::sqlite::binding&)", referenced from:
odb::access::object_traits_impl<NoteEntity, (odb::database_id)1>::query(odb::database&, odb::sqlite::query_base const&) in NoteEntity-odb.cxx.o
"odb::sqlite::default_value_traits<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, (odb::sqlite::database_type_id)2>::set_image(odb::details::basic_buffer<char>&, unsigned long&, bool&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
odb::access::object_traits_impl<NoteEntity, (odb::database_id)1>::init(odb::access::object_traits_impl<NoteEntity, (odb::database_id)1>::image_type&, NoteEntity const&, odb::sqlite::statement_kind) in NoteEntity-odb.cxx.o
ld: symbol(s) not found for architecture x86_64

Maybe the cmake file helps to find any clue.

cmake_minimum_required(VERSION 2.8.8)
project(NotesCore)
set(PROJECT_NAME_STR NotesCore)
aux_source_directory(src SRC_LIST)

add_definitions(-Wall -ansi -Wno-deprecated -pthread  --std=c++11 --stdlib=libc++)

set(COMMON_INCLUDES ${PROJECT_SOURCE_DIR}/include)
set(EXT_PROJECTS_DIR ${PROJECT_SOURCE_DIR}/ext)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 --stdlib=libc++")
set(ODB_HEADERS ${COMMON_INCLUDES}/NoteEntity.hpp)

include_directories(${COMMON_INCLUDES})
include_directories(SYSTEM /opt/local/include)
add_library(${PROJECT_NAME} STATIC ${SRC_LIST})

#-------------------
# Test
#-------------------

enable_testing()
set(GTEST_USE_OWN_TR1_TUPLE 1)
set(PROJECT_TEST_NAME ${PROJECT_NAME_STR}_test)
include_directories(${GTEST_INCLUDE_DIRS} ${COMMON_INCLUDES})
add_definitions(-Wall -ansi -Wno-deprecated -pthread  --std=c++11 --stdlib=libc++ )
file(GLOB TEST_SRC_FILES ${PROJECT_SOURCE_DIR}/test/*.cpp)

find_library(ODB_LIB odb ${EXT_PROJECTS_DIR})
find_library(ODB_SQLITE_LIB odb-sqlite ${EXT_PROJECTS_DIR} )
find_library(GMOCK_LIB gmock ${EXT_PROJECTS_DIR})
find_library(GTEST_LIB gtest ${EXT_PROJECTS_DIR})

add_executable(${PROJECT_TEST_NAME} ${TEST_SRC_FILES} ${SRC_LIST})

target_link_libraries(${PROJECT_TEST_NAME} pthread)
target_link_libraries(${PROJECT_TEST_NAME} ${ODB_SQLITE_LIB})
target_link_libraries(${PROJECT_TEST_NAME} ${ODB_LIB})
target_link_libraries(${PROJECT_TEST_NAME} ${SQLITE_LIB})
target_link_libraries(${PROJECT_TEST_NAME} ${GMOCK_LIB})
target_link_libraries(${PROJECT_TEST_NAME} ${GTEST_LIB})

add_test( AuthLayerTest ${PROJECT_TEST_NAME} )


So, here is lib to build and a target to test it. To the test target I link guest and gmock. So, may that libs conflict? gmock and gtest also built with --std=c++11 and --stdlib=libc++

 
 
27 авг. 2013, в 21:02, Boris Kolpackov <boris at codesynthesis.com> написал(а):

> Hi Philipp,
> 
> Boris Kolpackov <boris at codesynthesis.com> writes:
> 
>> If you are seeing this when building libodb, then you may want to
>> change the configure command line like this in order to try to
>> address the first possibility:
>> 
>> ./configure CXX="clang++ --std=c++11 --stdlib=libc++" --prefix=/opt/local --disable-threads
> 
> And if that still doesn't help, then build libodb (and libodb-sqlite)
> as static libraries:
> 
> ./configure CXX=clang++ CXXFLAGS="--std=c++11 --stdlib=libc++" --disable-shared ...
> 
> Boris
> 
> 



More information about the odb-users mailing list