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

MacOS ARM64 build error: symbol fdopen is duplicated defined #4586

Closed
JackyWoo opened this issue Jun 15, 2024 · 7 comments · Fixed by #4587
Closed

MacOS ARM64 build error: symbol fdopen is duplicated defined #4586

JackyWoo opened this issue Jun 15, 2024 · 7 comments · Fixed by #4587
Assignees
Labels

Comments

@JackyWoo
Copy link
Contributor

JackyWoo commented Jun 15, 2024

Describe the bug
Env: MacOS 14.4.1 ARM64 clang 18, build project with cmake.

symbol fdopen is duplicated defined.

In file included from /Users/wujianchao5/project/jd/poco/Foundation/src/zutil.c:10:
In file included from /Users/wujianchao5/project/jd/poco/Foundation/src/gzguts.h:21:
/Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/include/stdio.h:220:7: error: expected identifier or '('
  220 | FILE    *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fdopen));
      |          ^
/Users/wujianchao5/project/jd/poco/Foundation/src/zutil.h:147:33: note: expanded from macro 'fdopen'
  147 | #        define fdopen(fd,mode) NULL /* No fdopen() */
      |                                 ^
/opt/homebrew/Cellar/llvm/18.1.6/lib/clang/18/include/__stddef_null.h:26:16: note: expanded from macro 'NULL'
   26 | #define NULL ((void*)0)
      |                ^
In file included from /Users/wujianchao5/project/jd/poco/Foundation/src/zutil.c:10:
In file included from /Users/wujianchao5/project/jd/poco/Foundation/src/gzguts.h:21:
/Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/include/stdio.h:220:7: error: expected ')'
/Users/wujianchao5/project/jd/poco/Foundation/src/zutil.h:147:33: note: expanded from macro 'fdopen'
  147 | #        define fdopen(fd,mode) NULL /* No fdopen() */
      |                                 ^
/opt/homebrew/Cellar/llvm/18.1.6/lib/clang/18/include/__stddef_null.h:26:16: note: expanded from macro 'NULL'
   26 | #define NULL ((void*)0)
@JackyWoo JackyWoo added the bug label Jun 15, 2024
@JackyWoo JackyWoo changed the title MacOS ARM64 build error: symbol fdopen is duplicated MacOS ARM64 build error: symbol fdopen is duplicated defined Jun 15, 2024
@andrewauclair
Copy link
Contributor

Looks like this is also zlib. You could try setting POCO_UNBUNDLED and provide your own version of zlib and use the latest available from their repo to see if it solves the issue.

@JackyWoo
Copy link
Contributor Author

JackyWoo commented Jun 16, 2024

@andrewauclair thanks for your suggestion. I tried to build zlib in my Mac and it successed. So I suggest to update zlib version in Poco. What do you think.

/cc @aleks-f

@matejk
Copy link
Contributor

matejk commented Jun 17, 2024

Automated compile and testrun actions on GitHub (M1 MacOS 14.5, Apple clang version 15.0.0 (clang-1500.3.9.4) complete just fine just fine.

https://github.com/pocoproject/poco/actions/runs/9463808045/job/26069810114

I also just tested again the code from branch 1.13.3 on my M1 MacBook Pro and did not see any issues that you report.

@matejk
Copy link
Contributor

matejk commented Jun 17, 2024

Where did you install clang 18 from?

Latest XCode 15.4 installs clang 15.

@JackyWoo
Copy link
Contributor Author

JackyWoo commented Jun 17, 2024

I use regular clang but not apple clang. I installed it by brew install llvm@18.

@matejk
Copy link
Contributor

matejk commented Jun 17, 2024

I recommend to switch to clang provided by XCode.

@JackyWoo
Copy link
Contributor Author

Thanks.
Actually I use Poco in my project RaftKeeper as a git submodule and RaftKeeper only support regular clang.
I think maybe others may have the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants