C++11 support is broken in lang/gcc* from ports. The problem is that gcc doesn't define _GLIBCXX_USE_C99 macro, which unhides C++11 features. Maybe that's related to the problem I've reported before, in which gcc disables whole C99 support after not detecting certain math functions in our math library - I don't remember details and status of that problem. If this is too hard to properly fix in the compilers, we may instead just hardcode -D_GLIBCXX_USE_C99 into macros which gcc defines or into CXXFLAGS in compiler.mk. This will enable most of c++11 on pre-clang FreeBSD versions. Port maintainer (gerald@FreeBSD.org) is cc'd. Generated with FreeBSD Port Tools 1.02 (mode: change, diff: SVN) How-To-Repeat: % cat test.cc #include <string> int main() { std::to_string(1); return 0; } % clang++ -std=c++11 test.cc % g++47 -std=c++11 test.cc test.cc: In function 'int main()' test.cc:4:2: error: 'to_string' is not a member of 'std' % g++47 -std=c++11 -D_GLIBCXX_USE_C99 test.cc %
(In reply to amdmi3 from comment #0) > Maybe that's related to the problem I've reported before, in which gcc > disables whole C99 support after not detecting certain math functions in our > math library - I don't remember details and status of that problem. ------------------------------------------------------------------------ r269758 | kargl | 2014-08-09 08:53:40 -0700 (Sat, 09 Aug 2014) | 9 lines When r255294 was committed, it exposed the symbols lgammal, powl, and tgammal in libm. These functions are part of ISO/IEC 9899:1999 and their prototypes should have been moved into the appropriate __ISO_C_VISIBLE >= 1999 section. After moving the prototypes, remnants of r236148 can be removed. PR: standards/191754 Reviewed by: bde ------------------------------------------------------------------------ And before you ask. I have no intentions of merging this into a stable branch.
This is probably no longer related, at least of current. The mentioned test program doesn't build on current from Aug 24 with gcc48 built just now, while logs confirm that math issue in gcc was fixed: 10.0: --- configure:18932: checking for ISO C99 support to TR1 in <math.h> configure:19056: /wrkdirs/usr/ports/lang/gcc48/work/build/./gcc/xgcc -shared-libgcc -B/wrkdirs/usr/ports/lang/gcc48/work/build/./gcc -nostdinc++ -L/wrkdirs/usr/ports/lang/gcc48/work/build/x86_64-portbld-freebsd10.0/libstdc++-v3/src -L/wrkdirs/usr/ports/lang/gcc48/work/build/x86_64-portbld-freebsd10.0/libstdc++-v3/src/.libs -B/usr/local/x86_64-portbld-freebsd10.0/bin/ -B/usr/local/x86_64-portbld-freebsd10.0/lib/ -isystem /usr/local/x86_64-portbld-freebsd10.0/include -isystem /usr/local/x86_64-portbld-freebsd10.0/sys-include -c -g -O2 -pipe -fno-strict-aliasing -std=c++98 conftest.cpp >&5 conftest.cpp: In function 'int main()': conftest.cpp:93:14: error: 'erfl' was not declared in this scope erfl(0.0l); ^ conftest.cpp:96:15: error: 'erfcl' was not declared in this scope erfcl(0.0l); ^ conftest.cpp:123:17: error: 'lgammal' was not declared in this scope lgammal(0.0l); ^ conftest.cpp:177:17: error: 'tgammal' was not declared in this scope tgammal(0.0l); ^ configure:19056: $? = 1 --- head: --- configure:18932: checking for ISO C99 support to TR1 in <math.h> configure:19056: /wrkdirs/usr/ports/lang/gcc48/work/build/./gcc/xgcc -shared-libgcc -B/wrkdirs/usr/ports/lang/gcc48/work/build/./gcc -nostdinc++ -L/wrkdirs/usr/ports/lang/gcc48/work/build/x86_64-portbld-freebsd11.0/libstdc++-v3/src -L/wrkdirs/usr/ports/lang/gcc48/work/build/x86_64-portbld-freebsd11.0/libstdc++-v3/src/.libs -B/usr/local/x86_64-portbld-freebsd11.0/bin/ -B/usr/local/x86_64-portbld-freebsd11.0/lib/ -isystem /usr/local/x86_64-portbld-freebsd11.0/include -isystem /usr/local/x86_64-portbld-freebsd11.0/sys-include -c -g -O2 -pipe -fno-strict-aliasing -std=c++98 conftest.cpp >&5 configure:19056: $? = 0 configure:19065: result: yes ---
*** Bug 194929 has been marked as a duplicate of this bug. ***
+1 I hit the same problem while trying to update port finance/bitcoin-armory to 0.93 No std::to_string() function.
+1 again I tried to make the port for FreeFileSync (from sourceforge), and again clang compile breaks on it, and gcc doesn't support std::snprintf (added by c11)
Any progress on this one?
Andreas, do you have an idea on how to best tackle this?
I've also run into this. Broken.
I'm looking into this. It is not a late evening project. Given the results of my studies it needs some work. On both sides, the gcc part needs to be improved regarding detection of functionality and on the FreeBSD part we're still lacking some complex functions in libm.
IIUC, this bug report only applies to FreeBSD 8 and FreeBSD 9 these days.
(In reply to John Marino from comment #10) > IIUC, this bug report only applies to FreeBSD 8 and FreeBSD 9 these days. Incorrect, it applies to all versions including -CURRENT. You may try devel/sdl2pp with USE_GCC=yes and without -D_GLIBCXX_USE_C99.
DragonFly has an identical libm and the libstdc++ os_defines now match. C99/c++11 works on DragonFly. what is preventing it from working on FreeBSD 10 and 11?
Ah, wait, no it's not the same! We pulled in several long double functions from NetBSD. That's probably the difference.
(In reply to John Marino from comment #13) > Ah, wait, no it's not the same! > > We pulled in several long double functions from NetBSD. That's probably the > difference. Likely.
Work is in progress. Results can be seen here: https://gcc.gnu.org/ml/gcc-testresults/2015-09/msg02290.html The delay is natural, we're contributors, not full time assignee's
Some progress here, we added enhanced locale support for FreeBSD. Also, we added a more fine grained distinction about C99 capabilities. Not only C99 or not. This has been done on gcc-trunk, iow the next gcc release which will be 6.0. A backport is right now out of discussion. Later, in a few weeks, we might reconsider. The progress covers much more than addressed in this ticket... Curious parties might update in week or so the ports lang/gcc6-devel and test their needs.
A commit references this bug: Author: sunpoet Date: Sat Jan 7 15:26:08 UTC 2017 New revision: 430799 URL: https://svnweb.freebsd.org/changeset/ports/430799 Log: Fix build with GCC prior to 6.0 PR: 193528 Notified by: jbeich Changes: head/databases/rocksdb/Makefile
lang/gcc6 (and later) indeed do not exhibit this issue any longer; thanks Andreas!
This has been fixed for GCC 6 and later, which we really should have updated to by now (and which is only stalled for a number of not too actively maintained ports, cf. PR 219275). GCC 5 is going EOL in the next weeks probably, and backporting those changes is not realistic. Let's put any efforts into the upgrade via PR 219275. Help appreciated!
MARKED AS SPAM
A commit references this bug: Author: jbeich Date: Sat Sep 14 22:01:23 UTC 2019 New revision: 512079 URL: https://svnweb.freebsd.org/changeset/ports/512079 Log: Drop C++11 workaround for GCC < 6 after r449590 lang/gcc5 will expire in ~1 month. If someone still uses lang/gcc48 they should backport C++11 fix instead. QA on GCC architecuters is currently limited to powerpc64 which uses GCC_DEFAULT. PR: 193528 Changes: head/biology/jellyfish/Makefile head/biology/jellyfish/files/patch-include_jellyfish_file__header.hpp head/devel/jsoncpp/Makefile head/devel/llvm60/Makefile head/devel/llvm70/Makefile head/devel/llvm80/Makefile head/devel/llvm90/Makefile head/devel/qtcreator/Makefile head/devel/sdl2pp/Makefile head/dns/powerdns-recursor/Makefile head/finance/moneymanagerex/Makefile head/finance/moneymanagerex/files/patch-src_import__export_univcsvdialog.cpp head/finance/moneymanagerex/files/patch-src_webapp.cpp head/games/pioneer/Makefile head/games/rlvm/Makefile head/games/stonesoup/Makefile head/graphics/aseprite/Makefile head/graphics/colmap/Makefile head/graphics/hiptext/Makefile head/graphics/libboard/Makefile head/graphics/mapnik/Makefile head/graphics/podofo/Makefile head/graphics/sekrit-twc-zimg/Makefile head/graphics/vapoursynth-waifu2x-w2xc/Makefile head/graphics/waifu2x-converter-cpp/Makefile head/math/GiNaC/Makefile head/math/gringo/Makefile head/math/pdal/Makefile head/math/yacas/Makefile head/multimedia/aegisub/Makefile head/multimedia/ffms2/Makefile head/multimedia/mpc-qt/Makefile head/multimedia/obs-studio/Makefile head/multimedia/vapoursynth/Makefile head/net/nethogs/Makefile head/net/ulxmlrpcpp/Makefile head/net/ulxmlrpcpp/files/patch-ulxmlrpcpp-ulxmlrpcpp.h head/net/yami4/Makefile head/net-p2p/eiskaltdcpp-daemon/Makefile head/ports-mgmt/portrac/Makefile head/www/node/Makefile head/www/node10/Makefile head/www/node6/Makefile head/www/node8/Makefile head/x11/slim/Makefile head/x11/slim/files/patch-Ck.cpp head/x11-fm/wcmcommander/Makefile