From 57d423745fd1d3d0ea6a0c69b869a20c27e27fc5 Mon Sep 17 00:00:00 2001 From: Nicky Dasmijn Date: Fri, 5 Apr 2024 19:25:02 +0200 Subject: Linux viewer (ReleaseOS) resurrection (#1099) Co-authored-by: AiraYumi --- indra/cmake/00-Common.cmake | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) (limited to 'indra/cmake/00-Common.cmake') diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 24534c98d9..486071a2df 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -87,7 +87,7 @@ if (WINDOWS) if( ADDRESS_SIZE EQUAL 32 ) add_compile_options( /arch:SSE2 ) endif() - + # Are we using the crummy Visual Studio KDU build workaround? if (NOT VS_DISABLE_FATAL_WARNINGS) add_compile_options(/WX) @@ -107,7 +107,15 @@ endif (WINDOWS) if (LINUX) - set(CMAKE_SKIP_RPATH TRUE) + set( CMAKE_BUILD_WITH_INSTALL_RPATH TRUE ) + set( CMAKE_INSTALL_RPATH $ORIGIN $ORIGIN/../lib ) + set(CMAKE_EXE_LINKER_FLAGS "-Wl,--exclude-libs,ALL") + + find_program(CCACHE_EXE ccache) + if(CCACHE_EXE AND NOT DISABLE_CCACHE) + set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_EXE} ) + set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_EXE} ) + endif() # EXTERNAL_TOS # force this platform to accept TOS via external browser @@ -134,21 +142,28 @@ if (LINUX) -pthread -Wno-parentheses -Wno-deprecated + -Wno-c++20-compat + -Wno-pessimizing-move + -Wno-stringop-overflow + -Wno-stringop-truncation -fvisibility=hidden ) - - if (ADDRESS_SIZE EQUAL 32) - add_compile_options(-march=pentium4) - endif (ADDRESS_SIZE EQUAL 32) + add_link_options( + -Wl,--no-keep-memory + -Wl,--build-id + ) # this stops us requiring a really recent glibc at runtime add_compile_options(-fno-stack-protector) # linking can be very memory-hungry, especially the final viewer link set(CMAKE_CXX_LINK_FLAGS "-Wl,--no-keep-memory") - set(CMAKE_CXX_FLAGS_DEBUG "-fno-inline ${CMAKE_CXX_FLAGS_DEBUG}") -endif (LINUX) + # ND: clang is a bit more picky than GCC, the latter seems to auto include -lstdc++ and -lm. The former not so and thus fails to link + if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -lstdc++ -lm") + endif() +endif (LINUX) if (DARWIN) # Warnings should be fatal -- thanks, Nicky Perian, for spotting reversed default @@ -182,9 +197,10 @@ if (LINUX OR DARWIN) list(APPEND GCC_WARNINGS -Wno-reorder -Wno-non-virtual-dtor ) + if(LINUX) + list(APPEND GCC_WARNINGS -Wno-maybe-uninitialized -Wno-misleading-indentation -Wno-stringop-truncation -Wno-unused-value ) + endif() + add_compile_options(${GCC_WARNINGS}) add_compile_options(-m${ADDRESS_SIZE}) endif (LINUX OR DARWIN) - - - -- cgit v1.2.3 From bbd6dfc21a1a6c07824fc81e0659a2c200581d3b Mon Sep 17 00:00:00 2001 From: AiraYumi Date: Tue, 9 Apr 2024 05:38:01 +0900 Subject: Some fixes to linux builds (#1144) * compile flag cleanup for linux * rollback indra/llcommon/llprofiler.h * use 3p fltk package * fix build gcc 13 (dangling-pointer) --- indra/cmake/00-Common.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/cmake/00-Common.cmake') diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 486071a2df..419ebebe3b 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -198,7 +198,7 @@ if (LINUX OR DARWIN) list(APPEND GCC_WARNINGS -Wno-reorder -Wno-non-virtual-dtor ) if(LINUX) - list(APPEND GCC_WARNINGS -Wno-maybe-uninitialized -Wno-misleading-indentation -Wno-stringop-truncation -Wno-unused-value ) + list(APPEND GCC_WARNINGS -Wno-maybe-uninitialized -Wno-dangling-pointer ) endif() add_compile_options(${GCC_WARNINGS}) -- cgit v1.2.3 From 37392be4171303db08a4842b7882b4cb758a8f8d Mon Sep 17 00:00:00 2001 From: Nicky Dasmijn Date: Tue, 9 Apr 2024 20:26:06 +0200 Subject: Update Linux media handling (#1146) * Enable CEF browser for Linux * Disable the update for Linux, we don't have that one right now * Update build_linux.yaml We need libpulse-dev for volume_catcher Linux * Add linux_volum_catcher* files * Enable OpenAL for Linux-ReleaseOS * Linux: Update OpenAL * Update SDL2 * Add libsndio-dev to the dependencies. * Update CEF to an official LL version * Remove dupe of emoji_shortcodes * Reording autobuild does because it can and wants to * Linux: Disable NDOF for the time being. After updating the ndof 3P needs to be rebuilt and we do not have a fresh one from LL yet. Forcefully undefine LIB_NDOF, it gets defined in the build variables no matter if it is safe to define. * Remove wrestling with mutliarch and LIBGL_DRIVERS_PATH * Remove tcmalloc snippet, tcmalloc is a very faint bad dream of the past * Putting out a warning this viewer ran on a x64 arch and then suggesting to install 32 bit compat packages makes no sense at all * CEF resources need to be in lib * It;'s okay to warn about missing plugins * Linux: CEF keyboard handling * Remove old gstreamer 0.10 implementation * Linux DSO loading always had been very peculiar due to macro magic. At least now it is peculiar shared magic with only one implementation. * Remove -fPIC. We get that one from LL_BUILD * /proc/cpuinfo is not reliable to detrmine the max CPU clock. Try to determine this by reading "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq". Only if this fails go back to /proc/cpuinfo * Cleanup * Cleanup common linker and compiler flags, make it more obvious which flags are for which OS/compiler * Switch to correct plugin file * Install libpulse-dev for volume catcher. * And the runner needs libsndio-dev as well. * check for runner.os=='linux'. matrix.os is the full name of the image (limux-large). --- indra/cmake/00-Common.cmake | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) (limited to 'indra/cmake/00-Common.cmake') diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 419ebebe3b..d46ebc4960 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -105,7 +105,6 @@ if (WINDOWS) endif() endif (WINDOWS) - if (LINUX) set( CMAKE_BUILD_WITH_INSTALL_RPATH TRUE ) set( CMAKE_INSTALL_RPATH $ORIGIN $ORIGIN/../lib ) @@ -117,18 +116,14 @@ if (LINUX) set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_EXE} ) endif() - # EXTERNAL_TOS - # force this platform to accept TOS via external browser - - # LL_IGNORE_SIGCHLD - # don't catch SIGCHLD in our base application class for the viewer - some of - # our 3rd party libs may need their *own* SIGCHLD handler to work. Sigh! The - # viewer doesn't need to catch SIGCHLD anyway. + # LL_IGNORE_SIGCHLD + # don't catch SIGCHLD in our base application class for the viewer - some of + # our 3rd party libs may need their *own* SIGCHLD handler to work. Sigh! The + # viewer doesn't need to catch SIGCHLD anyway. add_compile_definitions( _REENTRANT _FORTIFY_SOURCE=2 - EXTERNAL_TOS APPID=secondlife LL_IGNORE_SIGCHLD ) @@ -146,22 +141,27 @@ if (LINUX) -Wno-pessimizing-move -Wno-stringop-overflow -Wno-stringop-truncation + -Wno-dangling-pointer -fvisibility=hidden ) add_link_options( - -Wl,--no-keep-memory - -Wl,--build-id + -Wl,--no-keep-memory + -Wl,--build-id + -Wl,--no-undefined ) + if (NOT GCC_DISABLE_FATAL_WARNINGS) + list(APPEND GCC_WARNINGS -Werror) + endif (NOT GCC_DISABLE_FATAL_WARNINGS) # this stops us requiring a really recent glibc at runtime add_compile_options(-fno-stack-protector) - # linking can be very memory-hungry, especially the final viewer link - set(CMAKE_CXX_LINK_FLAGS "-Wl,--no-keep-memory") - set(CMAKE_CXX_FLAGS_DEBUG "-fno-inline ${CMAKE_CXX_FLAGS_DEBUG}") # ND: clang is a bit more picky than GCC, the latter seems to auto include -lstdc++ and -lm. The former not so and thus fails to link if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -lstdc++ -lm") + add_link_options( + -lstdc++ + -lm + ) endif() endif (LINUX) @@ -186,15 +186,9 @@ if (DARWIN) # required for clang-15/xcode-15 since our boost package still uses deprecated std::unary_function/binary_function # see https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#C++-Standard-Library add_compile_definitions(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION) -endif (DARWIN) -if (LINUX OR DARWIN) set(GCC_WARNINGS -Wall -Wno-sign-compare -Wno-trigraphs) - if (NOT GCC_DISABLE_FATAL_WARNINGS) - list(APPEND GCC_WARNINGS -Werror) - endif (NOT GCC_DISABLE_FATAL_WARNINGS) - list(APPEND GCC_WARNINGS -Wno-reorder -Wno-non-virtual-dtor ) if(LINUX) @@ -203,4 +197,4 @@ if (LINUX OR DARWIN) add_compile_options(${GCC_WARNINGS}) add_compile_options(-m${ADDRESS_SIZE}) -endif (LINUX OR DARWIN) +endif () -- cgit v1.2.3 From 148f80f0779f42c1aa7d2f07c04a63507446662c Mon Sep 17 00:00:00 2001 From: Bennett Goble Date: Wed, 10 Apr 2024 19:54:10 -0700 Subject: Linux: build with clang, link with mold --- indra/cmake/00-Common.cmake | 54 ++++++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 20 deletions(-) (limited to 'indra/cmake/00-Common.cmake') diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index d46ebc4960..21242a32be 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -15,6 +15,7 @@ include_guard() include(Variables) +include(Linker) # We go to some trouble to set LL_BUILD to the set of relevant compiler flags. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} $ENV{LL_BUILD}") @@ -127,23 +128,37 @@ if (LINUX) APPID=secondlife LL_IGNORE_SIGCHLD ) + add_compile_options( - -fexceptions - -fno-math-errno - -fno-strict-aliasing - -fsigned-char - -msse2 - -mfpmath=sse - -pthread - -Wno-parentheses - -Wno-deprecated - -Wno-c++20-compat - -Wno-pessimizing-move - -Wno-stringop-overflow - -Wno-stringop-truncation - -Wno-dangling-pointer - -fvisibility=hidden + -fexceptions + -fno-math-errno + -fno-strict-aliasing + -fsigned-char + -msse2 + -mfpmath=sse + -pthread + -fvisibility=hidden + ) + + set(GCC_CLANG_COMPATIBLE_WARNINGS + -Wno-parentheses + -Wno-deprecated + -Wno-c++20-compat + -Wno-pessimizing-move + ) + + set(CLANG_WARNINGS + ${GCC_CLANG_COMPATIBLE_WARNINGS} + # Put clang specific warning configuration here ) + + set(GCC_WARNINGS + ${GCC_CLANG_COMPATIBLE_WARNINGS} + -Wno-stringop-overflow + -Wno-stringop-truncation + -Wno-dangling-pointer + ) + add_link_options( -Wl,--no-keep-memory -Wl,--build-id @@ -156,12 +171,15 @@ if (LINUX) # this stops us requiring a really recent glibc at runtime add_compile_options(-fno-stack-protector) - # ND: clang is a bit more picky than GCC, the latter seems to auto include -lstdc++ and -lm. The former not so and thus fails to link if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + # ND: clang is a bit more picky than GCC, the latter seems to auto include -lstdc++ and -lm. The former not so and thus fails to link add_link_options( -lstdc++ -lm ) + add_compile_options(${CLANG_WARNINGS}) + else() + add_compile_options(${GCC_WARNINGS}) endif() endif (LINUX) @@ -191,10 +209,6 @@ if (DARWIN) list(APPEND GCC_WARNINGS -Wno-reorder -Wno-non-virtual-dtor ) - if(LINUX) - list(APPEND GCC_WARNINGS -Wno-maybe-uninitialized -Wno-dangling-pointer ) - endif() - add_compile_options(${GCC_WARNINGS}) add_compile_options(-m${ADDRESS_SIZE}) endif () -- cgit v1.2.3 From 33c7b9701de1589e8e3875656a6bab4f8710e7a8 Mon Sep 17 00:00:00 2001 From: Nicky Dasmijn Date: Fri, 12 Apr 2024 14:15:01 +0200 Subject: Chore/cmake pretty up (#1205) * - Add an option to with ASAN - Fix GCC -Werror option. * - find_program should not set REQUIRED if per logic a fallback to ld.bfd is fine - cmake idiomatic is to test Variables without dereferencing them * Add -Wno-unknown-warning-option for clang or it will complain about some GCC only options ``` /home/runner/work/viewer/viewer/indra/llcommon/llsdutil.cpp:39:32: error: unknown warning group '-Wstringop-truncation', ignored [-Werror,-Wunknown-warning-option] #pragma GCC diagnostic ignored "-Wstringop-truncation" // It's actually okay what happens here ``` --- indra/cmake/00-Common.cmake | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'indra/cmake/00-Common.cmake') diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 21242a32be..d90a34bb6b 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -124,11 +124,20 @@ if (LINUX) add_compile_definitions( _REENTRANT - _FORTIFY_SOURCE=2 APPID=secondlife LL_IGNORE_SIGCHLD ) + if( ENABLE_ASAN ) + add_compile_options(-U_FORTIFY_SOURCE + -fsanitize=address + --param asan-stack=0 + ) + add_link_options(-fsanitize=address) + else() + add_compile_definitions( _FORTIFY_SOURCE=2 ) + endif() + add_compile_options( -fexceptions -fno-math-errno @@ -150,6 +159,7 @@ if (LINUX) set(CLANG_WARNINGS ${GCC_CLANG_COMPATIBLE_WARNINGS} # Put clang specific warning configuration here + -Wno-unknown-warning-option ) set(GCC_WARNINGS @@ -165,7 +175,7 @@ if (LINUX) -Wl,--no-undefined ) if (NOT GCC_DISABLE_FATAL_WARNINGS) - list(APPEND GCC_WARNINGS -Werror) + add_compile_options( -Werror ) endif (NOT GCC_DISABLE_FATAL_WARNINGS) # this stops us requiring a really recent glibc at runtime -- cgit v1.2.3 From 8f0c41c2e5d5c66df5e975b743140112494c4a7a Mon Sep 17 00:00:00 2001 From: Nicky Dasmijn Date: Mon, 15 Apr 2024 22:59:16 +0200 Subject: Chore/pragma gcc cleansweep (#1226) * Remove all GCC warning suppression pragmas. * For Linux just just raise(SIGSEGV) as the crash driver. This has a much higher chance of the compiler understanding out intent and figuring out we end the program here. * Remove -Wno-stringop-overflow and -Wno-stringop-truncation from GCC_WARNINGS. After calling raise(SIGSEGV) as the crash driver I saw no issue with those warnings anymore After removing thoses GCC pragmas there is also no need for clang -Wno-unknown-warning-option anymore. * Remove CMakePresets from this PR. * Remove Lindens from comments :) --- indra/cmake/00-Common.cmake | 3 --- 1 file changed, 3 deletions(-) (limited to 'indra/cmake/00-Common.cmake') diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index d90a34bb6b..2b6129590c 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -159,13 +159,10 @@ if (LINUX) set(CLANG_WARNINGS ${GCC_CLANG_COMPATIBLE_WARNINGS} # Put clang specific warning configuration here - -Wno-unknown-warning-option ) set(GCC_WARNINGS ${GCC_CLANG_COMPATIBLE_WARNINGS} - -Wno-stringop-overflow - -Wno-stringop-truncation -Wno-dangling-pointer ) -- cgit v1.2.3 From 9c4b6a04166c0053b147f9064056a50644be4d6b Mon Sep 17 00:00:00 2001 From: Nicky Date: Sat, 3 Aug 2024 14:20:17 +0200 Subject: Remove -wno-dangling-pointer, compiling with GCC 13.3, 12, 11 and clang did not yield such a warning. Furthermore this warning should not just be disabled but rather dealt with when it comes up --- indra/cmake/00-Common.cmake | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/cmake/00-Common.cmake') diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 25841d9d78..4ae9377500 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -175,7 +175,6 @@ if (LINUX) set(GCC_WARNINGS ${GCC_CLANG_COMPATIBLE_WARNINGS} - -Wno-dangling-pointer ) add_link_options( -- cgit v1.2.3 From 74205607b7e106f3b7566ef4a4b9c2fcdfa2f83e Mon Sep 17 00:00:00 2001 From: Ansariel Hiller Date: Fri, 13 Sep 2024 16:28:48 +0200 Subject: Clean up Windows build (#2562) * APR_DECLARE_STATIC and APU_DECLARE_STATIC gets already defined in APR.cmake * Move both _CRT_SECURE_NO_WARNINGS and _WINSOCK_DEPRECATED_NO_WARNINGS definitions to 00-Common.cmake * Always define WIN32_LEAN_AND_MEAN and include subset of Windows API by default * Remove llwin32headerslean.h and remove unnecessary WIN32_LEAN_AND_MEAN definition handling in llwin32headers.h * Clean up includes of Windows API headers * Get rid of workaround to link against IPHLPAPI.lib in lluuid.cpp - this seems to have been an issue in the past that has been fixed --- indra/cmake/00-Common.cmake | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'indra/cmake/00-Common.cmake') diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 5087c308ee..39f26ced5d 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -68,9 +68,12 @@ if (WINDOWS) /NODEFAULTLIB:LIBCMT /IGNORE:4099) - add_definitions( - -DNOMINMAX -# /DDOM_DYNAMIC # For shared library colladadom + add_compile_definitions( + WIN32_LEAN_AND_MEAN + NOMINMAX +# DOM_DYNAMIC # For shared library colladadom + _CRT_SECURE_NO_WARNINGS # Allow use of sprintf etc + _WINSOCK_DEPRECATED_NO_WARNINGS # Disable deprecated WinSock API warnings ) add_compile_options( /Zo @@ -106,9 +109,6 @@ if (WINDOWS) string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}") string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") endif() - - # Allow use of sprintf etc - add_compile_definitions(_CRT_SECURE_NO_WARNINGS) endif (WINDOWS) -- cgit v1.2.3