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

Linker error: Undefined symbols for architecture, problem with folly #445

Open
karol-bisztyga opened this issue Aug 20, 2021 · 4 comments
Open

Comments

@karol-bisztyga
Copy link

karol-bisztyga commented Aug 20, 2021

Hey! I'm having trouble with linking my "hello world" service. I built fbthrift successfully and I wanted to build a simple example.
Here are my files: https://github.com/karol-bisztyga/fbthrift-test
Files in gen-cpp2 are generated using thrift1 --gen mstch_cpp2 Example.thrift
When I try to build with build.sh I get following linker errors:

https://gist.github.com/karol-bisztyga/987fa29023395ef30c1bcc25f6c66bbb

I see that FLAGS_thrift_cpp2_protocol_reader_string_limit and thrift_cpp2_protocol_reader_container_limit are defined by using DECLARE_int32. Looks like folly's FOLLY_DECLARE_FLAG doesn't work.

This line

folly::f14::detail::F14LinkCheck<(folly::f14::detail::F14IntrinsicsMode)1>::check()

got me here, so maybe there are some flags that are set wrong. Any idea what that could be? Maybe I'm doing something wrong? I'm lost :(

I'm using mac os big sure 11.5.2
If you need any versions of the software, please, let me know.

@karol-bisztyga
Copy link
Author

Hey!
Any ideas?
I'm including my dependencies' versions:

  • bison: 3.7.6
  • boost: 1_76
  • cmake: 3.21.1
  • flex: 2.6.4
  • openssl: LibreSSL 2.8.3
  • pthreads: ??
  • zlib: 1.2.11
  • fmt: 8.0.1
  • gflags: 2.2.2
  • glog: 0.5.0
  • fizz: 2021.08.02.00_1
  • folly: 2021.08.02.00_1
  • wangle: 2021.08.02.00_1
  • zstd: 1.5.0

@karol-bisztyga karol-bisztyga changed the title Linker error: Undefined symbols for architecture Linker error: Undefined symbols for architecture, problem with folly Aug 24, 2021
Copy link
Contributor

Most of these undefined references are from other fbthrift libs like libconcurrency.a and libtranport.a by example. These are also part of fbthrift, so you will need to target them too.

@karol-bisztyga
Copy link
Author

karol-bisztyga commented Sep 1, 2021

Copy link
Contributor

@Revaj I added those libs and still get the same results
karol-bisztyga/fbthrift-test@710183c#diff-1e7de1ae2d059d21e1dd75d5812d5a34b0222cef273b7c3a2af62eb747f9d20aR62-R83

In your CmakeLists.txt, from 11-24 lines, are targeting only libasync.a, it needs to target the corresponding library like LIBTRANSPORT to transport.

Also, I found when I compiled your example, in target_link_libraries, it requires libthriftmetadata.a. After that, it should compile.

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

No branches or pull requests

2 participants