Giter Club home page Giter Club logo

Comments (10)

tbreslein avatar tbreslein commented on June 9, 2024 2

Yep, I will, once I figure out a minimal example for that supposed bug. The super minimal example in their tutorial works, but something breaks in my setup in the aforementioned side project (that doesn't involve FunctionalPlus).

Tbf, it could still be that some thing isn't set correctly in the doctest setup in this library, and that the source of that error is the same that I see in my other side project. In that case I guess this could still be considered a bug in FunctionalPlus, and I see if I can fix it same way I'm going to fix it in that other project,

from functionalplus.

tbreslein avatar tbreslein commented on June 9, 2024 1

I got the same error only when building the tests, using FunctionalPlus outside of that works fine.

I also got that error in a different side project where I wanted to try doctest, where FunctionalPlus wasn't a dependency. So this seems to be an issue isolated to doctest.

from functionalplus.

Dobiasd avatar Dobiasd commented on June 9, 2024 1

Thanks a lot for doing all this digging work. πŸ‘

I've just added a remark to the docs about not using doctest 2.4.6.

from functionalplus.

Dobiasd avatar Dobiasd commented on June 9, 2024

Thanks for reporting the error.

Can you provide the steps needed to reproduce it, ideally as a Dockerfile?

from functionalplus.

yurivict avatar yurivict commented on June 9, 2024

Docker doesn't support FreeBSD yet.

The problem occurs in the FreeBSD port devel/functionalplus. This is the script that is run:

/bin/mkdir -p /disk-samsung/freebsd-ports/devel/functionalplus/work/.build/test && cd /disk-samsung/freebsd-ports/devel/functionalplus/work/.build/test && \
        \
        /usr/bin/env XDG_DATA_HOME=/disk-samsung/freebsd-ports/devel/functionalplus/work XDG_CONFIG_HOME=/disk-samsung/freebsd-ports/devel/functionalplus/work XDG_CACHE_HOME=/disk-samsung/freebsd-ports/devel/functionalplus/work/.cache HOME=/disk-samsung/freebsd-ports/devel/functionalplus/work PATH=/disk-samsung/freebsd-ports/devel/functionalplus/work/.bin:/home/yuri/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin SHELL=/bin/sh CONFIG_SHELL=/bin/sh /usr/local/bin/cmake -DCMAKE_C_COMPILER:STRING=cc -DCMAKE_CXX_COMPILER:STRING=c++ -DCMAKE_C_FLAGS:STRING=-O2 -pipe -fno-omit-frame-pointer  -fstack-protector-strong -fno-strict-aliasing  -DCMAKE_C_FLAGS_DEBUG:STRING=-O2 -pipe -fno-omit-frame-pointer  -fstack-protector-strong -fno-strict-aliasing  -DCMAKE_C_FLAGS_RELEASE:STRING=-O2 -pipe -fno-omit-frame-pointer  -fstack-protector-strong -fno-strict-aliasing  -DCMAKE_CXX_FLAGS:STRING=-O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -fno-omit-frame-pointer   -DCMAKE_CXX_FLAGS_DEBUG:STRING=-O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -fno-omit-frame-pointer   -DCMAKE_CXX_FLAGS_RELEASE:STRING=-O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -fno-omit-frame-pointer   -DCMAKE_EXE_LINKER_FLAGS:STRING= -fstack-protector-strong  -DCMAKE_MODULE_LINKER_FLAGS:STRING= -fstack-protector-strong  -DCMAKE_SHARED_LINKER_FLAGS:STRING= -fstack-protector-strong  -DCMAKE_INSTALL_PREFIX:PATH=/usr/local -DCMAKE_BUILD_TYPE:STRING=Release -DTHREADS_HAVE_PTHREAD_ARG:BOOL=YES -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=YES -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -GNinja /disk-samsung/freebsd-ports/devel/functionalplus/work/FunctionalPlus-0.2.16-p0/test && \
        \
        /usr/bin/env NINJA_STATUS=[%p %s/%t]  XDG_DATA_HOME=/disk-samsung/freebsd-ports/devel/functionalplus/work XDG_CONFIG_HOME=/disk-samsung/freebsd-ports/devel/functionalplus/work XDG_CACHE_HOME=/disk-samsung/freebsd-ports/devel/functionalplus/work/.cache HOME=/disk-samsung/freebsd-ports/devel/functionalplus/work PATH=/disk-samsung/freebsd-ports/devel/functionalplus/work/.bin:/home/yuri/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin NO_PIE=yes MK_DEBUG_FILES=no MK_KERNEL_SYMBOLS=no SHELL=/bin/sh NO_LINT=YES DESTDIR=/disk-samsung/freebsd-ports/devel/functionalplus/work/stage PREFIX=/usr/local LOCALBASE=/usr/local CC=cc CFLAGS=-O2 -pipe -fno-omit-frame-pointer  -fstack-protector-strong -fno-strict-aliasing  CPP=cpp CPPFLAGS=-fno-omit-frame-pointer LDFLAGS= -fstack-protector-strong  LIBS= CXX=c++ CXXFLAGS=-O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -fno-omit-frame-pointer   MANPREFIX=/usr/local BSD_INSTALL_PROGRAM=install  -s -m 555 BSD_INSTALL_LIB=install  -s -m 0644 BSD_INSTALL_SCRIPT=install  -m 555 BSD_INSTALL_DATA=install  -m 0644 BSD_INSTALL_MAN=install  -m 444 ninja -v all && \
        \
        /usr/bin/env NINJA_STATUS=[%p %s/%t]  XDG_DATA_HOME=/disk-samsung/freebsd-ports/devel/functionalplus/work XDG_CONFIG_HOME=/disk-samsung/freebsd-ports/devel/functionalplus/work XDG_CACHE_HOME=/disk-samsung/freebsd-ports/devel/functionalplus/work/.cache HOME=/disk-samsung/freebsd-ports/devel/functionalplus/work PATH=/disk-samsung/freebsd-ports/devel/functionalplus/work/.bin:/home/yuri/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin NO_PIE=yes MK_DEBUG_FILES=no MK_KERNEL_SYMBOLS=no SHELL=/bin/sh NO_LINT=YES DESTDIR=/disk-samsung/freebsd-ports/devel/functionalplus/work/stage PREFIX=/usr/local LOCALBASE=/usr/local CC=cc CFLAGS=-O2 -pipe -fno-omit-frame-pointer  -fstack-protector-strong -fno-strict-aliasing  CPP=cpp CPPFLAGS=-fno-omit-frame-pointer LDFLAGS= -fstack-protector-strong  LIBS= CXX=c++ CXXFLAGS=-O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -fno-omit-frame-pointer   MANPREFIX=/usr/local BSD_INSTALL_PROGRAM=install  -s -m 555 BSD_INSTALL_LIB=install  -s -m 0644 BSD_INSTALL_SCRIPT=install  -m 555 BSD_INSTALL_DATA=install  -m 0644 BSD_INSTALL_MAN=install  -m 444 ninja -v test

from functionalplus.

Dobiasd avatar Dobiasd commented on June 9, 2024

Ah, ok. πŸ‘

As a workaround for installing FunctionalPlus, of course you can simply copy the FunctionalPlus header files to your target directory without invoking CMake at all.

Apart from that, I currently can only guess: Maybe the CMake version can be updated, and that would help. 😬

from functionalplus.

yurivict avatar yurivict commented on June 9, 2024

cmake-3.21.4 is used, which is almost the latest.

/usr/local/lib/cmake/doctest/doctestAddTests.cmake has these relevant lines:

...
set(add_labels ${TEST_ADD_LABELS})
...
if(${add_labels} EQUAL 1)
...

The last line fails.

Is TEST_ADD_LABELS supposed to be defined by the project?

from functionalplus.

Dobiasd avatar Dobiasd commented on June 9, 2024

Does building (i.e. installing) FunctionalPlus work when you don't build/run the tests, i.e., without needing doctest?

If the problem is only with doctest, maybe you can reproduce the problem with doctest alone and ask in its repo.


Edit: To answer your question ("Is TEST_ADD_LABELS supposed to be defined by the project?": I don't know. 😬

from functionalplus.

Dobiasd avatar Dobiasd commented on June 9, 2024

In case anybody of you guys opens an issue in the doctest repo, it would be cool if you could post the link here, so future readers of this can easily find it. πŸ™‚

from functionalplus.

tbreslein avatar tbreslein commented on June 9, 2024

Quick update: Reproduced the bug, found the issue with my setup, and found the related Github issue.

The problem is the doctest_discover_tests CMake function that is exported by doctest's CMake module.

Just for completeness sake, this is the CMake file:

cmake_minimum_required(VERSION 3.20)
project(doctestest LANGUAGES CXX VERSION 0.0.1)

#######################################
# Conan Block BEGIN
#######################################

# setup conan.cmake if it does not exist
list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR})
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR})

