﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
3378	Macport OM Install fails	Adam Dershowitz	Martin Sjölund	"OM is now successfully building again on Hudson.  But, when I tried to install r475, it compiles, but then macports reports an error.  The end of the install shows up like this:

{{{
--->  Found 7 broken file(s), matching files to ports    
--->  Found 1 broken port(s), determining rebuild order
--->  Rebuilding in order
     openmodelica-devel @1.9.3~dev-475-gb6f222e +gfortran48+libraries+modelica3d+omnotebook+qt+sundials
--->  Computing dependencies for openmodelica-devel
--->  Fetching distfiles for openmodelica-devel
--->  Verifying checksums for openmodelica-devel
--->  Extracting openmodelica-devel
--->  Configuring openmodelica-devel
--->  Building openmodelica-devel
--->  Staging openmodelica-devel into destroot
--->  Deactivating openmodelica-devel @1.9.3~dev-475-gb6f222e_0+gfortran48+libraries+modelica3d+omnotebook+qt+sundials
--->  Cleaning openmodelica-devel
--->  Uninstalling openmodelica-devel @1.9.3~dev-475-gb6f222e_0+gfortran48+libraries+modelica3d+omnotebook+qt+sundials
--->  Cleaning openmodelica-devel
--->  Computing dependencies for openmodelica-devel
--->  Installing openmodelica-devel @1.9.3~dev-475-gb6f222e_0+gfortran48+libraries+modelica3d+omnotebook+qt+sundials
--->  Activating openmodelica-devel @1.9.3~dev-475-gb6f222e_0+gfortran48+libraries+modelica3d+omnotebook+qt+sundials
--->  Cleaning openmodelica-devel
--->  Updating database of binaries
--->  Scanning binaries for linking errors
--->  Found 7 broken file(s), matching files to ports    
Error: Port openmodelica-devel is still broken after rebuilding it more than 3 times.
Error: Please run port -d -y rev-upgrade and use the output to report a bug.
Port openmodelica-devel still broken after rebuilding 3 time(s)
    while executing
""error ""Port $portname still broken after rebuilding [expr {$broken_port_counts($portname) - 1}] time(s)""""
    (procedure ""revupgrade_scanandrebuild"" line 280)
    invoked from within
""revupgrade_scanandrebuild broken_port_counts $opts""
    (procedure ""macports::revupgrade"" line 5)
    invoked from within
""macports::revupgrade $opts""
    (procedure ""action_revupgrade"" line 2)
    invoked from within
""action_revupgrade $action $portlist $opts""
    (procedure ""action_target"" line 96)
    invoked from within
""$action_proc $action $portlist [array get global_options]""
    (procedure ""process_cmd"" line 103)
    invoked from within
""process_cmd $remaining_args""
    invoked from within
""if { [llength $remaining_args] > 0 } {

    # If there are remaining arguments, process those as a command
    set exit_status [process_cmd $remaining...""
    (file ""/opt/local/bin/port"" line 5268)

}}}

I have run the suggested command and will attach that log file.

I believe that the problem is that several dynamic libraries are being installed in the correct locations, but then the path, encoded in the binaries, are the temporary build directories used by macport, instead of the install location.  
Specically: libModelicaExternalC.0.dylib,libqjson.0.dylib and libcoinmumps.1.dylib
So, for example, OMEdit tries to use this:

{{{
/opt/local/var/macports/build/_opt_local_var_macports_sources_build.openmodelica.org_macports_lang_openmodelica-devel/openmodelica-devel/work/openmodelica_1.9.3~dev-475-gb6f222e/build/lib/x86_64-darwin14.3.0/omc/libModelicaExternalC.0.dylib
}}}

When that library is installed, correctly, here:

{{{
/opt/local/lib/x86_64-darwin14.3.0/omc/libModelicaExternalC.0.dylib
}}}
And, the binary should just use rpath, as it does for most libraries.

If I manually correct OMEdit and libOpenModelicaCompiler.dylib to the correct search paths, using install_name_tool, I can get OMEdit to run.  And some models then simulate fine, while for others the binary model itself still searches in the build location for libModelicaExternalC.0.dylib, so the model itself has to be manually corrected as well, to run.  "	defect	closed	high	1.9.4	Build Environment	trunk	fixed		
