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

Changes for compilation using AppleClang on MacOS #28

Closed
wants to merge 4 commits into from

Conversation

wbenoot
Copy link

@wbenoot wbenoot commented Jul 7, 2023

Eventhough Boost was found, it had some issues with finding unit_test_framework.
Implicit casting caused troubles only when using Clang compiler, GCC worked fine.

igorauad added a commit that referenced this pull request Jul 7, 2023
Construct gr::complex with {float re, float im} instead of relying on
complex literals, given that the latter may not work with Clang, as
reported in #28.
igorauad added a commit that referenced this pull request Jul 7, 2023
Construct gr::complex with {float re, float im} instead of relying on
complex literals, given that the latter may not work with Clang, as
reported in #28.

To reproduce the changes in this patch, use the following script:

cmd='sed -i '' \
    -e "s/(SQRT2_2 + SQRT2_2i)/{SQRT2_2, SQRT2_2}/g" \
    -e "s/(-SQRT2_2 - SQRT2_2i)/{-SQRT2_2, -SQRT2_2}/g" \
    -e "s/(-SQRT2_2 + SQRT2_2i)/{-SQRT2_2, SQRT2_2}/g" \
    -e "s/(SQRT2_2 - SQRT2_2i)/{SQRT2_2, -SQRT2_2}/g" \
    -e "s/(+SQRT2_2 + SQRT2_2i)/{SQRT2_2, SQRT2_2}/g" \
    -e "s/(-SQRT2_2 + SQRT2_2i)/{-SQRT2_2, SQRT2_2}/g" \
    -e "s/(+SQRT2_2 - SQRT2_2i)/{SQRT2_2, -SQRT2_2}/g" \
    -e "s/(-SQRT2_2 - SQRT2_2i)/{-SQRT2_2, -SQRT2_2}/g" \
    $1 && clang-format -i $1'
find . -name *.h -path "./lib/*" -exec bash -c "$cmd" -- {} \;
find . -name *.cc -path "./lib/*" -exec bash -c "$cmd" -- {} \;
find . -name *.hh -path "./lib/*" -exec bash -c "$cmd" -- {} \;
find . -name *.cc -path "./bench/*" -exec bash -c "$cmd" -- {} \;
igorauad added a commit that referenced this pull request Jul 7, 2023
Construct gr::complex with {float re, float im} instead of relying on
complex literals, given that the latter may not work with Clang, as
reported in #28.

To reproduce the changes in this patch, use the following script:

cmd='sed -i '' \
    -e "s/(SQRT2_2 + SQRT2_2i)/{SQRT2_2, SQRT2_2}/g" \
    -e "s/(-SQRT2_2 - SQRT2_2i)/{-SQRT2_2, -SQRT2_2}/g" \
    -e "s/(-SQRT2_2 + SQRT2_2i)/{-SQRT2_2, SQRT2_2}/g" \
    -e "s/(SQRT2_2 - SQRT2_2i)/{SQRT2_2, -SQRT2_2}/g" \
    -e "s/(+SQRT2_2 + SQRT2_2i)/{SQRT2_2, SQRT2_2}/g" \
    -e "s/(-SQRT2_2 + SQRT2_2i)/{-SQRT2_2, SQRT2_2}/g" \
    -e "s/(+SQRT2_2 - SQRT2_2i)/{SQRT2_2, -SQRT2_2}/g" \
    -e "s/(-SQRT2_2 - SQRT2_2i)/{-SQRT2_2, -SQRT2_2}/g" \
    -e "s/(-1.0j)/{ 0, -1.0 }/g" \
    -e "s/(+1.0j)/{ 0, 1.0 }/g" \
    -e "s/1j/{ 0, 1.0 }/g" \
    $1 && clang-format -i $1'
find . -name *.h -path "./lib/*" -exec bash -c "$cmd" -- {} \;
find . -name *.cc -path "./lib/*" -exec bash -c "$cmd" -- {} \;
find . -name *.hh -path "./lib/*" -exec bash -c "$cmd" -- {} \;
find . -name *.cc -path "./bench/*" -exec bash -c "$cmd" -- {} \;
@igorauad
Copy link
Owner

