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

[clang64] [SoX] undefined pthread symbols referenced by FLAC #2730

Closed
L4cache opened this issue Jul 4, 2024 · 6 comments
Closed

[clang64] [SoX] undefined pthread symbols referenced by FLAC #2730

L4cache opened this issue Jul 4, 2024 · 6 comments

Comments

@L4cache
Copy link
Contributor

L4cache commented Jul 4, 2024

Mingw64 environment don't have this problem.
If I add -lpthread to flac.pc Libs.private then the problem is seemingly solved.

  CCLD     sox.exe
ld.lld: error: undefined symbol: pthread_mutex_lock
>>> referenced by libFLAC.a(stream_encoder.c.o):(FLAC__stream_encoder_finish)
>>> referenced by libFLAC.a(stream_encoder.c.o):(FLAC__stream_encoder_finish)
>>> referenced by libFLAC.a(stream_encoder.c.o):(FLAC__stream_encoder_finish)
>>> referenced 14 more times

ld.lld: error: undefined symbol: pthread_cond_broadcast
>>> referenced by libFLAC.a(stream_encoder.c.o):(FLAC__stream_encoder_finish)
>>> referenced by libFLAC.a(stream_encoder.c.o):(FLAC__stream_encoder_finish)

logs.zip.txt
(I don't know why github won't let me upload zip files...)

@L4cache
Copy link
Contributor Author

L4cache commented Jul 4, 2024

This is probably "introduced" by the migration from autotools to cmake.
But other things that link against FLAC don't seem to have this problem, such as opusenc.

@L4cache L4cache changed the title [clang64] [SoX] undefined pthread symbols [clang64] [SoX] undefined pthread symbols referenced by FLAC Jul 4, 2024
@1480c1
Copy link
Member

1480c1 commented Jul 17, 2024

51a5995

@1480c1 1480c1 closed this as completed Jul 17, 2024
@1480c1
Copy link
Member

1480c1 commented Jul 17, 2024

Possibly the other projects have something else that links pthread for flac, that's my current guess

@L4cache
Copy link
Contributor Author

L4cache commented Jul 17, 2024

Possibly the other projects have something else that links pthread for flac, that's my current guess

That can explain why other tools built successfully in this case, but can't explain the bigger mistery:
Autotools-built flac don't have -lpthread in flac.pc too and in the same environment I tested and same SoX code would successfully built.
And the difference (successful or not) between mingw64 and clang64 is also... mind-blowing?

@1480c1
Copy link
Member

1480c1 commented Jul 17, 2024

mingw-w64 gcc implicitly always links pthreads due to needing pthread for some base libraries or something like that

@L4cache
Copy link
Contributor Author

L4cache commented Jul 17, 2024

Wow thanks, that's one more mystery solved.
(shame for my lack of knowledge)

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