Opened 2 years ago

Last modified 2 months ago

#49418 new defect

vtk5: dyld: Library not loaded: /opt/local/lib/vtk-5.10/libvtksys.5.10.dylib

Reported by: leonardo.pires@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.3.4
Keywords: elcapitan sierra highsierra Cc: dershow, b.stadlbauer@…, gideonsimpson, MarcusCalhoun-Lopez (Marcus Calhoun-Lopez), danielta, jbuck1@…, erikdendekker@…, snarkhunter (Steve Langer), starthal (Stephen Albert), ensafi (Alex (Eskandar) Ensafi), Veence (Vincent)
Port: vtk5

Description (last modified by ryandesign (Ryan Schmidt))

I cant compile vtk5 under 10.11.1. Already tried only vtk5, another error happens.

The errors is:

[  8%] Generating vtkGLSLShaderLibrary.h
cd /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_vtk5/vtk5/work/VTK5.10.1/Utilities/MaterialLibrary && ../../bin/ProcessShader /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_vtk5/vtk5/work/VTK5.10.1/Utilities/MaterialLibrary/vtkGLSLShaderLibrary.h vtkShaderGLSL Code GetCode /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_vtk5/vtk5/work/VTK5.10.1/Utilities/MaterialLibrary/GLSLShaders/TestAppVarFrag.glsl /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_vtk5/vtk5/work/VTK5.10.1/Utilities/MaterialLibrary/GLSLShaders/TestVertex.glsl /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_vtk5/vtk5/work/VTK5.10.1/Utilities/MaterialLibrary/GLSLShaders/TestVtkPropertyFrag.glsl /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_vtk5/vtk5/work/VTK5.10.1/Utilities/MaterialLibrary/GLSLShaders/TestMatrixFrag.glsl /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_vtk5/vtk5/work/VTK5.10.1/Utilities/MaterialLibrary/GLSLShaders/TestScalarVectorFrag.glsl /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_vtk5/vtk5/work/VTK5.10.1/Utilities/MaterialLibrary/GLSLShaders/Twisted.glsl
dyld: Library not loaded: /opt/local/lib/vtk-5.10/libvtksys.5.10.dylib
  Referenced from: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_vtk5/vtk5/work/VTK5.10.1/Utilities/MaterialLibrary/../../bin/ProcessShader
  Reason: image not found

The problem is: libvtksys.5.10.dylib isn't at /opt/local/lib but at /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_vtk5/vtk5/work/VTK5.10.1/lib (the temporary dir for building).

Love your ports, guys. Hope to help to get it better!

Attachments (1)

main.log (3.0 MB) - added by gideonsimpson 22 months ago.

Change History (23)

comment:1 Changed 2 years ago by ryandesign (Ryan Schmidt)

  • Description modified (diff)

This needs something like

DYLD_LIBRARY_PATH=${worksrcpath}/lib

somewhere. The port already does:

build.env-append \
    DYLD_LIBRARY_PATH=${worksrcpath}/bin

Maybe the libraries recently moved from bin to lib and this wasn't noticed when upgrading the port because the problem would only be observed on new installations, not upgrades.

comment:2 Changed 2 years ago by ryandesign (Ryan Schmidt)

I have confirmed that the problem exists. However I don't know why, because the library is not in lib; it is in bin, where DYLD_LIBRARY_PATH is already pointing.

vtk5 $ find work/ -name libvtksys.5.10.dylib
work//VTK5.10.1/bin/libvtksys.5.10.dylib

comment:3 Changed 2 years ago by ryandesign (Ryan Schmidt)

  • Keywords elcapitan added
  • Summary changed from Can't compile vtk5 +python27 +qt4_mac under 10.11.1 to vtk5: dyld: Library not loaded: /opt/local/lib/vtk-5.10/libvtksys.5.10.dylib

I think the problem is that as of OS X 10.11 El Capitan, DYLD_* environment variables are not passed to subshells; this is a security measure. I have not examined vtk5's build system closely to see if a subshell is being used, but I assume that must be what's happening. We would then have to see if the subshell can be avoided somehow, or if the DYLD_LIBRARY_PATH environment variable can be set closer to the place where it's actually needed.

comment:4 Changed 2 years ago by dershow

  • Cc dersh@… added

Cc Me!

comment:5 Changed 2 years ago by ryandesign (Ryan Schmidt)

  • Cc b.stadlbauer@… added

Has duplicate #50155.

comment:6 Changed 23 months ago by gideonsimpson

  • Cc gideon.simpson@… added

Cc Me!

comment:7 Changed 23 months ago by gideonsimpson

I'm having trouble building vtk5 +tcltk +x11, and I can see in the log file:

:info:build dyld: Library not loaded: /opt/local/lib/vtk-5.10/libvtksys.5.10.dylib

so maybe it's the sam issue. At the tail of the log file, where it finally gives up, this is what's going on:

:info:build make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_vtk5/vtk5/work/VTK5.10.1'
:info:build [ 14%] Built target vtkCommon
:info:build make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_vtk5/vtk5/work/VTK5.10.1'
:info:build make: *** [all] Error 2
:info:build make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_vtk5/vtk5/work/VTK5.10.1'
:info:build Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_vtk5/vtk5/work/VTK5.10.1" && /usr/bin/make -j4 -w all VERBOSE=ON 
:info:build Exit code: 2
:error:build org.macports.build for port vtk5 returned: command execution failed
:debug:build Error code: CHILDSTATUS 80946 2
:debug:build Backtrace: command execution failed
    while executing
"system -nice 0 $fullcmdstring"
    ("eval" body line 1)
    invoked from within
"eval system $notty $nice \$fullcmdstring"
    invoked from within
"command_exec build"
    (procedure "portbuild::build_main" line 8)
    invoked from within
"portbuild::build_main org.macports.build"
    ("eval" body line 1)
    invoked from within
"eval $procedure $targetname"
:info:build Warning: targets not executed for vtk5: org.macports.activate org.macports.build org.macports.destroot org.macports.install
:error:build Failed to install vtk5
:debug:build Registry error: vtk5 not registered as installed & active.
    invoked from within
"registry_active $subport"
    invoked from within
"$workername eval registry_active \$subport"
:notice:build Please see the log file for port vtk5 for details:
    /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_vtk5/vtk5/main.log
 

comment:8 Changed 23 months ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

  • Cc mcalhoun@… added

Cc Me!

comment:9 Changed 23 months ago by danielta

  • Cc daniele.tartarini@… added

Cc Me!

comment:10 Changed 22 months ago by seanfarley (Sean Farley)

Gideon, please post the full log.

Changed 22 months ago by gideonsimpson

comment:11 Changed 20 months ago by jbuck1@…

  • Cc jbuck1@… added

Cc Me!

comment:12 Changed 20 months ago by jbuck1@…

I am trying to build vtk5.

port install vtk5

but I also get the error

:info:build dyld: Library not loaded: /opt/local/lib/vtk-5.10/libvtksys.5.10.dylib

I can successfully install vtk7 using

port install vtk

but I need vtk5 as a dependency of PCL.

Last edited 20 months ago by jbuck1@… (previous) (diff)

comment:13 Changed 17 months ago by erikdendekker@…

  • Cc erikdendekker@… added

Cc Me!

comment:14 Changed 17 months ago by snarkhunter (Steve Langer)

  • Cc stephen.langer@… added

Cc Me!

comment:15 Changed 17 months ago by snarkhunter (Steve Langer)

I'm seeing the same problem installing vtk5 with no variants. A dialog pops up reading "ProcessShader cannot be opened because of a problem" with an option to report the error to Apple. The error report contains

Dyld Error Message:
  Library not loaded: /opt/local/lib/vtk-5.10/libvtksys.5.10.dylib
  Referenced from: /opt/local/var/macports/*/ProcessShader
  Reason: image not found

comment:16 Changed 17 months ago by snarkhunter (Steve Langer)

For what it's worth, I was able to build vtk5 manually with the tarball from vtk.org, installing it in /usr/local. Unpack it, then uncomment "#define GLX_GLXEXT_LEGACY" in Rendering/vtkXOpenGLRenderWindow.cxx and remove "#define inline" in Utilities/vtktiff/tif_config.h.in. Install the dependencies from macports. Set these values in ccmake:

BUILD_SHARED_LIBS         ON
CMAKE_BUILD_TYPE          Release
CMAKE_CXX_FLAGS           -I/opt/local/include
CMAKE_C_FLAGS             -I/opt/local/include
OPENGL_INCLUDE_DIR        /opt/local/include
OPENGL_gl_LIBRARY         /opt/local/lib/libGL.dylib
OPENGL_glu_LIBRARY        /opt/local/lib/libGLU.dylib
VTK_USE_COCOA             OFF
VTK_USE_X                 ON

and then run "make; sudo make install".

After all that, I still had to put /usr/local/lib/vtk-5.10 in DYLD_LIBRARY_PATH in order to use the libraries.

comment:17 Changed 17 months ago by snarkhunter (Steve Langer)

Running ccmake with the command line argument "-D CMAKE_INSTALL_NAME_DIR:PATH=/usr/local/lib/vtk-5.10" eliminates the need to set DYLD_LIBRARY_PATH in order to link to the libraries.

Does macports introduce subshells into the build process? Why does the ccmake/make/make install process not have the same issue that "port install vtk5" does?

comment:18 Changed 17 months ago by seth.berrier@…

Here's a workaround I've found that allows macports to still do all the work (might be easier for some than building from source manually):

  • Try to build with macports and let it fail
  • Change to the binary working directory:
cd /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_vtk5/vtk5/work/VTK5.10.1/bin
  • Use install_name_tool to change the path to the offending library for the ProcessShader executable
sudo install_name_tool -change /opt/local/lib/vtk-5.10/libvtksys.5.10.dylib @executable_path/libvtksys.5.10.dylib ProcessShader
  • Now, try to install again with macports (don't clean, just let it pick up where it left off)

Near as I can tell, ProcessShader seems to just be a tool used during the build process so you don't need to change it back afterwards. This process of using install_name_tool to change the path to the dynamic lib may a more robust way to address this bug but I leave that up to the macports experts (or the VTK build process maintainers).

comment:19 Changed 11 months ago by starthal (Stephen Albert)

  • Cc starthal added

comment:20 Changed 11 months ago by starthal (Stephen Albert)

Thanks for the workaround; it worked for me under Sierra.

comment:21 Changed 9 months ago by ryandesign (Ryan Schmidt)

  • Cc ensafi added
  • Keywords sierra added

Has duplicate #53749.

comment:22 Changed 2 months ago by ryandesign (Ryan Schmidt)

  • Cc Veence added
  • Keywords highsierra added

Vince, maybe you could see if you can fix this, since it prevents your port libpcl from being installed on El Capitan or later?

Note: See TracTickets for help on using tickets.