maandree/libkeccak

Failed to compile on MacOS

eduardonunesp opened this issue · 6 comments

macOS Sierra 10.12.6

Sorry for the long log

cc -fPIC -c -o libkeccak/digest.o libkeccak/digest.c -std=c99 -O3 -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700
In file included from libkeccak/digest.c:2:
In file included from libkeccak/digest.h:5:
libkeccak/state.h:93:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull)))
                                  ^
libkeccak/state.h:131:59: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow, optimize("-O0"))))
                                                          ^
libkeccak/state.h:131:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow, optimize("-O0"))))
                                  ^
libkeccak/state.h:139:59: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow, optimize("-O0"))))
                                                          ^
libkeccak/state.h:139:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow, optimize("-O0"))))
                                  ^
libkeccak/state.h:147:53: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((nonnull, nothrow, optimize("-O0"))))
                                                    ^
libkeccak/state.h:156:43: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((unused, optimize("-O0"))))
                                          ^
libkeccak/state.h:204:43: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((unused, optimize("-O0"))))
                                          ^
libkeccak/state.h:227:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull)))
                                  ^
libkeccak/state.h:270:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow)))
                                  ^
libkeccak/state.h:281:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull)))
                                  ^
libkeccak/state.h:292:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow, warn_unused_result, pure)))
                                  ^
12 warnings generated.
cc -fPIC -c -o libkeccak/files.o libkeccak/files.c -std=c99 -O3 -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700
In file included from libkeccak/files.c:2:
In file included from libkeccak/files.h:5:
In file included from libkeccak/../libkeccak.h:6:
libkeccak/../libkeccak/generalised-spec.h:136:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow)))
                                  ^
In file included from libkeccak/files.c:2:
In file included from libkeccak/files.h:5:
In file included from libkeccak/../libkeccak.h:7:
libkeccak/../libkeccak/state.h:93:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull)))
                                  ^
libkeccak/../libkeccak/state.h:131:59: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow, optimize("-O0"))))
                                                          ^
libkeccak/../libkeccak/state.h:131:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow, optimize("-O0"))))
                                  ^
libkeccak/../libkeccak/state.h:139:59: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow, optimize("-O0"))))
                                                          ^
libkeccak/../libkeccak/state.h:139:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow, optimize("-O0"))))
                                  ^
libkeccak/../libkeccak/state.h:147:53: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((nonnull, nothrow, optimize("-O0"))))
                                                    ^
libkeccak/../libkeccak/state.h:156:43: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((unused, optimize("-O0"))))
                                          ^
libkeccak/../libkeccak/state.h:204:43: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((unused, optimize("-O0"))))
                                          ^
libkeccak/../libkeccak/state.h:227:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull)))
                                  ^
libkeccak/../libkeccak/state.h:270:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow)))
                                  ^
libkeccak/../libkeccak/state.h:281:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull)))
                                  ^
libkeccak/../libkeccak/state.h:292:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow, warn_unused_result, pure)))
                                  ^
In file included from libkeccak/files.c:2:
In file included from libkeccak/files.h:5:
In file included from libkeccak/../libkeccak.h:9:
libkeccak/../libkeccak/hex.h:17:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow)))
                                  ^
libkeccak/../libkeccak/hex.h:28:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow)))
                                  ^
libkeccak/../libkeccak/hex.h:39:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow)))
                                  ^
In file included from libkeccak/files.c:2:
In file included from libkeccak/../libkeccak/files.h:5:
In file included from libkeccak/../libkeccak.h:11:
libkeccak/../libkeccak/mac/hmac.h:152:53: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((nonnull, nothrow, optimize("-O0"))))
                                                    ^
libkeccak/../libkeccak/mac/hmac.h:181:43: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((unused, optimize("-O0"))))
                                          ^
libkeccak/../libkeccak/mac/hmac.h:218:43: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((unused, optimize("-O0"))))
                                          ^
In file included from libkeccak/files.c:2:
libkeccak/../libkeccak/files.h:38:50: warning: unknown attribute 'artificial' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((nonnull(2, 3), artificial, gnu_inline)))
                                                 ^
libkeccak/../libkeccak/files.h:58:47: warning: unknown attribute 'artificial' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((nonnull(2), artificial, gnu_inline)))
                                              ^
libkeccak/../libkeccak/files.h:81:47: warning: unknown attribute 'artificial' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((nonnull(2), artificial, gnu_inline)))
                                              ^
libkeccak/../libkeccak/files.h:104:47: warning: unknown attribute 'artificial' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((nonnull(2), artificial, gnu_inline)))
                                              ^
23 warnings generated.
cc -fPIC -c -o libkeccak/generalised-spec.o libkeccak/generalised-spec.c -std=c99 -O3 -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700
In file included from libkeccak/generalised-spec.c:2:
libkeccak/generalised-spec.h:136:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow)))
                                  ^
libkeccak/generalised-spec.c:6:33: warning: unknown warning group '-Wmaybe-uninitialized', ignored [-Wunknown-warning-option]
# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
                                ^
2 warnings generated.
cc -fPIC -c -o libkeccak/hex.o libkeccak/hex.c -std=c99 -O3 -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700
In file included from libkeccak/hex.c:2:
libkeccak/hex.h:17:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow)))
                                  ^
libkeccak/hex.h:28:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow)))
                                  ^
libkeccak/hex.h:39:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow)))
                                  ^
3 warnings generated.
cc -fPIC -c -o libkeccak/state.o libkeccak/state.c -std=c99 -O3 -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700
In file included from libkeccak/state.c:2:
libkeccak/state.h:93:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull)))
                                  ^
libkeccak/state.h:131:59: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow, optimize("-O0"))))
                                                          ^
libkeccak/state.h:131:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow, optimize("-O0"))))
                                  ^
libkeccak/state.h:139:59: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow, optimize("-O0"))))
                                                          ^
libkeccak/state.h:139:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow, optimize("-O0"))))
                                  ^
libkeccak/state.h:147:53: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((nonnull, nothrow, optimize("-O0"))))
                                                    ^
libkeccak/state.h:156:43: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((unused, optimize("-O0"))))
                                          ^
libkeccak/state.h:204:43: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((unused, optimize("-O0"))))
                                          ^
libkeccak/state.h:227:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull)))
                                  ^
libkeccak/state.h:270:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow)))
                                  ^
libkeccak/state.h:281:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull)))
                                  ^
libkeccak/state.h:292:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow, warn_unused_result, pure)))
                                  ^
12 warnings generated.
cc -fPIC -c -o libkeccak/mac/hmac.o libkeccak/mac/hmac.c -std=c99 -O3 -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700
In file included from libkeccak/mac/hmac.c:2:
In file included from libkeccak/mac/hmac.h:12:
libkeccak/mac/../state.h:93:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull)))
                                  ^
libkeccak/mac/../state.h:131:59: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow, optimize("-O0"))))
                                                          ^
libkeccak/mac/../state.h:131:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow, optimize("-O0"))))
                                  ^
libkeccak/mac/../state.h:139:59: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow, optimize("-O0"))))
                                                          ^
libkeccak/mac/../state.h:139:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow, optimize("-O0"))))
                                  ^
libkeccak/mac/../state.h:147:53: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((nonnull, nothrow, optimize("-O0"))))
                                                    ^
libkeccak/mac/../state.h:156:43: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((unused, optimize("-O0"))))
                                          ^
libkeccak/mac/../state.h:204:43: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((unused, optimize("-O0"))))
                                          ^
libkeccak/mac/../state.h:227:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull)))
                                  ^
libkeccak/mac/../state.h:270:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow)))
                                  ^
libkeccak/mac/../state.h:281:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull)))
                                  ^
libkeccak/mac/../state.h:292:35: warning: unknown attribute 'leaf' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((leaf, nonnull, nothrow, warn_unused_result, pure)))
                                  ^
In file included from libkeccak/mac/hmac.c:2:
libkeccak/mac/hmac.h:152:53: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((nonnull, nothrow, optimize("-O0"))))
                                                    ^
libkeccak/mac/hmac.h:181:43: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((unused, optimize("-O0"))))
                                          ^
libkeccak/mac/hmac.h:218:43: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
LIBKECCAK_GCC_ONLY(__attribute__((unused, optimize("-O0"))))
                                          ^
libkeccak/mac/hmac.c:21:23: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
static __attribute__((optimize("-O0"))) void
                      ^
16 warnings generated.
ar rc libkeccak.a libkeccak/digest.o libkeccak/files.o libkeccak/generalised-spec.o libkeccak/hex.o libkeccak/state.o libkeccak/mac/hmac.o
ar -s libkeccak.a
cc -shared -Wl,-soname,libkeccak.so.1 -o libkeccak.so libkeccak/digest.o libkeccak/files.o libkeccak/generalised-spec.o libkeccak/hex.o libkeccak/state.o libkeccak/mac/hmac.o -s
ld: warning: option -s is obsolete and being ignored
ld: unknown option: -soname
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libkeccak.so] Error 1

Build with make LIBEXT=dylib LIBFLAGS=-dynamiclib.

ld: warning: option -s is obsolete and being ignored is nothing to worry about, but you can use strip(1) instead.

The other warnings are due to clang pretending to be GCC and are unimportant.

Another error, not the same output

make clean
make LIBEXT=dylib LIBFLAGS=-dynamiclib

16 warnings generated.
ar rc libkeccak.a libkeccak/digest.o libkeccak/files.o libkeccak/generalised-spec.o libkeccak/hex.o libkeccak/state.o libkeccak/mac/hmac.o
ar -s libkeccak.a
cc -shared -Wl,-soname,libkeccak.dylib.1 -o libkeccak.dylib libkeccak/digest.o libkeccak/files.o libkeccak/generalised-spec.o libkeccak/hex.o libkeccak/state.o libkeccak/mac/hmac.o -s
ld: warning: option -s is obsolete and being ignored
ld: unknown option: -soname
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libkeccak.dylib] Error 1

Does it work now?

Nope :( same error

I get cc -dynamiclib libkeccak.dylib libkeccak/digest.o libkeccak/files.o libkeccak/generalised-spec.o libkeccak/hex.o libkeccak/state.o libkeccak/mac/hmac.o -s when I run make LIBEXT=dylib LIBFLAGS=-dynamiclib. Perhaps you forgot to pull the new commit or mistyped LIBFLAGS.

After pulling the latest changes it worked ! thanks for the support