# Mac Package , Got error



## getin (Jun 17, 2017)

I run 
python ../CI/install/osx/build_app.py

but there are some errors below

fatal error: /Library/Developer/CommandLineTools/usr/bin/otool: internal objdump command failed

/Library/Developer/CommandLineTools/usr/bin/objdump: 'rundir/RelWithDebInfo/data/libobs/bilinear_lowres_scale.effect': The file was not recognized as a valid object file.

fatal error: /Library/Developer/CommandLineTools/usr/bin/otool: internal objdump command failed

/Library/Developer/CommandLineTools/usr/bin/objdump: 'rundir/RelWithDebInfo/data/libobs/default.effect': The file was not recognized as a valid object file.


and some errors

/Library/Developer/CommandLineTools/usr/bin/objdump: '/Users/bjhl/Qt5.4.0/5.4/clang_64/lib/QtCore.framework/Versions/5/QtCore': No such file or directory.

fatal error: /Library/Developer/CommandLineTools/usr/bin/otool: internal objdump command failed

Traceback (most recent call last):

  File "../CI/install/osx/build_app.py", line 102, in <module>

    universal_newlines=True)

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 573, in check_output

    raise CalledProcessError(retcode, cmd, output=output)

subprocess.CalledProcessError: Command 'otool -L '/Users/bjhl/Qt5.4.0/5.4/clang_64/lib/QtCore.framework/Versions/5/QtCore'' returned non-zero exit status 1


what should I do , I confuse on this for 4 days.
i'v tried macdeployqt command , but it doesn't work also.


----------



## pkv (Jun 17, 2017)

is there a reason for not following the build guide ?
cmake .. && make package does the work on my side


----------



## getin (Jun 17, 2017)

pkv said:


> is there a reason for not following the build guide ?
> cmake .. && make package does the work on my side



thank you for your reply. 
I acturally tried cmake .. && make package , before I run ../CI/install/osx/build_app.py.

I got an obs.app after run cmake .. && make package . but use this way , the dependencies of qt not imported into
the app . for example , the QtCore  , Qt Gui , and so on.
if the dependencies libs not imported into the obs.app, the obs.app copied to another mac laptop without qt environment , the obs.app won't work . 

so that's why i try build_app.py.
do you know , how to get the dependencies of QT into the obs.app ?


----------



## pkv (Jun 17, 2017)

did you set ?
export CMAKE_PREFIX_PATH=/usr/local/Cellar/qt5/5.2.1/lib/cmake (replace with your version of QT if installed with homebrew)


----------



## Narcogen (Jun 18, 2017)

pkv said:


> did you set ?
> export CMAKE_PREFIX_PATH=/usr/local/Cellar/qt5/5.2.1/lib/cmake (replace with your version of QT if installed with homebrew)



I think getin wants to make a portable binary that works regardless of where his installation of Qt is.

Setting the prefix path before doing cmake && make package doesn't seem to do this; if you move that binary to another system where the path to Qt is different, the app does not run.

I've done a few builds according to the official guide. I have to export my Qt path, and when I build the package, people need to have the same version of Qt installed at the same path in order for the binary to work for them.


----------



## pkv (Jun 18, 2017)

Narcogen said:


> I think getin wants to make a portable binary that works regardless of where his installation of Qt is.
> 
> Setting the prefix path before doing cmake && make package doesn't seem to do this; if you move that binary to another system where the path to Qt is different, the app does not run.
> 
> I've done a few builds according to the official guide. I have to export my Qt path, and when I build the package, people need to have the same version of Qt installed at the same path in order for the binary to work for them.



ha ok ! could you share the instructions to do a portable package ? don't know how to do that


----------



## Narcogen (Jun 18, 2017)

pkv said:


> ha ok ! could you share the instructions to do a portable package ? don't know how to do that



I don't know either. If I did, I'd have those up for download instead of the ones I do.


----------



## pkv (Jun 18, 2017)

ok found this script:
https://github.com/dtcooper/obs-studio/blob/build-scripts/build_obs_osx.sh

referenced by its author in this thread: https://obsproject.com/forum/thread...studio-build-bonus-latest-master-build.62625/

The package bundled with deps is built with :

$RUN sudo python ../CI/install/osx/build_app.py
    $RUN packagesbuild ../CI/install/osx/CMakeLists.pkgproj
    $RUN mkdir DMG
    $RUN mv OBS.pkg DMG

    INSTALLER_FILENAME="obs-${GIT_REV}-installer.dmg"
    $RUN hdiutil create -volname "OBS Studio ($GIT_REV)" -srcfolder DMG -ov -format UDZO "$INSTALLER_FILENAME"

    $RUN mv DMG/OBS.pkg .
    $RUN rmdir DMG

    $RUN mv "$INSTALLER_FILENAME" ../..
    $RUN cd ../..

    echo 'Done!'
    echo
    echo "Installer created: $INSTALLER_FILENAME"​
================

In order to build I had to remove refs to the browser from the script which was throwing compilation errors;
for the package, I had also to modify CMakeLists.pkgproj to remove further reference to the browser;
after that, the dmg is built correctly.
When I execute the package, OBS is installed correctly but the package throws me an error message at the end.
Anyway, the app seems to work fine so the error seems innocuous (so far).

BTW, this info could have been recovered from Travis builds used to check the PR.


----------



## getin (Jun 19, 2017)

pkv said:


> ok found this script:
> https://github.com/dtcooper/obs-studio/blob/build-scripts/build_obs_osx.sh
> 
> referenced by its author in this thread: https://obsproject.com/forum/thread...studio-build-bonus-latest-master-build.62625/
> ...




thank you for your reply . but i still fail to package one runnable package of mac.
1. i tried "sh build_obs_osx.sh " above obs-studio folder , I got the error below
Couldn't find CEF build name from Spotify

2. I tried  sudo python ../CI/install/osx/build_app.py in the build folder , it print the errors like my initial post 

fatal error: /Library/Developer/CommandLineTools/usr/bin/otool: internal objdump command failed

/Library/Developer/CommandLineTools/usr/bin/objdump: 'rundir/RelWithDebInfo/data/libobs/default.effect': The file was not recognized as a valid object file.

fatal error: /Library/Developer/CommandLineTools/usr/bin/otool: internal objdump command failed

Traceback (most recent call last):

  File "../CI/install/osx/build_app.py", line 116, in <module>

    universal_newlines=True)

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 573, in check_output

    raise CalledProcessError(retcode, cmd, output=output)

subprocess.CalledProcessError: Command 'otool -L '/Users/bjhl/Qt5.4.0/5.4/clang_64/lib/QtCore.framework/Versions/5/QtCore'' returned non-zero exit status 1

how to fix it. pls help me.


----------



## pkv (Jun 19, 2017)

getin said:


> thank you for your reply . but i still fail to package one runnable package of mac.
> 1. i tried "sh build_obs_osx.sh " above obs-studio folder , I got the error below
> Couldn't find CEF build name from Spotify



edit the script and remove all reference to cef (the browser) ( including lines152 to 181); be sure to set line 199 to no.



getin said:


> 2. I tried  sudo python ../CI/install/osx/build_app.py in the build folder , it print the errors like my initial post


don't know about that; the python script runs fine on my side;
did the compilation work fine ?
for the package creation I had to remove from the script:
$RUN mv rundir/RelWithDebInfo/obs-plugins/CEF.app .
$RUN mv rundir/RelWithDebInfo/obs-plugins/obs-browser.so .
$RUN mv CEF.app ./rundir/RelWithDebInfo/obs-plugins
Then I edited CMakeLists.pkgproj to remove CEF .
Then the script runs fine.


----------



## getin (Jun 24, 2017)

pkv said:


> edit the script and remove all reference to cef (the browser) ( including lines152 to 181); be sure to set line 199 to no.
> 
> 
> don't know about that; the python script runs fine on my side;
> ...


 
thank you , i did as you said. I also remove obsbrowser stuff from obs-studio/plugins/CMakeList.txt . after that , i compile smoothly. but when it prompt me 

"Create DMG installer with bundled dependencies? [Y/n]? Y"

, i chose Yes. then I still got errors below.

"----------"
[100%] Building CXX object UI/CMakeFiles/obs.dir/qrc_obs.cpp.o

[100%] Building CXX object UI/CMakeFiles/obs.dir/obs_autogen/moc_compilation.cpp.o

[100%] Linking CXX executable obs

[100%] Built target obs

Create DMG installer with bundled dependencies? [Y/n]? Y

Checking bin

