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

Build failure, undefined reference. #4894

Closed
orbea opened this issue Sep 19, 2017 · 9 comments
Closed

Build failure, undefined reference. #4894

orbea opened this issue Sep 19, 2017 · 9 comments

Comments

@orbea
Copy link
Contributor

orbea commented Sep 19, 2017

mpv version and platform

mpv master (80e3173)
gcc-7.2.0
glibc-2.26
ffmpeg-3.3.4
OS: Slackware64-current

Reproduction steps

Build mpv.

Expected behavior

Build should finish.

Actual behavior

[231/439] Compiling video/image_loader.c
[232/439] Compiling osdep/subprocess.c
[233/439] Compiling osdep/terminal-unix.c
[234/439] Linking build/mpv
[235/439] Compiling video/out/vo_drm.c
/usr/lib64/gcc/x86_64-slackware-linux/7.2.0/../../../../x86_64-slackware-linux/bin/ld: osdep/threads.c.18.o: undefined reference to symbol 'pthread_setname_np@@GLIBC_2.12'
/lib64/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

* Node /tmp/SBo/mpv/build/mpv.def is created more than once. The task generators are:
  1. 'mpv' in /tmp/SBo/mpv
  2. 'mpv' in /tmp/SBo/mpv
If you think that this is an error, set no_errcheck_out on the task instance
Waf: Leaving directory `/tmp/SBo/mpv/build'
Build failed
 -> task in 'mpv' failed with exit status 1 (run with -v to display more information)

Log file

Build log - https://pastebin.com/AESrf805

@orbea
Copy link
Contributor Author

orbea commented Sep 19, 2017

This was caused by a change in waf.

fa145ed65395d6c2c2f15ea54398aa010d91306f is the first bad commit
commit fa145ed65395d6c2c2f15ea54398aa010d91306f
Author: Thomas Nagy <tnagy@waf.io>
Date:   Thu Jan 5 03:44:36 2017 +0100

    Find the order that follows the alphabet

:040000 040000 e389f2f1465c382b8ab22c110e30536ad1cbd041 a9af31df9370f0d2570c7ea4c573e97cfda2e70d M	tests
:040000 040000 2cc8b72af54a9b27999858b5d4c0ab695f6bf7c0 2c22ec114b393c337c22a2fb0f11fa78e73da253 M	waflib

https://github.com/waf-project/waf/commit/fa145ed65395d6c2c2f15ea54398aa010d91306f

@orbea
Copy link
Contributor Author

orbea commented Sep 19, 2017

config.log - https://pastebin.com/6U1ZtvGS

@ita1024
Copy link
Contributor

ita1024 commented Sep 19, 2017

Unless you are the mpv maintainers, please use the waf version that comes with mpv.

In this particular case, mpv has its own version of waflib/extras/syms.py which is for waf 1.9. Either use the one for waf 2.0 or try to make one that will work with both versions, for example:

diff --git a/waftools/syms.py b/waftools/syms.py
index eff35e75a3..271dfe4ad2 100644
--- a/waftools/syms.py
+++ b/waftools/syms.py
@@ -33,7 +33,7 @@ class compile_sym(Task):
             raise WafError('NotImplemented')
 
 @feature('syms')
-@after_method('process_source', 'process_use', 'apply_link', 'process_uselib_local')
+@after_method('process_source', 'process_use', 'apply_link', 'process_uselib_local', 'propagate_uselib_vars')
 def do_the_symbol_stuff(self):
     tsk = self.create_task('compile_sym',
     [self.path.find_node(self.export_symbols_def)],

@orbea
Copy link
Contributor Author

orbea commented Sep 19, 2017

Your patch seems to allow waf-2.0 to finish compiling mpv, thanks! Is this something that should be eventually merged into mpv or was the change in waf incorrect? My build script will clone the mpv master and then the waf master, build waf and use that to build mpv. This has worked well for over a year so I never realized that mpv provided its own waf? However I think my current method is preferable because it will uncover issues like this and I assume that mpv will want to resolve this unless the devs plan to use waf 1.9 for ever? :)

@ita1024
Copy link
Contributor

ita1024 commented Sep 20, 2017

Use the build instructions provided by mpv.

@orbea
Copy link
Contributor Author

orbea commented Sep 20, 2017

Can we please keep this discussion directed towards a solution instead?

@haasn
Copy link
Member

haasn commented Sep 20, 2017

The solution is to use the version of waf that the mpv build scripts depend on.

@haasn haasn closed this as completed Sep 20, 2017
@orbea
Copy link
Contributor Author

orbea commented Sep 20, 2017

That is not a solution, that is a workaround. This will have to be fixed either way eventually, no?

orbea pushed a commit to orbea/mpv that referenced this issue Sep 20, 2017
Thanks to ita1024 for the patch.

Fixes mpv-player#4894
ghost pushed a commit that referenced this issue Sep 22, 2017
Thanks to ita1024 for the patch.

Fixes #4894

Signed-off-by: wm4 <wm4@nowhere>
@avih
Copy link
Member

avih commented Dec 22, 2017

FWIW, with commit c09760d , mpv-build on osx started spawning several identical warnings of:

clang: warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument]

This is seemingly because the final linkage command has several -pthread with this commit, and before it there were none. E.g. linkage after this commit :

runner ['/usr/bin/cc', '-rdynamic', '-pthread', '-pthread', '-fobjc-arc',
'-pthread', '-pthread', '-pthread', '-fobjc-arc', '-rdynamic', '-pthread',
'-pthread', '-pthread', '-pthread', '-Wl,-framework', '-Wl,CoreFoundation',
'-exported_symbols_list', 'mpv.def', 'osdep/main-fn-cocoa.c.19.o',
'audio/aconverter.c.18.o', ....

And for reference the beginning of the linkage command before this commit (no -pthread at the entire command):

runner ['/usr/bin/cc', '-rdynamic', '-exported_symbols_list', 'mpv.def',
'osdep/main-fn-cocoa.c.19.o', 'audio/aconverter.c.18.o',  ....

FWIW, the compile commands did have several -pthread before and after this commit - but doesn't cause warnings.

The warnings can be observed with waf 1.8.12 and waf 2.0.3, and were confirmed on three different systems (@Akemi , @Argon- and myself).

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