Closed jameshadfield closed 3 years ago
Hey James @jameshadfield ,
Thanks so much. I don't have a mac handy so your help is very appreciated!
realpath: command not found
Solution: instruct MacOS uses to install coreutils via homebrew
It's probably also true for Linux.
Alternatively, we might try to get rid of realpath
. It's probably not that vital.
Solution: instruct uses to add the bincrafters conan remote
Yes, sorry about that. For Linux it's currently in the conan installation script. Should totally tell users. Alternatively, we might use a local conan config somehow (stored in the repo) instead of the global one. The remotes are in ~/.conan/remotes.json
.
Detected a mismatch for the compiler version between your conan profile settings and CMake:
I think it might be similar but worse version of "Trobleshooting tip #1":
- I have a newer version of a compiler, but conan and cmake keep using the old one
Conan remembers things in a few places:
when creating global conan profile with
conan profile new default --detect
The profile is stored in ~/.conan/profiles
. I think it remembers a compiler that is the first available in PATH
(basically which clang
at THAT point in time)
when running conan install
during the dev script invocation, it prepares dependencies in the build directory (e.g. .build/Debug
for dev mode), which are bound to a specific compiler
Cmake also remembers some things during build files generation, including the compiler in the build directory.
So, currently, switching compilers basically means wiping the build directories, removing the global conan profile, creating a new one and basically starting from scratch. It's as inconvenient as it sounds and a major pain and should be solved. The solution (or at least a part of it) that we need to implement is:
use a local conan profile (file or through command line) instead of the global one. In case of file-based profile, compiler field might or might not need to be adjusted when invoking conan.
possibly make different build directories for different compilers and compiler versions. That would require detecting compilers, e.g. from clang --version
, gcc--version
etc., which is fragile and no fun, but might work.
The other issue with the current build I don't like is that it's getting pretty complex and is based almost entirely on bash. Maybe we could leverage conanfile in Python format to make it look like something reasonable. But that would require quite a bit of work.
P.S. If users stumble upon this issue: The goal here is to setup a native macOS build (with prospect to further setup a CI and produce binaries), but if you just want to build and run Nextalign on Apple, you could use Docker dev build or a prebuilt images.
I forgot to mention that as a CMake-based app, none of these steps are mandatory. That is, usage of conan or build script is purely a "convenience" feature, mostly for day-to-day development. And, if it all becomes inconvenient, it can (and should!) be safely dumped.
Theoretically, one should be able to build Nextalign as any other CMake app or library. In fact, most of these would not come with conan config or build scripts. For example, a CMake GUI can be used, or a CLI version of it. Dependencies would have to be installed manually in this case, of course.
Based on that, maybe we could have separate build scripts for Mac and Windows with their alternative paths to do things? That would also be a good option. And also conda, maybe it can be of some use?
I'd be very glad to hear from devs on how to improve the build, because, honestly, I am not happy about it.
Thanks @ivan-aksamentov that was really helpful - It helped me identify that conda hadn't installed clang++
which was the problem ;) the following steps resolved the error (but I've now got another!)
Edit: I thought the following seps resolved this issue, but it came back!
conda install -c anaconda clangxx # NOTE: downgrades conda's clang & clang++ to v10
rm -rf .build
rm -rf ~/.conan
./tools/install-conan
make prod
# see below for new error :(
Edit: I now cannot reproduce this error after following the above steps, as I run into error 3 again, however I can get here using MacOS's native
clang
(v12)
make prod
... # conan downloads lots of packages (I think)
benchmark/1.5.2: Configuring sources in /Users/enigma/.conan/data/benchmark/1.5.2/_/_/source
Downloading v1.5.2.tar.gz completed [156.48k]
benchmark/1.5.2: Copying sources to build folder
benchmark/1.5.2: Building your package in /Users/enigma/.conan/data/benchmark/1.5.2/_/_/build/9a8d9a889d380b0427ca28d9b20d6b9048add91f
benchmark/1.5.2: Generator cmake created conanbuildinfo.cmake
benchmark/1.5.2: Calling build()
-- The C compiler identification is AppleClang 12.0.0.12000032
-- The CXX compiler identification is AppleClang 12.0.0.12000032
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conan: called by CMake conan helper
-- Conan: called inside local cache
-- Conan: Adjusting output directories
-- Conan: Using cmake global configuration
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- Conan: Adjusting fPIC flag (ON)
-- Conan: C++ stdlib: libstdc++
-- Failed to find LLVM FileCheck
-- Found Git: /usr/local/bin/git (found version "2.30.0")
-- git Version: v0.0.0
-- Version: 0.0.0
-- Performing Test HAVE_CXX_FLAG_STD_CXX11
-- Performing Test HAVE_CXX_FLAG_STD_CXX11 - Failed
-- Performing Test HAVE_CXX_FLAG_STD_CXX0X
-- Performing Test HAVE_CXX_FLAG_STD_CXX0X - Failed
-- Performing Test HAVE_CXX_FLAG_WALL
-- Performing Test HAVE_CXX_FLAG_WALL - Failed
-- Performing Test HAVE_CXX_FLAG_WEXTRA
-- Performing Test HAVE_CXX_FLAG_WEXTRA - Failed
-- Performing Test HAVE_CXX_FLAG_WSHADOW
-- Performing Test HAVE_CXX_FLAG_WSHADOW - Failed
-- Performing Test HAVE_CXX_FLAG_WERROR
-- Performing Test HAVE_CXX_FLAG_WERROR - Failed
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32
-- Performing Test HAVE_CXX_FLAG_WSHORTEN_64_TO_32 - Failed
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING
-- Performing Test HAVE_CXX_FLAG_FSTRICT_ALIASING - Failed
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED_DECLARATIONS - Failed
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED
-- Performing Test HAVE_CXX_FLAG_WNO_DEPRECATED - Failed
-- Performing Test HAVE_CXX_FLAG_WD654
-- Performing Test HAVE_CXX_FLAG_WD654 - Failed
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY
-- Performing Test HAVE_CXX_FLAG_WTHREAD_SAFETY - Failed
-- Performing Test HAVE_CXX_FLAG_COVERAGE
-- Performing Test HAVE_CXX_FLAG_COVERAGE - Failed
-- Performing Test HAVE_STD_REGEX
-- Performing Test HAVE_STD_REGEX
-- Performing Test HAVE_STD_REGEX -- failed to compile
-- Performing Test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Performing Test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX
-- Performing Test HAVE_POSIX_REGEX -- failed to compile
CMake Error at source_subfolder/CMakeLists.txt:260 (message):
Failed to determine the source files for the regular expression backend
@jameshadfield Hmmm no idea.
Sounds like if compiler did not have a necessary regex feature, which should be available from any C++11-compliant compiler, way back in the days of Clang 3.x or so.
In what context does this error appear? What does it build? Is it during the build of one of the dependencies? Or is this during Nextalign build itself?
I wonder if it's all conda quirks. What happens if you run without it, just on a completely vanilla OS X?
I wonder if it's all conda quirks. What happens if you run without it, just on a completely vanilla OS X?
Yes, I wondered this myself
clang --version # MacOS default: Apple clang version 12.0.0 (clang-1200.0.32.28)
clang++ --version # same output as clang, above
rm -rf .build
rm -rf ~/.conan
./tools/install-conan
make prod # dies almost immediately
- Install dependencies
ERROR: Invalid setting 'libstdc++11' is not a valid 'settings.compiler.libcxx' value.
Possible values are ['libc++', 'libstdc++']
Read "http://docs.conan.io/en/latest/faq/troubleshooting.html#error-invalid-setting"
make: *** [prod] Error 1
For what it's worth,
cat ~/.conan/profiles/default
[settings]
os=Macos
os_build=Macos
arch=x86_64
arch_build=x86_64
compiler=apple-clang
compiler.version=12.0
compiler.libcxx=libstdc++11
build_type=Release
[options]
[build_requires]
[env]
Manually changing the conan config to compiler.libcxx=libstdc++
allows this to proceed and I run into Error 4 (see above)
I think this line
conan profile update settings.compiler.libcxx=libstdc++11 default
in tools/install-conan
is only relevant for GCC and breaks clang.
Can you wipe everything and install conan without this line?
The default for Clang is libc++, so the settings.compiler.libcxx
profile entry should be either non-existent or libc++
, I think.
Maybe there's a common denominator for this value between GCC and Clang, or maybe it should not be added with clang. It alters binary ABI (inlcuding for the dependencies), so we should be careful for the release binaries.
AppleClang 12 is almost the same as Clang 10 (source), so it should definitely have HAVE_STD_REGEX
and HAVE_CXX_FLAG_STD_CXX11
. These checks each compile and run a small executable, so there is something wrong with either compiling or running these. I suspect the settings.compiler.libcxx
is the offending part.
Alternatively, benchmarks is not a vital part of running Nextalign, so it can be commented out.
A few places have to be altered:
https://github.com/neherlab/nextalign/blob/a5b675b620e75072917a1b51ce93ba50a45c5c3e/conanfile.txt#L2
Maybe we could make it optional somehow. The conan part might be tricky. Python-based conanfile might be more convenient in this.
Getting closer!
After removing the line in tools/install-conan
as you suggested I can now get up to the actual building of Nextalign. Yay!
Here's the current error. I don't have experience writing C/C++ so apologies for not being able to troubleshoot this that well!
@jameshadfield Cool! This one looks like a bug. I am going to try with Clang and see what's going on.
UPDATE: yep, can reproduce
@jameshadfield Should be fixed in https://github.com/neherlab/nextalign/pull/25
I also found another warning after that, the fix is incoming. But it should compile now.
Thanks @ivan-aksamentov! I get one warning but also a number of type errors which prevent it from compiling such as error: unknown type name 'u_int'
Oh no! Looks like Intel TBB relies on some system stuff, and the stuff in MacOSX11.1.sdk for some reason does not meet it's expectations. The only way for me is to google it...
I am not sure what "11.1" refers to here. But it seems that it's not the same as "12" in the compiler version. Could that be it?
I don't want to break your computer, but it seems that the compiler toolchain should be updated after every OS update and maybe Xcode update.
xcode-select --install
Do it it your own risk though! Maybe we could try it on a cloud Mac or TravisCI/CircleCI to make sure we don't break anything.
Also, before that, maybe try to comment out the
include(packages/cmake/CFlags.cmake)
line here
It might add a few compiler-specific flags. But unlikely a problem.
I am not sure what "11.1" refers to here. But it seems that it's not the same as "12" in the compiler version. Could that be it?
11.1 here is referring to the MacOS version I'm running ("Big Sur"). It's also not an intel processor (apple M1) if that makes any difference. (That's one of the reasons I'm keen to build it locally.)
Also, before that, maybe try to comment out
include(packages/cmake/CFlags.cmake)
Didn't help unfortunately.
but it seems that the compiler toolchain should be updated after every OS update and maybe Xcode update
Gave this a shot, but I'm on a fresh OS install so this was unlikely to be it
$xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
~Googling led me to this stackoverflow answer but, having very little C/C++ experience, I offer no comment!~ This answer seems more relevant.
Will resume debugging tomorrow. Thanks for all the help today!
not an intel processor (apple M1)
Oh wow! Intel TBB depends heavily on hardware-specifics. That might be tricky. Tools and libraries might not have caught up for Apple silicon just yet :(
But here we strangely have Intel TBB compiling fine, and then system headers problem. Maybe we could try and update the TBB version.
Thanks so much for trying all that!
Nextalign is moved into Nextclade repo, let's continue there https://github.com/nextstrain/nextclade/issues/315
@ivan-aksamentov here's my progress so far
OS: MacOS version 11.1 Bash: GNU bash, version 5.1.4(1)-release (x86_64-apple-darwin20.2.0) Conda 4.9.2
Error 1
realpath
isn’t available on MacOS but can be installed viabrew install coreutils
Solution: instruct MacOS uses to install coreutils via homebrew
Error 2
And it appears that boost doesn’t exist in Conan using the default remote(s)?
I added the
bincrafters
remote and this fixed itSolution: instruct uses to add the bincrafters conan remote
Error 3
This is a PATH issue - the default MacOS clang compiler is v12, but I installed a conda version of ~10~ 11, which comes first on PATH. Note that this is happening in the “Install dependencies” part of
build_locally.sh
socmake
is being called byconan
, not the script, and I can’t work out how to change the cmake options so that it looks at the correct compiler!Tried a few things without success:
export CC=/Users/enigma/miniconda3/envs/nextalign/bin/clang
didn’t work, same error.CMakeLists.txt
changed line 17 toset(CMAKE_C_COMPILER /Users/enigma/miniconda3/envs/nextalign/bin/clang)
[env] -> PATH=[/Users/enigma/miniconda3/envs/nextalign/bin]
to the default conan profile.