Opendigitalradio / dablin

DAB/DAB+ receiver for Linux (including ETI-NI and EDI AF playback)
GNU General Public License v3.0
123 stars 27 forks source link

Adding -z switch to the linker flags breaks linking on macOS using clang. #44

Closed npm-sdr closed 5 years ago

npm-sdr commented 5 years ago

Adding -z switch to the linker flags breaks linking on macOS using clang.

[ 66%] Linking CXX executable dablin_gtk
clang: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]
ld: warning: option -s is obsolete and being ignored
ld: unknown option: -z
clang: error: linker command failed with exit code 1 (use -v to see invocation)

_Originally posted by @npm-sdr in https://github.com/Opendigitalradio/dablin/commit_comment/create#commitcomment-31847496_

basicmaster commented 5 years ago

(I slightly edited your comment to preserve the line breaks)

Could you please post the output of the cmake call? And could you put VERBOSE=1 in front of your make call, and post the (affected) result lines here?

npm-sdr commented 5 years ago

Hi Stefan,

Please find attached the build log as requested.

Regards, Niro.

dablin_build_log.txt

basicmaster commented 5 years ago

Hmm, I can't really reconstruct the situation here. Does the result change, if you apply the following patch? linker_flags.patch.txt

npm-sdr commented 5 years ago

Hi Stefan,

I applied the patch and re-tried. It's still failing but with one less warning. Passing the linker flags to the linker using -Wl made no difference to -s and -z flags but the warning re unused -pie flag is now gone.

ld: warning: option -s is obsolete and being ignored

ld: unknown option: -z

I suspect clang-10.0.0 on macOS 10.14.2 doesn't support -z anymore and -s and flag is being deprecated.

$ clang --version

Apple LLVM version 10.0.0 (clang-1000.11.45.5)

Target: x86_64-apple-darwin18.2.0

Thread model: posix

InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Regards, Niro.

On Sun, 13 Jan 2019 at 17:54, Stefan Pöschel notifications@github.com wrote:

Hmm, I can't really reconstruct the situation here. Does the result change, if you apply the following patch? linker_flags.patch.txt https://github.com/Opendigitalradio/dablin/files/2753320/linker_flags.patch.txt

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Opendigitalradio/dablin/issues/44#issuecomment-453851104, or mute the thread https://github.com/notifications/unsubscribe-auth/AgFDs30UZAnelIZPYq5kM9enj77pJ1h1ks5vC3LcgaJpZM4Zwo5V .

basicmaster commented 5 years ago

Interesting that it makes a different in terms of PIE.....on my system GNU ld crashes with -Wl,-pie...the other changes are fine and lead to the same result.

I suspect clang-10.0.0 on macOS 10.14.2 doesn't support -z anymore and -s and flag is being deprecated.

So the question arises, how are PIE, RELRO and striping enabled on Mac. Is there a different way? What does checksec.sh show, with the current compilation result on the one hand, and without the hardening added by the problematic commit on the other hand?

basicmaster commented 5 years ago

As there currently seems no way to use the respective params with clang/LLVM, I disabled the recently added parameters for now, if clang is used. Please check if this fixes your compilation and if so, close this issue.

npm-sdr commented 5 years ago

Hi Stefan,

I've just updated to the top of next branch and rebuilt - builds fine on macOS now.

Sorry for the delay and many thanks. Niro.

npm-sdr commented 5 years ago

Fixed

barracuda156 commented 1 year ago

@npm-sdr These are not supported by GCC either. In fact, it is Apple linker does not accept these, compiler seems irrelevant.