Skip to content

std::filesystem::__cxx11 errors in BasicApp on Raspbian Buster #2177

@Hodapp87

Description

@Hodapp87

I am seeing build errors related to std::filesystem::__cxx11 on Raspbian Buster (gcc 8.3.0) when following https://www.libcinder.org/docs/guides/linux-notes/rpi3.html and getting to the "Building and Running BasicApp" steps. I've changed es2-rpi to es3-rpi (as my pull request does). Errors are along these lines:

/usr/bin/ld: /home/pi/Cinder/lib/linux/armv7l/es3-rpi/Debug/libcinder.a(Platform.cpp.o): in function `cinder::app::Platform::findAndAddDefaultAssetPath()':                                                                                 
/home/pi/Cinder/src/cinder/app/Platform.cpp:146: undefined reference to `std::filesystem::__cxx11::path::has_parent_path() const'                                                                                                           
/usr/bin/ld: /home/pi/Cinder/src/cinder/app/Platform.cpp:146: undefined reference to `std::filesystem::__cxx11::path::parent_path() const'                                                                                                  
/usr/bin/ld: /home/pi/Cinder/lib/linux/armv7l/es3-rpi/Debug/libcinder.a(Platform.cpp.o): in function `std::filesystem::__cxx11::path::path(std::filesystem::__cxx11::path&&)':                                                              
/usr/include/c++/8/bits/fs_path.h:171: undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()'

See attached file for full output: basicapp_raspbian.txt

I appear to be able to work around this by adding -std=c++11 -lstdc++fs to the linker line, but only if it is after libcinder.a. Right now, I'm using the following patch:

diff --git a/proj/cmake/modules/cinderMakeApp.cmake b/proj/cmake/modules/cinderMakeApp.cmake
index 5409dcb51..27a3c4280 100644
--- a/proj/cmake/modules/cinderMakeApp.cmake
+++ b/proj/cmake/modules/cinderMakeApp.cmake
@@ -108,6 +108,7 @@ function( ci_make_app )
 
                        unset( ARG_RESOURCES ) # Don't allow resources to be added to the executable on linux
                endif()
+       set( CINDER_CXX_FLAGS "-std=c++11" )
        elseif( CINDER_MSW )
                if( MSVC )
                        # Override the default /MD with /MT
@@ -136,7 +137,7 @@ function( ci_make_app )
        add_executable( ${ARG_APP_NAME} MACOSX_BUNDLE WIN32 ${ARG_SOURCES} ${ICON_PATH} ${ARG_RESOURCES} )
 
        target_include_directories( ${ARG_APP_NAME} PUBLIC ${ARG_INCLUDES} )
-       target_link_libraries( ${ARG_APP_NAME} cinder ${ARG_LIBRARIES} )
+       target_link_libraries( ${ARG_APP_NAME} cinder "-lstdc++fs" ${ARG_LIBRARIES} )
 
        if( MSVC )
                # Ignore Specific Default Libraries for Debug build

but this is more a hack than a real fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions