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

home-brew install fails on High Sierra #73

Closed
cabo opened this issue Jan 19, 2019 · 4 comments
Closed

home-brew install fails on High Sierra #73

cabo opened this issue Jan 19, 2019 · 4 comments

Comments

@cabo
Copy link

cabo commented Jan 19, 2019

Lots of undefined references in building some of the examples:

.../Library/Homebrew/shims/mac/super/clang  -std=c99 -O3 -flto -Wall -pedantic -DNDEBUG -Wl,-search_paths_first -Wl,-headerpad_max_install_names -flto CMakeFiles/readfile.dir/readfile.c.o  -o readfile ../src/libcbor.a 
undef: _cbor_build_bool
undef: _cbor_build_uint8
undef: _cbor_build_string
undef: _cbor_move
undef: _cbor_new_definite_map
undef: _cbor_map_add
undef: _cbor_serialize_alloc
undef: _cbor_decref
Undefined symbols for architecture x86_64:
  "_cbor_build_bool", referenced from:
      _main in lto.o
  "_cbor_build_uint8", referenced from:
      _main in lto.o
  "_cbor_build_string", referenced from:
      _main in lto.o
  "_cbor_move", referenced from:
      _main in lto.o
  "_cbor_new_definite_map", referenced from:
      _main in lto.o
  "_cbor_map_add", referenced from:
      _main in lto.o
  "_cbor_serialize_alloc", referenced from:
      _main in lto.o
  "_cbor_decref", referenced from:
      _main in lto.o
ld: symbol(s) not found for architecture x86_64
undef: _cbor_new_definite_array
undef: _cbor_get_uint8
undef: _cbor_build_uint8
undef: _cbor_array_push
undef: _cbor_move
undef: _cbor_array_handle
undef: _cbor_array_size
undef: _cbor_describe
Undefined symbols for architecture x86_64:
  "_cbor_new_definite_array", referenced from:
      _main in lto.o
  "_cbor_get_uint8", referenced from:
      _comparUint in lto.o
  "_cbor_build_uint8", referenced from:
      _main in lto.o
  "_cbor_array_push", referenced from:
      _main in lto.o
  "_cbor_move", referenced from:
      _main in lto.o
  "_cbor_array_handle", referenced from:
      _main in lto.o
  "_cbor_array_size", referenced from:
      _main in lto.o
  "_cbor_describe", referenced from:
      _main in lto.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [examples/create_items] Error 1
make[1]: *** [examples/CMakeFiles/create_items.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
undef: _cbor_empty_callbacks
undef: _cbor_stream_decode
Undefined symbols for architecture x86_64:
  "_cbor_empty_callbacks", referenced from:
      _main in lto.o
  "_cbor_stream_decode", referenced from:
      _main in lto.o
ld: symbol(s) not found for architecture x86_64
make[2]: *** [examples/sort] Error 1
make[1]: *** [examples/CMakeFiles/sort.dir/all] Error 2
undef: _cbor_load
undef: _cbor_describe
undef: _cbor_decref
Undefined symbols for architecture x86_64:
  "_cbor_load", referenced from:
      _main in lto.o
  "_cbor_describe", referenced from:
      _main in lto.o
  "_cbor_decref", referenced from:
      _main in lto.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [examples/streaming_parser] Error 1
make[1]: *** [examples/CMakeFiles/streaming_parser.dir/all] Error 2
make[2]: *** [examples/readfile] Error 1
make[1]: *** [examples/CMakeFiles/readfile.dir/all] Error 2
[100%] Built target hello
cd .../tmp/libcbor-20190119-19049-1m752yw/libcbor-0.5.0/build/src && .../Cellar/cmake/3.13.3/bin/cmake -E cmake_symlink_library libcbor.0.0.0.dylib libcbor.0.dylib libcbor.dylib
[100%] Built target cbor_shared
make: *** [all] Error 2
@PJK
Copy link
Owner

PJK commented Jan 27, 2019

I pushed some minor fixes to https://github.com/PJK/homebrew-libcbor to make the formula compatible with the latest homebrew, but I doubt that solves the root cause of your issue.

Could you please try brew install -v libcbor again with an up-to-date homebrew (homebrew update)? For reference, I get https://gist.github.com/PJK/c3c9bcaf327c402d456c761bd674a0a5 on a 10.13 mac.

@cabo
Copy link
Author

cabo commented Jan 27, 2019

Maybe I don't understand Mac builds well enough, but the surprising part is that src/libcbor.a consists of .o files of the form:

arrays.c.o:            LLVM bitcode, wrapper x86_64
builder_callbacks.c.o: LLVM bitcode, wrapper x86_64
bytestrings.c.o:       LLVM bitcode, wrapper x86_64
callbacks.c.o:         LLVM bitcode, wrapper x86_64
cbor.c.o:              LLVM bitcode, wrapper x86_64
common.c.o:            LLVM bitcode, wrapper x86_64
encoders.c.o:          LLVM bitcode, wrapper x86_64
encoding.c.o:          LLVM bitcode, wrapper x86_64
floats_ctrls.c.o:      LLVM bitcode, wrapper x86_64
ints.c.o:              LLVM bitcode, wrapper x86_64
loaders.c.o:           LLVM bitcode, wrapper x86_64
maps.c.o:              LLVM bitcode, wrapper x86_64
memory_utils.c.o:      LLVM bitcode, wrapper x86_64
serialization.c.o:     LLVM bitcode, wrapper x86_64
stack.c.o:             LLVM bitcode, wrapper x86_64
streaming.c.o:         LLVM bitcode, wrapper x86_64
strings.c.o:           LLVM bitcode, wrapper x86_64
tags.c.o:              LLVM bitcode, wrapper x86_64
unicode.c.o:           LLVM bitcode, wrapper x86_64

nm -p is helpless.

@PJK
Copy link
Owner

PJK commented Jan 27, 2019

I know next to nothing about OSX details, but I believe the reason this doesn't emit plain object files (if that is what you're alluding) is that LTO is enabled for release builds which triggers this behavior in clang (https://github.com/mull-project/mull/blob/master/Docs/HowToGetLLVMBitcode.md).

@PJK
Copy link
Owner

PJK commented Mar 16, 2020

If the above is the real cause, it will be solved by Homebrew/homebrew-core#50588

@PJK PJK closed this as completed Mar 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants