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

build-system: cmake: added compiler flags for c++17 #6246

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

doubtfulpalace
Copy link
Contributor

Purpose and Motivation

Fixes #6244 (on my Mac at least).

Types of changes

  • Bug fix

To-do list

  • [X ] Code is tested // i.e., builds
  • [X ] All tests are passing // ctest only. Crash tests are supposed to segfault, right?
  • [n/a ] Updated documentation
  • [ X] This PR is ready for review

@doubtfulpalace doubtfulpalace mentioned this pull request Apr 3, 2024
@prko
Copy link
Contributor

prko commented Apr 3, 2024

Thanks for this. I tested it on MacOS 14.4.1 (M1 max chip) and Ubuntu 22.0.4 (ARM64).
On MacOS14.4.1 I could not build without Supernova and with Supernova.
On Ubuntu 22.0.4 I could build, but there are errors.

I attach all output messages in terminal.

@doubtfulpalace
Copy link
Contributor Author

At line 40453 of sc.build.error.without.supernova.txt I see this:

/Users/prko/SuperCollider/lang/LangPrimSource/PyrStringPrim.cpp:356:16: error: 
      use of undeclared identifier 'errValueRange'
        return errValueRange; // Handle invalid offset

But neither the PR's copy nor the develop branch's copy of PyrStringPrim.cpp contain the string errValueRange. Have you tried building from a fresh clone of the fork?

@prko
Copy link
Contributor

prko commented Apr 4, 2024

Thank you for your feedback!

It is strange... I thought that I used a clean copy.

I have tested again with a clean copy of the source.
You see what I did in the following text file. There is no PyrStringPrim.cpp, but building SC from the source failed. Building SC from source in macOS and Ubuntu in the last year was successful. strange... Hm.

sc clean build error without supernova mac sonoma.txt

@doubtfulpalace
Copy link
Contributor Author

You don't seem to have the patch. What branch are you on? Make sure you're on the PR branch from my fork: doubtfulpalace:topic/fix-build-with-apple-clang-15

/Users/prko/SuperCollider/external_libraries/boost/boost/container_hash/hash.hpp:131:33: error:
      no template named 'unary_function' in namespace 'std'; did you mean
      '__unary_function'?
        struct hash_base : std::unary_function<T, std::size_t> {};
                           ~~~~~^~~~~~~~~~~~~~
                                __unary_function

@smoge
Copy link
Contributor

smoge commented Apr 4, 2024

It is strange... I thought that I used a clean copy.

@prko What branch are you/ Can you do git branch --show-current?

@doubtfulpalace
Copy link
Contributor Author

doubtfulpalace commented Apr 4, 2024 via email

@prko
Copy link
Contributor

prko commented Apr 5, 2024

@smoge

@prko Are you using the 64-bit int branch? There are a lot of warnings about that. Can you do git branch --show-current?

Ehm , I think I do not understand what you mean. Any way in terminal I get this:

(base) prko@prkoMBP2021 build % git branch --show-current
develop
(base) prko@prkoMBP2021 build % cd ..
(base) prko@prkoMBP2021 SuperCollider % git branch --show-current
develop

@doubtfulpalace
Copy link
Contributor Author

The develop branch doesn't have the fix, because the PR hasn't been merged yet. The fix is on topic/fix-build-with-apple-clang-15, which is only in the doubtfulpalace fork.

@prko
Copy link
Contributor

prko commented Apr 5, 2024

@doubtfulpalace
After downloading your branch, I get the followint error:

Last login: Fri Apr  5 11:44:41 on ttys001
(base) prko@prkoMBP2021 build % cmake -G Xcode -DCMAKE_PREFIX_PATH=`brew --prefix qt5`  ..
Warning: Formula qt5 was renamed to qt@5.
Warning: Formula qt5 was renamed to qt@5.
-- The C compiler identification is AppleClang 15.0.0.15000309
-- The CXX compiler identification is AppleClang 15.0.0.15000309
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang - 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: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- SuperCollider Version: 3.14.0-dev
-- Building from  , commit hash is na
-- Please specify the build configuration in the next step
-- Compiling with Qt GUI
-- Performing Test COMPILER_SUPPORTS_CXX17
-- Performing Test COMPILER_SUPPORTS_CXX17 - Success
-- Found Pthreads: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk/usr/lib/libpthread.tbd  
CMake Error at external_libraries/CMakeLists.txt:2 (message):
  It appears you haven't cloned this project's git submodules: please run
  `git submodule update --init --recursive` from the root level of the
  repository.

  For advice on setting up submodules, and also on keeping them updated over
  time, please see this wiki page, and consider saving this link:
  https://github.com/supercollider/supercollider/wiki/git-cheat-sheet#working-with-submodules


-- Configuring incomplete, errors occurred!
(base) prko@prkoMBP2021 build % 

Thus, I pasted the text you modified into the corresponding file of the develop branch. Now, I seem to succeed uin building only with boost errors. However, On sonoma, interpreter quits, and on Ubuntu server does not start...

Screenshot 2024-04-05 at 11 20 46

Screenshot 2024-04-05 at 11 20 56

Anyway, thanks for your work! I do not understand the details of the errors. However, I remember @JordanHendersonMusic recently worked with Boost, I do not know if he can fix this bug, but I worry if his implementation of ReplaceRegex should be touched again. #6213

@doubtfulpalace
Copy link
Contributor Author

You have to do what it says:

It appears you haven't cloned this project's git submodules: please run
  `git submodule update --init --recursive` from the root level of the
  repository.

Always the case when first cloning SuperCollider.

The server crash is:

/Users/timwalters/git/forks/supercollider/build/Install/SuperCollider/SuperCollider.app/Contents/MacOS/sclang
dyld[16953]: Library not loaded: @loader_path/../../../../opt/libogg/lib/libogg.0.dylib
  Referenced from: <F851A6D8-9303-3B85-B8E3-7F43E1CF576D> /Users/timwalters/git/forks/supercollider/build/Install/SuperCollider/SuperCollider.app/Contents/Frameworks/libsndfile.1.dylib
  Reason: tried: '/Users/timwalters/git/forks/supercollider/build/Install/SuperCollider/SuperCollider.app/Contents/Frameworks/../../../../opt/libogg/lib/libogg.0.dylib' (no such file), '/usr/local/lib/libogg.0.dylib' (no such file), '/usr/lib/libogg.0.dylib' (no such file, not in dyld cache)

I don't think it has anything to do with this change. The problem is that Cmake incorrectly thinks it has found Vorbis, etc.:

-- Performing Test SNDFILE_HAS_VORBIS
-- Performing Test SNDFILE_HAS_VORBIS - Success
-- Performing Test SNDFILE_HAS_OPUS
-- Performing Test SNDFILE_HAS_OPUS - Success
-- Performing Test SNDFILE_HAS_MPEG
-- Performing Test SNDFILE_HAS_MPEG - Success

which is beyond my ability to fix, at least tonight, and I'm leaving town for a couple of weeks tomorrow.

You could try patching the current release branch and see if that works.

@muellmusik
Copy link
Contributor

I was able to build with -DCMAKE_CXX_FLAGS="--std=c++17 -D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES" which I gather has the same effect as this PR.

Is this the best solution though? In the next c++ standard I assume these features are gone?

@doubtfulpalace
Copy link
Contributor Author

doubtfulpalace commented Apr 18, 2024 via email

@muellmusik
Copy link
Contributor

@doubtfulpalace I don't know if this is helpful for this issue, and may be stating the obvious, but the README_Boost file notes that some boost files have been patched for SC.

@smoge
Copy link
Contributor

smoge commented Apr 21, 2024

At least one function causing problems was deprecated in c++11 and removed in c++17. So some features are already "gone":

https://en.cppreference.com/w/cpp/utility/functional/unary_function

(It's not used in the SC codebase, but older boost versions)

@doubtfulpalace
Copy link
Contributor Author

doubtfulpalace commented Apr 21, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp: build CMake build system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

build failure
5 participants