/Library/Developer/CommandLineTools/usr/bin/objdump: 'rundir/RelWithDebInfo/bin/.gitignore': The file was not recognized as a valid object file.

fatal error: /Library/Developer/CommandLineTools/usr/bin/otool: internal objdump command failed

("'rundir/RelWithDebInfo/bin/libobs-frontend-api.dylib'", "'bin/libobs-frontend-api.dylib'")

("'rundir/RelWithDebInfo/bin/libobs-opengl.so'", "'bin/libobs-opengl.so'")

.......

/Library/Developer/CommandLineTools/usr/bin/objdump: 'rundir/RelWithDebInfo/data/.DS_Store': The end of the file was unexpectedly encountered.

fatal error: /Library/Developer/CommandLineTools/usr/bin/otool: internal objdump command failed

/Library/Developer/CommandLineTools/usr/bin/objdump: 'rundir/RelWithDebInfo/data/.gitignore': The file was not recognized as a valid object file.

fatal error: /Library/Developer/CommandLineTools/usr/bin/otool: internal objdump command failed

/Library/Developer/CommandLineTools/usr/bin/objdump: 'rundir/RelWithDebInfo/data/libobs/bicubic_scale.effect': The file was not recognized as a valid object file.

fatal error: /Library/Developer/CommandLineTools/usr/bin/otool: internal objdump command failed

/Library/Developer/CommandLineTools/usr/bin/objdump: 'rundir/RelWithDebInfo/data/libobs/bilinear_lowres_scale.effect': The file was not recognized as a valid object file.

fatal error: /Library/Developer/CommandLineTools/usr/bin/otool: internal objdump command failed

.....

/Library/Developer/CommandLineTools/usr/bin/objdump: 'rundir/RelWithDebInfo/data/libobs/deinterlace_yadif.effect': The file was not recognized as a valid object file.

fatal error: /Library/Developer/CommandLineTools/usr/bin/otool: internal objdump command failed

/Library/Developer/CommandLineTools/usr/bin/objdump: 'rundir/RelWithDebInfo/data/libobs/deinterlace_yadif_2x.effect': The file was not recognized as a valid object file.

fatal error: /Library/Developer/CommandLineTools/usr/bin/otool: internal objdump command failed

/Library/Developer/CommandLineTools/usr/bin/objdump: 'rundir/RelWithDebInfo/data/libobs/format_conversion.effect': The file was not recognized as a valid object file.

fatal error: /Library/Developer/CommandLineTools/usr/bin/otool: internal objdump command failed

.......

('inspecting', "LibTarget(path='/Users/bjhl/Qt5.4.0/5.4/clang_64/lib/QtCore.framework/Versions/5/QtCore', external=True, copy_as='QtCore')")

('inspecting', "LibTarget(path='/opt/local/lib/libz.1.dylib', external=True, copy_as='libz.1.dylib')")

/Library/Developer/CommandLineTools/usr/bin/objdump: '/opt/local/lib/libz.1.dylib': No such file or directory.

fatal error: /Library/Developer/CommandLineTools/usr/bin/otool: internal objdump command failed

Traceback (most recent call last):

  File "../CI/install/osx/build_app.py", line 116, in <module>

    universal_newlines=True)

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 573, in check_output

    raise CalledProcessError(retcode, cmd, output=output)

subprocess.CalledProcessError: Command 'otool -L '/opt/local/lib/libz.1.dylib'' returned non-zero exit status 1

mv: rename obs-browser.so to ./rundir/RelWithDebInfo/obs-plugins/obs-browser.so: No such file or directory


thank you again, even though i still can not make my mac package


----------



## getin (Jun 25, 2017)

I have resolve my problems . 
I download 
libz.1.dylib from web
and copy them to 
/opt/local/lib folder 
this can resolve the errors above.

I also delete all about obs-browser code below in
obs-studio/plugins/CMakeLists.txt. 

if (BUILD_BROWSER)
        if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/obs-browser/CMakeLists.txt")
            add_subdirectory(obs-browser)
        else()
            message(STATUS "obs-browser submodule not found!  Please fetch submodules.  obs-browser plugin disabled.")
        endif()
    endif()



after that do as @pkv said.

don't care about errors like 
fatal error: /Library/Developer/CommandLineTools/usr/bin/otool: internal objdump command failed


that's it. 
wish this post could help others.
thank @pkv again.


----------

