Skip to content

Commit

Permalink
Merge pull request #1056 from contour-terminal/fix/relocation-error-o…
Browse files Browse the repository at this point in the history
…n-fc39

Attempt to fix relocation error that happens on Fedora 39.
  • Loading branch information
christianparpart authored Feb 28, 2023
2 parents bd825ff + 0388fff commit d286247
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 40 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/external_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ jobs:
with:
path: "**/cpm_modules"
key: ${{github.workflow}}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}
- name: "update APT database"
run: sudo apt -q update
# - name: "update APT database"
# run: sudo apt -q update
- name: Installing xmllint for ci-set-vars
run: sudo apt -qy install libxml2-utils
- name: set environment variables
Expand Down Expand Up @@ -136,7 +136,7 @@ jobs:
- name: "install dependencies"
run: |
set -ex
sudo apt -q update
# sudo apt -q update
sudo apt install -y \
build-essential \
cmake \
Expand Down Expand Up @@ -253,8 +253,8 @@ jobs:
CONTOUR_PREFIX: "" # valgrind --leak-check=full --num-callers=64 --error-exitcode=112"
steps:
- uses: actions/checkout@v3
- name: "update APT database"
run: sudo apt -q update
# - name: "update APT database"
# run: sudo apt -q update
- name: Installing xmllint for ci-set-vars
run: sudo apt -qy install libxml2-utils
- name: set environment variables
Expand Down
2 changes: 1 addition & 1 deletion src/contour/display/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if(NOT(CONTOUR_BUILD_WITH_QT6))
qt5_add_resources(QT_RESOURCES ${QT_RESOURCES})
endif()

add_library(ContourTerminalDisplay
add_library(ContourTerminalDisplay STATIC
Blur.cpp Blur.h
OpenGLRenderer.cpp OpenGLRenderer.h
ShaderConfig.cpp ShaderConfig.h
Expand Down
9 changes: 3 additions & 6 deletions src/crispy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ set(crispy_SOURCES
defines.h
escape.h
indexed.h
logstore.h
logstore.cpp logstore.h
overloaded.h
reference.h
ring.h
stdfs.h
times.h
)

add_library(crispy-core ${crispy_SOURCES})
add_library(crispy-core STATIC ${crispy_SOURCES})
add_library(crispy::core ALIAS crispy-core)

set_target_properties(crispy-core PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_EXE}")
Expand Down Expand Up @@ -97,10 +97,7 @@ if(UNIX)
# The following options are all important to get stacktrace dumping working
target_link_libraries(crispy-core PUBLIC dl)
if(NOT(FREEBSD))
target_link_options(crispy-core PUBLIC -rdynamic -fno-pie)
endif()
if(NOT(APPLE OR FREEBSD))
target_link_options(crispy-core PUBLIC -no-pie)
target_link_options(crispy-core PUBLIC -rdynamic)
endif()
target_compile_definitions(crispy-core PUBLIC BOOST_STACKTRACE_USE_ADDR2LINE=1)
if(CONTOUR_STACKTRACE_ADDR2LINE)
Expand Down
51 changes: 51 additions & 0 deletions src/crispy/logstore.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* This file is part of the "libterminal" project
* Copyright (c) 2019-2020 Christian Parpart <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <crispy/logstore.h>

namespace logstore
{

Sink::Sink(bool enabled, Writer writer): _enabled { enabled }, _writer { std::move(writer) }
{
}

Sink::Sink(bool enabled, std::ostream& output):
Sink(enabled, [out = &output](std::string_view text) {
*out << text;
out->flush();
})
{
}

Sink::Sink(bool enabled, std::shared_ptr<std::ostream> f):
Sink(enabled, [f = std::move(f)](std::string_view text) {
*f << text;
f->flush();
})
{
}

Sink& Sink::console()
{
static auto instance = Sink(false, std::cout);
return instance;
}

Sink& Sink::error_console() // NOLINT(readability-identifier-naming)
{
static auto instance = Sink(true, std::cerr);
return instance;
}

} // namespace logstore
33 changes: 5 additions & 28 deletions src/crispy/logstore.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,23 +193,9 @@ class Sink
public:
using Writer = std::function<void(std::string_view const&)>;

Sink(bool enabled, Writer writer): _enabled { enabled }, _writer { std::move(writer) } {}

Sink(bool enabled, std::ostream& output):
Sink(enabled, [out = &output](std::string_view text) {
*out << text;
out->flush();
})
{
}

Sink(bool enabled, std::shared_ptr<std::ostream> f):
Sink(enabled, [f = std::move(f)](std::string_view text) {
*f << text;
f->flush();
})
{
}
Sink(bool enabled, Writer writer);
Sink(bool enabled, std::ostream& output);
Sink(bool enabled, std::shared_ptr<std::ostream> f);

void set_writer(Writer writer);

Expand All @@ -219,17 +205,8 @@ class Sink
void set_enabled(bool enabled) { _enabled = enabled; }

/// Retrieves reference to standard debug-logging sink.
static inline Sink& console()
{
static auto instance = Sink(false, std::cout);
return instance;
}

static inline Sink& error_console() // NOLINT(readability-identifier-naming)
{
static auto instance = Sink(true, std::cerr);
return instance;
}
static Sink& console();
static Sink& error_console(); // NOLINT(readability-identifier-naming)

private:
bool _enabled;
Expand Down

0 comments on commit d286247

Please sign in to comment.