Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Hodapp87 opened this issue Jun 12, 2020 · 2 comments
Open

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

Hodapp87 opened this issue Jun 12, 2020 · 2 comments

Comments

@Hodapp87
Copy link

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.

@MikeGitb
Copy link
Contributor

Unfortunately, filesystem support is experimental in gcc 8 and the symbols are not part of libstdc++ but libstdc++fs, which has to be explicitly linked. IIRC, starting with gcc9, filesystem is properly supported by gcc.
Not sure why it is necessary to compile with -std=c++11 however. With what standard was cinder itself compiled?

@Hodapp87
Copy link
Author

It's built as the same instructions say in the "Building Cinder" section (besides es2-rpi changed to es3-rpi there too). I see -std=c++17 in the compile line.

Now that you mention this, though, I tried removing -std=c++11 altogether and BasicApp is still building (so I must have mangled an earlier test while trying things). -lstdc++fs is still necessary and somewhere after libcinder.a.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants