cnl icon indicating copy to clipboard operation
cnl copied to clipboard

cnl_example fails

Open johnmcfarlane opened this issue 3 years ago • 12 comments

Partly due to loss of Bintray, but also because it's not tested, cnl_example doesn't build.

  • Design a new workflow for cnl_example in which both cnl and cnl_example are built locally, but where cnl is installed into the local Conan cache.

johnmcfarlane avatar May 09 '21 15:05 johnmcfarlane

The loss of bintray appears to prevent the unit tests as well. Is there a new location for https://api.bintray.com/conan/johnmcfarlane/cnl ?

josmithiii avatar Jun 29 '22 12:06 josmithiii

Hi @josmithiii. Which tests do you mean? Unfortunately yes, there isn't currently a package available in a public package repo. This issue tracks plans to remedy that in Conan Center. #773 tracks equivalent work for vcpkg.

johnmcfarlane avatar Jun 30 '22 00:06 johnmcfarlane

Thanks for your reply! I'm trying to run the cnl tests:

conan profile update env.CONAN_CMAKE_TOOLCHAIN_FILE=../test/toolchain/clang.cmake default
setenv CONAN_REVISIONS_ENABLED 1
conan install --build=missing --options test=unit ..
Configuration:
[settings]
arch=armv8
arch_build=armv8
build_type=Release
compiler=apple-clang
compiler.libcxx=libstdc++
compiler.version=13
os=Macos
os_build=Macos
[options]
test=unit
[build_requires]
[env]
CONAN_CMAKE_TOOLCHAIN_FILE=../test/toolchain/clang.cmake
ERROR: 400: Couldn't perform replication, check server logs for more information.. [Remote: johnmcfarlane/cnl]
exit 0

josmithiii avatar Jun 30 '22 05:06 josmithiii

Please give me a few days to look into this. I'm currently en route to CppOnSea and don't have a lot of bandwidth right now.

johnmcfarlane avatar Jul 01 '22 18:07 johnmcfarlane

Sorry for the long delay. As well as the conference running a week longer than expected(!), I'm facing some disruption at home due to house renovations.

I'm not sure your issue is the same as #887. I'm not able to complete the repro steps above and when I work around them, I am not able to reproduce the issue. However, I'm very keen to help resolve the issue and adapt the project as necessary to avoid future problems.

Therefore, could you file a separate bug using the bug template.

Could you make sure that repro steps are from a system without a ~/.conan directory for maximum reproducibility.

I recommend you avoid the env.CONAN_CMAKE_TOOLCHAIN_FILE= parameter as this is a relative path (which later confuses the build system) and would likely set that path for all other projects using Conan's default profile. (Suggestion: specify that variable during the conan install step.)

Can you try and remove as many steps as possible that aren't necessary to reproduce the error?

For reference, here's the repro steps I followed to try and match your own:

# using llvm-14 as the default C and C++ compiler...
rm -rf ~/.conan/ ../build/*
CXX=/usr/bin/clang++ conan profile new --detect default
conan install --settings compiler.libcxx=libstdc++11 --build=missing --options test=unit ..
conan build ..

johnmcfarlane avatar Jul 24 '22 10:07 johnmcfarlane

Thanks very much! I'm getting much farther now. I've attached my slightly modified version of your "repro steps", as well as its output.

The current problem seems to be this:

In file included from /Users/jos/w/cnl/test/unit/scaled_int/numbers.cpp:7: /Users/jos/w/cnl/include/cnl/_impl/scaled_integer/../../_impl/scaled_integer/numbers.h:127:17: error: constexpr variable 'pi_v<cnl::_impl::wrapper<unsigned long long, cnl::power<-62, 2>>>' must be initialized by a constant expression pi_v<cnl::scaled_integer<Rep, cnl::power<Exponent>>>{ ^ ~

josmithiii avatar Jul 24 '22 19:07 josmithiii

What version of Clang are you using?

johnmcfarlane avatar Jul 25 '22 19:07 johnmcfarlane

I see this on my Mac:

$ which clang /usr/bin/clang $ clang -v Apple clang version 13.1.6 (clang-1316.0.21.2.5) Target: arm64-apple-darwin21.5.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

josmithiii avatar Jul 25 '22 19:07 josmithiii

You don't appear to be using the clang profile and some tests are so complex that compiler limits on constant expressions are hit. I've tried hiding that particular test in the case there is no CNL testing profile in use but recommend using test/toolchain/clang.cmake or test/toolchain/clang-libc++.cmake for clang builds in order to enable all tests.

Please can you try branch, osx-clang-fix and see if that gets you past the error?

johnmcfarlane avatar Jul 30 '22 11:07 johnmcfarlane

Near perfection!: 100% tests passed, 0 tests failed out of 114 However, I had to comment out a static_assert that failed:

index 2527f010..2d6a6747 100644
--- a/test/unit/scaled_int/elastic/elastic_scaled_int.cpp
+++ b/test/unit/scaled_int/elastic/elastic_scaled_int.cpp
@@ -187,7 +187,7 @@ namespace test_fraction_specific_long {
     static_assert(specific > .333333333333333);
     static_assert(specific < .333333333333334);
 #else
-    static_assert(identical(cnl::elastic_scaled_integer<63, cnl::power<-60>>{1.L / 3}, specific));
+  //    static_assert(identical(cnl::elastic_scaled_integer<63, cnl::power<-60>>{1.L / 3}, specific));
 #endif
 }

I am on a 64-bit ARM (Apple M1 Max).

josmithiii avatar Jul 30 '22 17:07 josmithiii

Please, if possible could you create an issue with reproducible steps? Better still, do you have a branch in which you make an ARM build for OSX? I've tried setting arch=armv8 and clang still outputs what I assume to be x86 code.

johnmcfarlane avatar Aug 24 '22 23:08 johnmcfarlane

This reproduces it on Mac OSX ARM just using the latest main branch:

bash
/bin/rm -rf ./build/
mkdir build
cd build
CXX=/usr/bin/clang++ conan profile new --detect default
conan install --settings compiler.libcxx=libc++ --build=missing --options test=unit ..
conan build ..

It makes it to 79% and then prints

[ 79%] Built target test-unit-scaled_int-overflow-elastic-int
/Users/jos/w/cnl/test/unit/scaled_int/elastic/elastic_scaled_int.cpp:191:5: error: static_assert failed due to requirement 'identical(cnl::_impl::wrapper<cnl::_impl::wrapper<long long, cnl::elastic_tag<63, int>>, cnl::power<-60, 2>>{1.L / 3}, specific)'
    static_assert(identical(cnl::elastic_scaled_integer<63, cnl::power<-60>>{1.L / 3}, specific));
    ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

After that I see

[ 89%] Built target test-unit-overflow-elastic-safe_int
gmake[1]: *** [CMakeFiles/Makefile2:1243: test/unit/CMakeFiles/test-unit.dir/rule] Error 2
gmake: *** [Makefile:556: test-unit] Error 2
ERROR: conanfile.py (cnl/None): Error in build() method, line 68
	cmake.build(target={
	ConanException: Error 2 while executing cmake --build '/Users/jos/w/cnl/build' '--target' 'test-unit' '--' '-j10'
bash-3.2$ 

Are you saying the above should go in a new issue?

josmithiii avatar Aug 25 '22 02:08 josmithiii