From 67e38d124709494183d7a7e84fb5171897949ab0 Mon Sep 17 00:00:00 2001 From: Xeonacid Date: Sat, 9 Oct 2021 16:08:01 +0800 Subject: [PATCH] Replace -lpthread with -pthread According to Stack Overflow and GCC doc, -pthread is the correct way to use pthread. This fix build error on riscv64. --- data/linux/build-deps.sh | 2 +- source/Makefile.mk | 36 +++++++++++++++++------------------ source/backend/utils/Makefile | 2 +- source/bridges-ui/Makefile | 2 +- source/jackbridge/Makefile | 2 +- source/libjack/Makefile | 2 +- source/rest/Makefile | 2 +- source/tests.old/Makefile | 26 ++++++++++++------------- 8 files changed, 37 insertions(+), 37 deletions(-) diff --git a/data/linux/build-deps.sh b/data/linux/build-deps.sh index 9e41b1923..d5e772140 100755 --- a/data/linux/build-deps.sh +++ b/data/linux/build-deps.sh @@ -310,7 +310,7 @@ if [ ! -f fluidsynth-${FLUIDSYNTH_VERSION}/build-done ]; then -Denable-floats=ON make ${MAKE_ARGS} make install - sed -i -e "s|-lfluidsynth|-lfluidsynth -lglib-2.0 -lgthread-2.0 -lsndfile -lFLAC -lvorbisenc -lvorbis -logg -lpthread -lm|" ${PREFIX}/lib/pkgconfig/fluidsynth.pc + sed -i -e "s|-lfluidsynth|-lfluidsynth -lglib-2.0 -lgthread-2.0 -lsndfile -lFLAC -lvorbisenc -lvorbis -logg -pthread -lm|" ${PREFIX}/lib/pkgconfig/fluidsynth.pc touch build-done cd .. fi diff --git a/source/Makefile.mk b/source/Makefile.mk index 903e17579..6b3e2257a 100644 --- a/source/Makefile.mk +++ b/source/Makefile.mk @@ -609,7 +609,7 @@ endif ifeq ($(LINUX),true) ifeq ($(HAVE_ALSA),true) RTAUDIO_FLAGS += $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags alsa) -D__LINUX_ALSA__ -RTAUDIO_LIBS += $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs alsa) -lpthread +RTAUDIO_LIBS += $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs alsa) -pthread RTMIDI_FLAGS += $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags alsa) -D__LINUX_ALSA__ RTMIDI_LIBS += $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs alsa) endif @@ -639,35 +639,35 @@ endif endif # USING_JUCE_AUDIO_DEVICES ifeq ($(BSD),true) -JACKBRIDGE_LIBS = -lpthread -lrt +JACKBRIDGE_LIBS = -pthread -lrt LILV_LIBS = -lm -lrt -RTMEMPOOL_LIBS = -lpthread -WATER_LIBS = -lpthread -lrt +RTMEMPOOL_LIBS = -pthread +WATER_LIBS = -pthread -lrt endif ifeq ($(HAIKU),true) -JACKBRIDGE_LIBS = -lpthread +JACKBRIDGE_LIBS = -pthread LILV_LIBS = -lm -RTMEMPOOL_LIBS = -lpthread -WATER_LIBS = -lpthread +RTMEMPOOL_LIBS = -pthread +WATER_LIBS = -pthread endif ifeq ($(HURD),true) -JACKBRIDGE_LIBS = -ldl -lpthread -lrt +JACKBRIDGE_LIBS = -ldl -pthread -lrt LILV_LIBS = -ldl -lm -lrt -RTMEMPOOL_LIBS = -lpthread -lrt -WATER_LIBS = -ldl -lpthread -lrt +RTMEMPOOL_LIBS = -pthread -lrt +WATER_LIBS = -ldl -pthread -lrt endif ifeq ($(LINUX),true) HYLIA_FLAGS = -DLINK_PLATFORM_LINUX=1 -JACKBRIDGE_LIBS = -ldl -lpthread -lrt +JACKBRIDGE_LIBS = -ldl -pthread -lrt LILV_LIBS = -ldl -lm -lrt -RTMEMPOOL_LIBS = -lpthread -lrt -WATER_LIBS = -ldl -lpthread -lrt +RTMEMPOOL_LIBS = -pthread -lrt +WATER_LIBS = -ldl -pthread -lrt ifeq ($(USING_JUCE),true) JUCE_AUDIO_DEVICES_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs alsa) -JUCE_CORE_LIBS = -ldl -lpthread -lrt +JUCE_CORE_LIBS = -ldl -pthread -lrt JUCE_EVENTS_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs x11) JUCE_GRAPHICS_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs freetype2) JUCE_GUI_BASICS_LIBS = $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs x11 xext) @@ -676,9 +676,9 @@ endif # LINUX ifeq ($(MACOS),true) HYLIA_FLAGS = -DLINK_PLATFORM_MACOSX=1 -JACKBRIDGE_LIBS = -ldl -lpthread +JACKBRIDGE_LIBS = -ldl -pthread LILV_LIBS = -ldl -lm -RTMEMPOOL_LIBS = -lpthread +RTMEMPOOL_LIBS = -pthread WATER_LIBS = -framework AppKit ifeq ($(USING_JUCE),true) JUCE_AUDIO_BASICS_LIBS = -framework Accelerate @@ -696,9 +696,9 @@ endif # MACOS ifeq ($(WIN32),true) HYLIA_FLAGS = -DLINK_PLATFORM_WINDOWS=1 HYLIA_LIBS = -liphlpapi -JACKBRIDGE_LIBS = -lpthread +JACKBRIDGE_LIBS = -pthread LILV_LIBS = -lm -RTMEMPOOL_LIBS = -lpthread +RTMEMPOOL_LIBS = -pthread WATER_LIBS = -luuid -lwsock32 -lwininet -lversion -lole32 -lws2_32 -loleaut32 -limm32 -lcomdlg32 -lshlwapi -lrpcrt4 -lwinmm ifeq ($(USING_JUCE),true) JUCE_AUDIO_DEVICES_LIBS = -lwinmm -lole32 diff --git a/source/backend/utils/Makefile b/source/backend/utils/Makefile index 8a1cbfea2..e44cfd778 100644 --- a/source/backend/utils/Makefile +++ b/source/backend/utils/Makefile @@ -49,7 +49,7 @@ LINK_FLAGS += $(X11_LIBS) endif ifneq ($(HAIKU),true) -LINK_FLAGS += -lpthread +LINK_FLAGS += -pthread endif ifeq ($(USING_JUCE),true) diff --git a/source/bridges-ui/Makefile b/source/bridges-ui/Makefile index cad39cf0f..b7d66edc0 100644 --- a/source/bridges-ui/Makefile +++ b/source/bridges-ui/Makefile @@ -23,7 +23,7 @@ endif # --------------------------------------------------------------------------------------------------------------------- BUILD_CXX_FLAGS += -DBUILD_BRIDGE -DBUILD_BRIDGE_UI -I. -I$(CWD)/backend -I$(CWD)/includes -I$(CWD)/utils -I$(CWD)/modules -LINK_FLAGS += $(WATER_LIBS) -lpthread +LINK_FLAGS += $(WATER_LIBS) -pthread # --------------------------------------------------------------------------------------------------------------------- diff --git a/source/jackbridge/Makefile b/source/jackbridge/Makefile index 0e26b376b..9a54d4f9e 100644 --- a/source/jackbridge/Makefile +++ b/source/jackbridge/Makefile @@ -15,7 +15,7 @@ LINK_FLAGS += $(JACKBRIDGE_LIBS) WINE_32BIT_FLAGS = $(32BIT_FLAGS) -fpermissive WINE_64BIT_FLAGS = $(64BIT_FLAGS) -fpermissive -WINE_LINK_FLAGS = $(LINK_FLAGS) $(LIBDL_LIBS) -lpthread -lstdc++ +WINE_LINK_FLAGS = $(LINK_FLAGS) $(LIBDL_LIBS) -pthread -lstdc++ ifeq ($(JACKBRIDGE_DIRECT),true) BUILD_CXX_FLAGS += $(JACK_FLAGS) -DJACKBRIDGE_DIRECT diff --git a/source/libjack/Makefile b/source/libjack/Makefile index 98216d212..af66d91c2 100644 --- a/source/libjack/Makefile +++ b/source/libjack/Makefile @@ -23,7 +23,7 @@ endif BUILD_C_FLAGS += -I$(CWD) -I$(CWD)/includes BUILD_CXX_FLAGS += -I$(CWD) -I$(CWD)/backend -I$(CWD)/includes -I$(CWD)/utils -LINK_FLAGS += -lpthread -lrt +LINK_FLAGS += -pthread -lrt # --------------------------------------------------------------------------------------------------------------------- diff --git a/source/rest/Makefile b/source/rest/Makefile index 8e88c40a0..b4f6da64e 100644 --- a/source/rest/Makefile +++ b/source/rest/Makefile @@ -26,7 +26,7 @@ BUILD_CXX_FLAGS += -I$(CWD) -I$(CWD)/backend -I$(CWD)/includes -I$(CWD)/modules LINK_FLAGS += -Wl,-rpath=$(shell realpath $(CWD)/../bin) LINK_FLAGS += -L$(BINDIR) -lcarla_standalone2 -lcarla_utils LINK_FLAGS += -lrestbed -lssl -lcrypto -LINK_FLAGS += -lpthread +LINK_FLAGS += -pthread # ---------------------------------------------------------------------------------------------------------------------- diff --git a/source/tests.old/Makefile b/source/tests.old/Makefile index e45d5d3e0..193a36407 100644 --- a/source/tests.old/Makefile +++ b/source/tests.old/Makefile @@ -128,7 +128,7 @@ ctypes-test.so: ctypes-test.c .FORCED # --------------------------------------------------------------------------------------------------------------------- CachedPlugins: CachedPlugins.cpp - $(CXX) $< $(PEDANTIC_CXX_FLAGS) -o $@ $(MODULEDIR)/juce_core.a $(MODULEDIR)/lilv.a -ldl -lpthread + $(CXX) $< $(PEDANTIC_CXX_FLAGS) -o $@ $(MODULEDIR)/juce_core.a $(MODULEDIR)/lilv.a -ldl -pthread ifneq ($(WIN32),true) set -e; ./$@ && valgrind --leak-check=full ./$@ endif @@ -146,14 +146,14 @@ ifneq ($(WIN32),true) endif CarlaPipeUtils: CarlaPipeUtils.cpp - $(CXX) $< $(PEDANTIC_CXX_FLAGS) -o $@ $(MODULEDIR)/juce_core.a -ldl -lpthread + $(CXX) $< $(PEDANTIC_CXX_FLAGS) -o $@ $(MODULEDIR)/juce_core.a -ldl -pthread ifneq ($(WIN32),true) set -e; valgrind --leak-check=full ./$@ # ./$@ && endif CarlaPipeUtils.exe: CarlaPipeUtils.cpp ../utils/CarlaPipeUtils.cpp - $(CXX) $< $(PEDANTIC_CXX_FLAGS) -o $@ $(MODULEDIR)/water.a -lole32 -lshlwapi -lversion -lwsock32 -lwininet -lwinmm -lws2_32 -lpthread -static + $(CXX) $< $(PEDANTIC_CXX_FLAGS) -o $@ $(MODULEDIR)/water.a -lole32 -lshlwapi -lversion -lwsock32 -lwininet -lwinmm -lws2_32 -pthread -static CarlaUtils1: CarlaUtils1.cpp ../utils/*.hpp $(CXX) $< $(PEDANTIC_CXX_FLAGS) -o $@ @@ -163,7 +163,7 @@ endif CarlaUtils2: CarlaUtils2.cpp ../utils/*.hpp $(CXX) $< $(PEDANTIC_CXX_FLAGS) -o $@ \ - $(MODULEDIR)/juce_core.a $(MODULEDIR)/lilv.a -ldl -lpthread -lrt + $(MODULEDIR)/juce_core.a $(MODULEDIR)/lilv.a -ldl -pthread -lrt set -e; ./$@ && valgrind --leak-check=full ./$@ CarlaUtils3: CarlaUtils3.cpp ../utils/*.hpp @@ -174,7 +174,7 @@ endif CarlaUtils4: CarlaUtils4.cpp ../utils/CarlaStateUtils.cpp ../utils/*.hpp $(CXX) $< $(PEDANTIC_CXX_FLAGS) -o $@ \ - $(MODULEDIR)/juce_core.a -ldl -lpthread -lrt + $(MODULEDIR)/juce_core.a -ldl -pthread -lrt ifneq ($(WIN32),true) set -e; ./$@ && valgrind --leak-check=full ./$@ endif @@ -198,7 +198,7 @@ ifneq ($(WIN32),true) endif WineJack: WineJack.cpp - $(WINECXX) $< $(BASE_FLAGS) -m32 -ljack -lpthread -o $@ + $(WINECXX) $< $(BASE_FLAGS) -m32 -ljack -pthread -o $@ set -e; ./$@.exe # --------------------------------------------------------------------------------------------------------------------- @@ -214,11 +214,11 @@ sem: sem.cpp $(MODULEDIR)/jackbridge/* # --------------------------------------------------------------------------------------------------------------------- ChildProcess: ChildProcess.cpp - $(CXX) $< $(PEDANTIC_CXX_FLAGS) $(MODULEDIR)/juce_core.a -ldl -lpthread -lrt -o $@ + $(CXX) $< $(PEDANTIC_CXX_FLAGS) $(MODULEDIR)/juce_core.a -ldl -pthread -lrt -o $@ valgrind --leak-check=full ./$@ CarlaMutex: CarlaMutex.cpp ../utils/CarlaMutex.hpp - $(CXX) $< -lpthread -o $@ + $(CXX) $< -pthread -o $@ valgrind --leak-check=full ./$@ # ifneq ($(MACOS_OR_WIN32),true) @@ -241,15 +241,15 @@ EngineEvents: EngineEvents.cpp env LD_LIBRARY_PATH=../backend valgrind ./$@ PipeServer: PipeServer.cpp ../utils/CarlaPipeUtils.hpp - $(CXX) $< $(PEDANTIC_CXX_FLAGS) -lpthread -o $@ + $(CXX) $< $(PEDANTIC_CXX_FLAGS) -pthread -o $@ valgrind --leak-check=full ./$@ RtLinkedList: RtLinkedList.cpp ../utils/LinkedList.hpp ../utils/RtLinkedList.hpp $(MODULEDIR)/rtmempool.a - $(CXX) $< $(MODULEDIR)/rtmempool.a $(PEDANTIC_CXX_FLAGS) -lpthread -o $@ + $(CXX) $< $(MODULEDIR)/rtmempool.a $(PEDANTIC_CXX_FLAGS) -pthread -o $@ valgrind --leak-check=full ./$@ RtLinkedListGnu: RtLinkedList.cpp ../utils/LinkedList.hpp ../utils/RtLinkedList.hpp $(MODULEDIR)/rtmempool.a - $(CXX) $< $(MODULEDIR)/rtmempool.a $(GNU_CXX_FLAGS) -lpthread -o $@ + $(CXX) $< $(MODULEDIR)/rtmempool.a $(GNU_CXX_FLAGS) -pthread -o $@ valgrind --leak-check=full ./$@ # --------------------------------------------------------------------------------------------------------------------- @@ -263,11 +263,11 @@ debug: # --------------------------------------------------------------------------------------------------------------------- DISTRHO: DISTRHO.cpp ../modules/distrho/*.hpp ../modules/distrho/src/*.cpp - $(CXX) $< ../modules/dgl.a $(PEDANTIC_CXX_FLAGS) -I../modules/distrho -I../modules/native-plugins/nekobi $(LINK_FLAGS) $(DGL_LIBS) -lpthread -o $@ + $(CXX) $< ../modules/dgl.a $(PEDANTIC_CXX_FLAGS) -I../modules/distrho -I../modules/native-plugins/nekobi $(LINK_FLAGS) $(DGL_LIBS) -pthread -o $@ ./DISTRHO DISTRHO.so: DISTRHO.cpp ../modules/distrho/*.hpp ../modules/distrho/src/*.cpp - $(CXX) $< ../modules/dgl.a $(PEDANTIC_CXX_FLAGS) -I../modules/distrho -I../modules/native-plugins/nekobi -DSHARED_DLL $(LINK_FLAGS) $(DGL_LIBS) -lpthread -shared -Wl,--no-undefined -o $@ + $(CXX) $< ../modules/dgl.a $(PEDANTIC_CXX_FLAGS) -I../modules/distrho -I../modules/native-plugins/nekobi -DSHARED_DLL $(LINK_FLAGS) $(DGL_LIBS) -pthread -shared -Wl,--no-undefined -o $@ DGL: DGL.cpp ../modules/distrho/dgl/src/Window.cpp $(CXX) $< $(PEDANTIC_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) -o $@