if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
  message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
  file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/v0.16.1/conan.cmake"
                "${CMAKE_BINARY_DIR}/conan.cmake"
                EXPECTED_HASH SHA256=396e16d0f5eabdc6a14afddbcfff62a54a7ee75c6da23f32f7a31bc85db23484
                TLS_VERIFY ON)
endif()

include(${CMAKE_BINARY_DIR}/conan.cmake)

conan_cmake_configure(
    REQUIRES
        doctest/2.4.6
    GENERATORS
        cmake_paths
        cmake_find_package
    )

conan_cmake_autodetect(settings)

# download deps in conanfile.txt
conan_cmake_install(PATH_OR_REFERENCE .
    BUILD missing
    REMOTE conancenter
    SETTINGS ${settings}
    )

# add paths of conan managed packages
include(${CMAKE_BINARY_DIR}/conan_paths.cmake)

#######################################
# Conan Block END
#######################################

find_package(doctest REQUIRED)
include(doctest)

add_executable(tests main.cpp)
target_compile_features(tests PRIVATE cxx_std_17)
target_link_libraries(tests PRIVATE doctest::doctest)
doctest_discover_tests(tests)

And this is the source file:

#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include <doctest/doctest.h>

int factorial(int number) {
  return number <= 1 ? number : factorial(number - 1) * number;
}

TEST_CASE("testing the factorial function") {
  CHECK(factorial(1) == 1);
  CHECK(factorial(2) == 2);
  CHECK(factorial(3) == 6);
  CHECK(factorial(10) == 3628800);
}

As I said, the culprit is the line doctest_discover_tests, if I leave that out, the file compiles and runs fine. But it seems this is a known issue in doctest version 2.4.6, here's the issue in their repo: doctest/doctest#524

This is fixed in their dev branch, and the bug's been introduced in 2.4.6, so it runs fine in 2.4.5 (I just tested that too). The only consequence for FunctionalPlus then is that, at least in some circumstances, it cannot be doctest'ed with doctest version 2.4.6 specifically. Dunno if that should be noted anywhere.

So indeed this wasn't a FunctionalPlus issue, or at least not directly.

from functionalplus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.