Re: [Lldb-commits] [PATCH] remove CREATE_THREADS:=yes from api/multithreaded Makefile
LGTM http://reviews.llvm.org/D5838 ___ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] remove CREATE_THREADS:=yes from api/multithreaded Makefile
Closed by commit rL222031 (authored by @sbest). REPOSITORY rL LLVM http://reviews.llvm.org/D5838 Files: lldb/trunk/test/api/multithreaded/Makefile lldb/trunk/test/make/Makefile.rules Index: lldb/trunk/test/api/multithreaded/Makefile === --- lldb/trunk/test/api/multithreaded/Makefile +++ lldb/trunk/test/api/multithreaded/Makefile @@ -1,6 +1,6 @@ LEVEL = ../../make -ENABLE_THREADS := YES +ENABLE_STD_THREADS := YES CXX_SOURCES := main.cpp include $(LEVEL)/Makefile.rules Index: lldb/trunk/test/make/Makefile.rules === --- lldb/trunk/test/make/Makefile.rules +++ lldb/trunk/test/make/Makefile.rules @@ -120,9 +120,23 @@ LDFLAGS ?= $(CFLAGS) LDFLAGS += $(LD_EXTRAS) ifneq $(OS) Windows_NT - ifeq $(ENABLE_THREADS) YES - LDFLAGS += -lpthread - endif +ifeq $(ENABLE_THREADS) YES +LDFLAGS += -lpthread +else +ifeq $(ENABLE_STD_THREADS) YES +# with the specific combination of Linux, g++, std=c++11, adding the +# linker flag -lpthread, will cause a program to hang when a std::conditional_variable +# is used in a program that links lldb (see bugzilla 21553) +ifeq $(OS) Linux +ifeq (,$(findstring gcc,$(CC))) +# Linux, but not gcc +LDFLAGS += -lpthread +endif +else +LDFLAGS += -lpthread +endif +endif +endif endif OBJECTS = EXE ?= a.out ___ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] remove CREATE_THREADS:=yes from api/multithreaded Makefile
I have added another flag to test/Makefile.rules ENABLE_STD_THREADS and used it the api/Multithreaded unit tests. This can be used to selectively omit '-lpthreads' option for certain systems. All platforms except linux/gcc should behave as before. I have also made a Bugzilla report for simple program that hangs on linux ( http://llvm.org/bugs/show_bug.cgi?id=21553 ) I see there has been some recent activity in this area with r215562 omitting -lpthreads on windows, and r218899 recently adding -lpthreads as it was needed for FreeBSD. http://reviews.llvm.org/D5838 Files: test/api/multithreaded/Makefile test/make/Makefile.rules Index: test/api/multithreaded/Makefile === --- test/api/multithreaded/Makefile +++ test/api/multithreaded/Makefile @@ -1,6 +1,6 @@ LEVEL = ../../make -ENABLE_THREADS := YES +ENABLE_STD_THREADS := YES CXX_SOURCES := main.cpp include $(LEVEL)/Makefile.rules Index: test/make/Makefile.rules === --- test/make/Makefile.rules +++ test/make/Makefile.rules @@ -120,9 +120,23 @@ LDFLAGS ?= $(CFLAGS) LDFLAGS += $(LD_EXTRAS) ifneq $(OS) Windows_NT - ifeq $(ENABLE_THREADS) YES - LDFLAGS += -lpthread - endif +ifeq $(ENABLE_THREADS) YES +LDFLAGS += -lpthread +else +ifeq $(ENABLE_STD_THREADS) YES +# with the specific combination of Linux, g++, std=c++11, adding the +# linker flag -lpthread, will cause a program to hang when a std::conditional_variable +# is used in a program that links lldb (see bugzilla 21553) +ifeq $(OS) Linux +ifeq (,$(findstring gcc,$(CC))) +# Linux, but not gcc +LDFLAGS += -lpthread +endif +else +LDFLAGS += -lpthread +endif +endif +endif endif OBJECTS = EXE ?= a.out ___ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] remove CREATE_THREADS:=yes from api/multithreaded Makefile
On FreeBSD the test fails to link without `-lpthread`: ``` os command: gmake clean LD_EXTRAS='-L/tank/emaste/src/llvm/build-nodebug/bin/../lib/python2.7/site-packages/../.. -llldb' EXE='test_listener_event_description' CFLAGS_EXTRAS='-std=c++11 -stdlib=libc++ -I/tank/emaste/src/llvm/tools/lldb/test/../include' CXX_SOURCES='driver.cpp listener_test.cpp test_listener_event_description.cpp'; gmake ARCH=amd64 CC=/usr/bin/clang LD_EXTRAS='-L/tank/emaste/src/llvm/build-nodebug/bin/../lib/python2.7/site-packages/../.. -llldb' EXE='test_listener_event_description' CFLAGS_EXTRAS='-std=c++11 -stdlib=libc++ -I/tank/emaste/src/llvm/tools/lldb/test/../include' CXX_SOURCES='driver.cpp listener_test.cpp test_listener_event_description.cpp' with pid: 92054 stdout: rm -f test_listener_event_description driver.o listener_test.o test_listener_event_description.o driver.d listener_test.d test_listener_event_description.d rm -f -r rm -rf *.o *.d *.dSYM /usr/bin/clang++ -std=c++11 -g -O0 -m64 -std=c++11 -stdlib=libc++ -I/tank/emaste/src/llvm/tools/lldb/test/../include -I/tank/emaste/src/llvm/tools/lldb/test/make/../../include -c -o driver.o driver.cpp /usr/bin/clang++ -std=c++11 -g -O0 -m64 -std=c++11 -stdlib=libc++ -I/tank/emaste/src/llvm/tools/lldb/test/../include -I/tank/emaste/src/llvm/tools/lldb/test/make/../../include -c -o listener_test.o listener_test.cpp /usr/bin/clang++ -std=c++11 -g -O0 -m64 -std=c++11 -stdlib=libc++ -I/tank/emaste/src/llvm/tools/lldb/test/../include -I/tank/emaste/src/llvm/tools/lldb/test/make/../../include -c -o test_listener_event_description.o test_listener_event_description.cpp /usr/bin/clang++ driver.o listener_test.o test_listener_event_description.o -g -O0 -m64 -std=c++11 -stdlib=libc++ -I/tank/emaste/src/llvm/tools/lldb/test/../include -I/tank/emaste/src/llvm/tools/lldb/test/make/../../include -L/tank/emaste/src/llvm/build-nodebug/bin/../lib/python2.7/site-packages/../.. -llldb -o test_listener_event_description stderr: /usr/bin/ld: G: invalid DSO for symbol `pthread_create@@FBSD_1.0' definition //lib/libthr.so.3: could not read symbols: Bad value clang++: error: linker command failed with exit code 1 (use -v to see invocation) ``` What do you think about an ENABLE_STD_THREADS := YES for these tests, and then a system-dependent library addition? My quick Google search suggests linking requirements for std::thread are quite system-dependent; AFAICT some Linuxes also need -lpthread -- perhaps a combination of the specific libc, libpthread, and libc++. http://reviews.llvm.org/D5838 ___ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] remove CREATE_THREADS:=yes from api/multithreaded Makefile
What do you think about an ENABLE_STD_THREADS := YES for these That seems like a reasonable way to go. And we just work out in the Makefile.rules what that needs to translate into. On Fri, Oct 17, 2014 at 5:53 AM, Ed Maste ema...@freebsd.org wrote: On FreeBSD the test fails to link without `-lpthread`: ``` os command: gmake clean LD_EXTRAS='-L/tank/emaste/src/llvm/build-nodebug/bin/../lib/python2.7/site-packages/../.. -llldb' EXE='test_listener_event_description' CFLAGS_EXTRAS='-std=c++11 -stdlib=libc++ -I/tank/emaste/src/llvm/tools/lldb/test/../include' CXX_SOURCES='driver.cpp listener_test.cpp test_listener_event_description.cpp'; gmake ARCH=amd64 CC=/usr/bin/clang LD_EXTRAS='-L/tank/emaste/src/llvm/build-nodebug/bin/../lib/python2.7/site-packages/../.. -llldb' EXE='test_listener_event_description' CFLAGS_EXTRAS='-std=c++11 -stdlib=libc++ -I/tank/emaste/src/llvm/tools/lldb/test/../include' CXX_SOURCES='driver.cpp listener_test.cpp test_listener_event_description.cpp' with pid: 92054 stdout: rm -f test_listener_event_description driver.o listener_test.o test_listener_event_description.o driver.d listener_test.d test_listener_event_description.d rm -f -r rm -rf *.o *.d *.dSYM /usr/bin/clang++ -std=c++11 -g -O0 -m64 -std=c++11 -stdlib=libc++ -I/tank/emaste/src/llvm/tools/lldb/test/../include -I/tank/emaste/src/llvm/tools/lldb/test/make/../../include -c -o driver.o driver.cpp /usr/bin/clang++ -std=c++11 -g -O0 -m64 -std=c++11 -stdlib=libc++ -I/tank/emaste/src/llvm/tools/lldb/test/../include -I/tank/emaste/src/llvm/tools/lldb/test/make/../../include -c -o listener_test.o listener_test.cpp /usr/bin/clang++ -std=c++11 -g -O0 -m64 -std=c++11 -stdlib=libc++ -I/tank/emaste/src/llvm/tools/lldb/test/../include -I/tank/emaste/src/llvm/tools/lldb/test/make/../../include -c -o test_listener_event_description.o test_listener_event_description.cpp /usr/bin/clang++ driver.o listener_test.o test_listener_event_description.o -g -O0 -m64 -std=c++11 -stdlib=libc++ -I/tank/emaste/src/llvm/tools/lldb/test/../include -I/tank/emaste/src/llvm/tools/lldb/test/make/../../include -L/tank/emaste/src/llvm/build-nodebug/bin/../lib/python2.7/site-packages/../.. -llldb -o test_listener_event_description stderr: /usr/bin/ld: G: invalid DSO for symbol `pthread_create@@FBSD_1.0' definition //lib/libthr.so.3: could not read symbols: Bad value clang++: error: linker command failed with exit code 1 (use -v to see invocation) ``` What do you think about an ENABLE_STD_THREADS := YES for these tests, and then a system-dependent library addition? My quick Google search suggests linking requirements for std::thread are quite system-dependent; AFAICT some Linuxes also need -lpthread -- perhaps a combination of the specific libc, libpthread, and libc++. http://reviews.llvm.org/D5838 ___ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits -- Todd Fiala | Software Engineer | tfi...@google.com ___ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] remove CREATE_THREADS:=yes from api/multithreaded Makefile
This flag triggers a '-lpthead' during the linking stage. Technically this is not needed since the multithreading is handled by std library, triggered by '-std=c++11' in build command line. The **real** reason I want to remove the '-lpthread' is it was causing a (linux/gcc built) test program to hang in a destructor for the std::condition_variable http://reviews.llvm.org/D5838 Files: test/api/multithreaded/Makefile Index: test/api/multithreaded/Makefile === --- test/api/multithreaded/Makefile +++ test/api/multithreaded/Makefile @@ -1,6 +1,5 @@ LEVEL = ../../make -ENABLE_THREADS := YES CXX_SOURCES := main.cpp include $(LEVEL)/Makefile.rules ___ lldb-commits mailing list lldb-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits