google / guetzli

Perceptual JPEG encoder
Apache License 2.0
12.9k stars 977 forks source link

LD Flag `-s` Obselete #41

Open btnwtn opened 7 years ago

btnwtn commented 7 years ago

Building guetzli via make on Mac OS X 10.11.3 results in this error for me:

ld: warning: option -s is obsolete and being ignored
ld: internal error: atom not found in symbolIndex(__ZN7guetzli21ButteraugliComparatorD2Ev) for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [bin/Release/guetzli] Error 1
make: *** [guetzli] Error 2

To fix this error I edited guetzli.make and made these changes:

- ALL_LDFLAGS += $(LDFLAGS) -s
+ ALL_LDFLAGS += $(LDFLAGS) #-s

This successfully linked the build and generated the guetzli executable in bin/Release. I don't know anything about make, but if someone could point me in the proper direction for detecting OS X in a make file I would be willing to open a PR to fix this issue.

Cheers!

fkistner commented 7 years ago

That's weird. I tried making guetzli available in Homebrew, see Homebrew/homebrew-core#11190. The homebrew build bot did not encounter this problem on El Capitan, neither did my local test on Sierra. It did however on Yosemite (for different symbol though):

Linking guetzli
ld: internal error: atom not found in symbolIndex(__ZN11butteraugli5ImageIfE3RowEm) for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [bin/Release/guetzli] Error 1
make: *** [guetzli] Error 2
robryk commented 7 years ago

This seems to be something related to premake/premake-core#133, premake/premake-core#270 and http://industriousone.com/topic/how-remove-flags-ldflags

I don't really understand the problem right now; I'll work it around by actually causing debugging symbols to be emitted (this doesn't impact performance).

@fkistner @btnwtn Are you both using Clang?

fkistner commented 7 years ago

Yes, Homebrew uses clang by default, but uses a custom cc script to inject additional command line options that tend to be necessary. I don't have a Yosemite system to reproduce, but here are the actual command invocations for Sierra (for which it works fine): https://gist.github.com/fkistner/effbd64115a382df9bfe7e3f500b1046

robryk commented 7 years ago

This should now be effectively worked around. If it still manifests, please comment here. I'm keeping the issue open until we figure out what's actually happening.