igorauad commented Jul 7, 2023

Hi @wbenoot ,

Thanks for the PR. These changes are a little tedious to review manually, so I thought I should make a script to reproduce them. I've pushed the changes in c079787, which were generated by the following script:

#!/bin/bash
cmd='sed -i '' \
    -e "s/(SQRT2_2 + SQRT2_2i)/{SQRT2_2, SQRT2_2}/g" \
    -e "s/(-SQRT2_2 - SQRT2_2i)/{-SQRT2_2, -SQRT2_2}/g" \
    -e "s/(-SQRT2_2 + SQRT2_2i)/{-SQRT2_2, SQRT2_2}/g" \
    -e "s/(SQRT2_2 - SQRT2_2i)/{SQRT2_2, -SQRT2_2}/g" \
    -e "s/(+SQRT2_2 + SQRT2_2i)/{SQRT2_2, SQRT2_2}/g" \
    -e "s/(-SQRT2_2 + SQRT2_2i)/{-SQRT2_2, SQRT2_2}/g" \
    -e "s/(+SQRT2_2 - SQRT2_2i)/{SQRT2_2, -SQRT2_2}/g" \
    -e "s/(-SQRT2_2 - SQRT2_2i)/{-SQRT2_2, -SQRT2_2}/g" \
    -e "s/(-1.0j)/{ 0, -1.0 }/g" \
    -e "s/(+1.0j)/{ 0, 1.0 }/g" \
    -e "s/1j/{ 0, 1.0 }/g" \
    $1 && clang-format -i $1'
find . -name *.h -path "./lib/*" -exec bash -c "$cmd" -- {} \;
find . -name *.cc -path "./lib/*" -exec bash -c "$cmd" -- {} \;
find . -name *.hh -path "./lib/*" -exec bash -c "$cmd" -- {} \;
find . -name *.cc -path "./bench/*" -exec bash -c "$cmd" -- {} \;

Could you please rebase your PR so that I can check if there was any change left?

I also see the change about finding boost. I wonder if we should use include(GrBoost) like this: https://github.com/gnuradio/gnuradio/blob/76831245122fdbd2ce52951d8749ef3b4ff8e496/gr-fft/CMakeLists.txt#L11. Could you test and see if that solves the problem like find_package(Boost REQUIRED unit_test_framework) did?

@igorauad
Copy link
Owner

igorauad commented Jul 7, 2023

Also, I've been meaning to test the compilation using Clang on CI for some time. The changes are in 2c3fdec. However, I never figured out a solution for the issue reported in #4 (comment).

Have you tried running ctest after your Clang compilation? Do they work?

@wbenoot
Copy link
Author

wbenoot commented Jul 10, 2023

hi @igorauad

I rebased, there was only one file not updated by your script.
Will check for the Boost inclusion soon, and I'll try to have a look at the Clang build.

@igorauad
Copy link
Owner

Thanks!

igorauad added a commit that referenced this pull request Jul 11, 2023
As indicated in #28, the macOS build requires an explicit find_package
call to find the Boost::unit_test_framework component to which each unit
test application is linked (via the GR_ADD_CPP_TEST call).
igorauad added a commit that referenced this pull request Oct 24, 2023
As indicated in #28, the macOS build requires an explicit find_package
call to find the Boost::unit_test_framework component to which each unit
test application is linked (via the GR_ADD_CPP_TEST call).
igorauad added a commit that referenced this pull request Oct 24, 2023
As indicated in #28, the macOS build requires an explicit find_package
call to find the Boost::unit_test_framework component to which each unit
test application is linked (via the GR_ADD_CPP_TEST call).
@igorauad
Copy link
Owner

@wbenoot I will close this PR. The fixes were already incorporated into the master branch, including your commit 6d3ed1c.

@igorauad igorauad closed this Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants