Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#9599 closed Bug Report - General (Works for me)

OSX Compilation fails

Reported by: l-case@… Owned by: Nigel
Priority: minor Milestone: unknown
Component: Ports - OSX Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no


The latest Build fails with:

[osx-pkg] /usr/bin/make -j3
ld: file not found: /Users/myusername/Documents/mythtv/.osx-packager/build/lib/libmythavformat.dylib for architecture i386
collect2: ld returned 1 exit status
make[2]: *** [libkerneldeint.dylib] Error 1
make[1]: *** [sub-kerneldeint-make_default] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [filters] Error 2
[osx-pkg] Failed system call: " /usr/bin/make -j3 " with error code 2

Attachments (6)

build.txt (9.5 KB) - added by l-case@… 10 years ago.
mythconfig.mak.txt (28.6 KB) - added by l-case@… 10 years ago.
mythconfig.mak-nigel-be.txt (28.8 KB) - added by Nigel 10 years ago.
Nigel's src/mythtv/libs/libmythbase/mythconfig.mak (28.1 KB) - added by l-case@… 10 years ago. (300 bytes) - added by l-case@… 10 years ago.
With this the build works.
configure.diff (852 bytes) - added by Nigel 10 years ago.
Take SHLIBDIR out of install_name

Download all attachments as: .zip

Change History (17)

Changed 10 years ago by l-case@…

Attachment: build.txt added

comment:1 Changed 10 years ago by Nigel

Resolution: Works for me
Status: newclosed

My suspicion is that /Users/myusername/Documents/mythtv/.osx-packager/build/lib/libmythavformat.dylib is a bad file - either empty, or PPC. Try this:

file /Users/myusername/Documents/mythtv/.osx-packager/build/lib/libmythavformat.dylib

and report back what it says? It should say:

% file /Users/myusername/Documents/mythtv/.osx-packager/build/lib/libmythavformat.dylib
/Users/myusername/Documents/mythtv/.osx-packager/build/lib/libmythavformat.dylib: Mach-O dynamically linked shared library i386

A purge of all the built .dylibs, or a --clean, might be in order. The former would be:

find src/mythtv -name \*.dylib -delete

comment:2 Changed 10 years ago by l-case@…

I tried all, but the file is not there. It gets not copied/installed. I have Xcode 4 installed, could this be the problem. 1 month before i could compile all. I have attached a config.mak, could you compare it with yours?

Changed 10 years ago by l-case@…

Attachment: mythconfig.mak.txt added

Changed 10 years ago by Nigel

Attachment: mythconfig.mak-nigel-be.txt added

Nigel's src/mythtv/libs/libmythbase/mythconfig.mak

comment:3 Changed 10 years ago by Nigel

After editing the build paths to be the same, most of the diffs are due to backend vs frontend, Core Duo vs Core 2 Duo, and GIT head vs 0.24? I still use XCode 3.2.4, but any compiler differences should be very minor.
I think the only way for me to work this out is to do a -distclean, and then attach a full build log. e.g.: --distclean --verbose | tee fullbuild.txt

comment:4 Changed 10 years ago by l-case@…

Here is the fullbuild.txt

Changed 10 years ago by l-case@…

Attachment: added

comment:5 Changed 10 years ago by JYA

Got it to compile.

Here is what I did..

ran : ./git/packaging/OSX/build/ -debug -srcdir=/Users/jeanyves_avenard/Work/mythtv/git -force -verbose -m32

this failed with the error above. Went into the folder: .osx-packager/src/myth-git/mythtv ran the command: find . -name "libmyth*.dylib" -exec cp {} ~/Work/mythtv/.osx-packager/build/lib/ \; -print to install the .dylib files in the build folder

Edited the script and commented line 777:

#&Syscall([ '/bin/rm', @mythlibs ]) or die;

so it wouldn't delete the libmyth file from the build directory

Re-ran with -noclean -nohead

comment:6 Changed 10 years ago by Nigel

Peter, thanks for fullbuild.txt. As Jean-Yves has hinted, it is some sort of sequencing problem.
FFmpeg makes these libraries:

LD      libavutil/libmythavutil.50.dylib
LD      libavcore/libmythavcore.0.dylib
LD      libavcodec/libmythavcodec.52.dylib
LD      libavformat/libmythavformat.52.dylib
LD      libswscale/libmythswscale.0.dylib
LD      libpostproc/libmythpostproc.51.dylib
LD      libavdevice/libmythavdevice.52.dylib
LD      libavfilter/libmythavfilter.1.dylib

but not the install lib file names that MythTV expects (i.e. there is no libmythavformat.dylib in ../../external/FFmpeg/libav*). If I turn FFmpeg verbose building on:

% git diff Makefile
diff --git a/mythtv/Makefile b/mythtv/Makefile
index 4de0ae1..cf7ae49 100644
--- a/mythtv/Makefile
+++ b/mythtv/Makefile
@@ -61,7 +61,7 @@ $(addsuffix /Makefile,$(QT_SUBDIRS)): %/Makefile :
        cd $*; $(QMAKE) QMAKE=$(QMAKE) -o $(@F) $(<F)
 $(SUBDIRS): $(addsuffix /Makefile,$(SUBDIRS)) libs/libmythbase/version.h
-       $(MAKE) -C $@
+       $(MAKE) -C $@ V=YES  # Verbose building
 $(addsuffix _clean,$(SUBDIRS)): $(addsuffix /Makefile,$(SUBDIRS))
        $(MAKE) -C $(subst _clean,,$@) clean

then it both creates the dylibs, and creates the links for me:

% ./ --enable-backend --verbose
cd ./libavcodec/ && ln -sf libmythavcodec.52.dylib libmythavcodec.dylib
gcc -dynamiclib -Wl,-single_module -Wl,-install_name,/Volumes/Backups/MythTV/.osx-packager/build/lib/libmythavformat.dylib...
cd ./libavformat/ && ln -sf libmythavformat.52.dylib libmythavformat.dylib

so I am still at a loss. Perhaps make that same verbose mod and attach a fresh fullbuild.txt?

comment:7 Changed 10 years ago by JYA

Nigel. libmythavformat and other libmythav* are present for me in the external/FFmpeg/libav* folder. That's not the problem

The issue is that when linking the main apps, it is trying to link against libmythavformat in the .osx-packager/build/lib directory rather than the one in externel/FFmpeg. This libraries haven't been copied to build/lib yet at this point of the compilation.

Once you've successfully built once, and provided you do not delete libmyth* in build/lib ; then everything works okay.

comment:8 Changed 10 years ago by nigel@…

Not sure about apps - the errors I have seen for for filters/kerneldeint?
For you guys, linking the filters seems to be using something that refers to */.osx-packager/build/lib, but as far as I can tell, that shouldn't happen. My HEAD .pro/Makefiles on 10.6.5 Core Duo do this:

% cd src/mythtv/filters/kerneldeint               
% rm -f ../../../../../build/lib/libmyth*
% rm *.dylib
% make
rm -f libkerneldeint.dylib
ccache g++ -headerpad_max_install_names -arch i386 -single_module -dynamiclib -o libkerneldeint.dylib filter_kerneldeint.o    -L../../external/FFmpeg/libavcodec -lmythavcodec -L../../external/FFmpeg/libavcore -lmythavcore -L../../external/FFmpeg/libavutil -lmythavutil -lmyth-0.24 -L../../libs/libmyth -lmythbase-0.24 -L../../libs/libmythbase -lmythui-0.24 -L../../libs/libmythui -lmythupnp-0.24 -L../../libs/libmythupnp

i.e. no refs to the installed library directory there. Perhaps something in your environments?

Changed 10 years ago by l-case@…

Attachment: added

With this the build works.

comment:9 Changed 10 years ago by l-case@…

I have attached a litte shell script. With this the build works, but's a hack.

comment:10 Changed 10 years ago by Nigel

OK. I still don't know why it is only a problem on 10.5, but on 10.6 if I do a distclean and then half a full build (i.e. control-C after it has created FFmpeg + myth libs) and examine the libs:

% cd src/mythtv
% find . -name \*.dylib -exec otool -L {} \;
	/Volumes/Backups/MythTV/.osx-packager/build/lib/libmythavcodec.dylib (compatibility version 52.0.0, current version 52.86.1)
	/Volumes/Backups/MythTV/.osx-packager/build/lib/libmythavutil.dylib (compatibility version 50.0.0, current version 50.24.0)
	/Volumes/Backups/MythTV/.osx-packager/build/lib/libmythavcore.dylib (compatibility version 0.0.0, current version 0.6.0)
	/Volumes/Backups/MythTV/.osx-packager/build/lib/libmp3lame.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.1)
	/Volumes/Backups/MythTV/.osx-packager/build/lib/libfreetype.6.dylib (compatibility version 10.0.0, current version 10.8.0)
	/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
	/usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.5)
% ls /Volumes/Backups/MythTV/.osx-packager/build/lib/libmythavcodec.dylib
ls: /Volumes/Backups/MythTV/.osx-packager/build/lib/libmythavcodec.dylib: No such file or directory

it reveals the problem. The FFmpeg libraries have references to the future install path!
Their makefiles use stuff like:


which I think is causing the problem. Fixes? 1) change our top-level makefile to make and install FFmpeg before making everything else, or 2) change configure:

% git diff configure
diff --git a/mythtv/configure b/mythtv/configure
index 44d8c0b..d7b9beb 100755
--- a/mythtv/configure
+++ b/mythtv/configure
@@ -3079,8 +3079,8 @@ EOF
         disable x11
         # Workaround compile errors from missing gmtime_r/localtime_r/uint def
         CFLAGS=`echo $CFLAGS | sed 's/-D_POSIX_C_SOURCE=200112//'`
+        SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress'
         ###### Standard ffmpeg configure stuff follows:
-        SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress'
         strip="${strip} -x"
         add_ldflags -Wl,-dynamic,-search_paths_first

Can a few others check that fixes the 10.5 link problem?

Last edited 10 years ago by Nigel (previous) (diff)

comment:11 Changed 10 years ago by l-case@…

Can you send me diff as file? in the ticket seem to get something lost.

Changed 10 years ago by Nigel

Attachment: configure.diff added

Take SHLIBDIR out of install_name

Note: See TracTickets for help on using tickets.