Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library linking experience thread #2079

Closed
partouf opened this issue Jul 15, 2020 · 1 comment
Closed

Library linking experience thread #2079

partouf opened this issue Jul 15, 2020 · 1 comment
Labels
question request Request for something

Comments

@partouf
Copy link
Contributor

partouf commented Jul 15, 2020

About the current state of library linking support

This is still mostly experimental an experimental feature, and we would like input on things that either don't work or "would be nice if".

  • We now try to build a couple of C++ libraries for all working compilers and for a small number of variations

    • Variants currently are a mix of x86_64/x86/defaultcompilertarget and if Clang stdlibc++ or libc++
  • You can find a complete list at https://conan.compiler-explorer.com/libraries.html

    • Before submitting a bugreport about linking errors, please check this list first. If it is missing, and you're absolutely positive it should be building for the compiler of your choice, please check https://conan.compiler-explorer.com/failedbuilds.html for the logging for the failed builds. If it has an unreasonable error you cannot reproduce locally, please do submit a bug report.
  • Be aware that libraries are mostly built for the default std version the compiler assumes and not for any other versions (of course, anything >= C++11 should be compatible, but there might be specific examples of where ABI cross-compatibility is broken. If there's any specific use case that you would like to see supported, please make sure you supply the needed examples with any bug report you make and your motivation of why this is a common use-case.

  • There are always special compiler flags that break ABI compatibility between library and compiler. If there's a common use-case that you can provide, please do including motivation and examples.

  • CE should automatically download and add the right libraries to the command line for linking, save for some exceptions with libraries that provide extra "main" binaries (see Catch2 and Google Test)

    • Note that when you use the "Compile to binary" option, you will need to circumvent our feature that injects int main() {} into your code, you can do this with just a comment like // int main() {} somewhere in your code.
  • Unchanged: All the C shared libraries (openssl, cs50 and now also libuv) are built as usual with just one x86_64 and one x86 version

About trunk versions

  • Trunk version of libraries aim to build every night if there are new commits on the library branch - but this is no way guaranteed - we would ask you to please mostly just use tagged versions.
  • None of the libraries are rebuilt when it's the compiler's trunk that's changing, please don't send a bug report about this.

About submitting new libraries

  • (TLDR: please use CMake and don't ignore the contents of CXX, CXXFLAGS, etc)
  • There's currently no support for generated header files based on the build-environment, and this is hard to make compatible with CE regardless. If you're a library developer and think you really do need these and if you can help us support it, feel free to contact us.

About Catch2

  • Known issue: Catch2 only really supports linking binaries from v3, and there are no working variants of earlier versions in any way. (as in, you can compile to assembly, but you can't link or run code using Catch2)
  • If you want the Main function supplied by this library, add -lCatch2Main to your compiler arguments
  • There's a 10s limit for execution, if you use the benchmark functionality of Catch2 you will probably hit that limit after 1 or 2 benchmarks. Library linking experience thread #2079 (comment)

About Google Test

  • If you want the Main function supplied by this library, add -lgtest_maind to your compiler arguments

About Google Benchmark

  • We have a limit for 10s on execution, so your benchmarks might not always complete if you combine them all in one program. But if all fails, you can still always use https://quick-bench.com/ for this.

About TBB

Be kind

  • Even though linking and executing with libraries is new and exciting, it's not going to be lightning-fast. So be patient, and perhaps leave the automatic compiling feature off if you don't want to be interrupted while typing.
    image
  • If you have an example that consistently fails to compile or execute due to time limits, let us know, maybe we can help.

Have fun executing!

@partouf partouf added the request Request for something label Jul 15, 2020
@partouf partouf pinned this issue Jul 15, 2020
@horenmar
Copy link

You might want to add a note about the runtime limit to Catch2 as well - it also provides benchmarking

@partouf partouf closed this as completed Aug 1, 2021
@AbrilRBS AbrilRBS unpinned this issue Aug 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question request Request for something
Projects
None yet
Development

No branches or pull requests

3 participants