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

When linking with this depended on, LD fails. #1

Closed
zeyonaut opened this issue Mar 25, 2016 · 10 comments
Closed

When linking with this depended on, LD fails. #1

zeyonaut opened this issue Mar 25, 2016 · 10 comments

Comments

@zeyonaut
Copy link

ld: unknown option: -pthread
clang: error: linker command failed with exit code 1 (use -v to see invocation)
--- errorlevel 1

That's what happens on my MBA 2013 running OS X 10.11.2.
Here's my LD version.

ld -v
@(#)PROGRAM:ld  PROJECT:ld64-253.9
configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em (tvOS)
LTO support using: Apple LLVM 7.0.2 (clang-700.1.81)

I did some research. Apparently pthread is not supported everywhere. It is hard to find info on. Perhaps that is true for OS X too?

This only happens when depending on ffmpeg-d.

@ljubobratovicrelja
Copy link
Owner

If you try to compile and link c++ program that uses and links to ffmpeg libraries, does the same happen? Also, was the ffmpeg compiled with clang, or maybe gcc? I don't know if gcc is supported anymore on the OSX, but could you maybe try co compile ffmpeg 2.7.6 with gcc, then try the same?

@zeyonaut
Copy link
Author

I can't remember what ffmpeg was compiled with, it was just the configure, make, and make install. With clang, building a c++ project with ffmpeg's libraries linked works as expected. Only d has this problem.

@rljubobratovic
Copy link

I'm not really sure what could be the problem here. I would gladly try to solve this, but I'd have to set up a virtual machine to do it, and since I'm short of spare time, I fear It could take me a long time to do it. The only thing I suggest is to try to build ffmpeg with gcc if possible, and then try to link it in D program. Although that is only a guess, since I know really nothing about the DMD for OS X. Anyway, if building it with gcc doesn't cut it, I think we should go on D forums with this. I suppose this problem is strongly related to the OS X platform itself (or maybe clang), so I believe more experienced people could help here. Do you agree?

@zeyonaut
Copy link
Author

Sure. I'll compile it one more time and ask somewhere else. Thanks for your help.

@ljubobratovicrelja
Copy link
Owner

Great! Thank you as well, for bringing this issue up! Could I ask you to leave a notification here about your findings on this issue afterwards? If this problem is, as I suspect, matter of system configuration, and not the library itself, then other people will cross it in future for sure...

@zeyonaut
Copy link
Author

Alright, I found an answer. I don't know if this is intended, but I had to run (while building ffmpeg) ./configure --disable-pthreads. That fixed it, at least for now. I'm not sure if it's supposed to run without threads. Furthermore, ./configure --help shows disable pthreads [autodetect] which seems to indicate that it's meant to be detected automatically, which is strange.

I'm not sure if this is the end of it. I'll keep you posted if I find another solution or something else happens. For now, I'll be testing some code first just to make sure things work fine.

@ljubobratovicrelja
Copy link
Owner

That's great, and thanks for the info! Although, I also feel that this is not a long term fix. But anyways, I hope it works for you for now. Cheers!

@zeyonaut
Copy link
Author

Although I couldn't get this to work through installing FFMPEG manually, I could by installing it through Homebrew.

I think this thread should be closed, because it is more of an issue with dmd linking. Perhaps a tip could be left in the README instead.

  • Aaron.

@ljubobratovicrelja
Copy link
Owner

Awesome- Thanks, Aaron! Will close the issue as soon as I update the README as you've suggested.

Cheers!

@carun
Copy link

carun commented Dec 2, 2017

Linker issue is visible on Ubuntu 17.10. Apparently this occurs because I didn't build FFmpeg from source, but I use the one that comes with the distro by default. Just had to install the following packages to solve this issue (sudo apt install <package>).

libavcodec-dev
libavformat-dev
libavdevice-dev
libavfilter-dev
libavutil-dev
libswscale-dev

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

4 participants