Opened 13 years ago

Closed 13 years ago

#33465 closed defect (fixed)

vtk5 +qt4_mac build fails (vtk build with --python upstream bug)

Reported by: v.favrenicolin@… Owned by: adfernandes (Andrew Fernandes)
Priority: Normal Milestone:
Component: ports Version: 2.0.4
Keywords: vtk5 python Cc:
Port: vtk5

Description (last modified by ryandesign (Ryan Carsten Schmidt))

There is a bug in VTK 5.8.0 which fails to build with python bindings:

The relevant error is (see also attached last 500 lines of clean build):

[...]
:info:build ld: file not found: /opt/local/lib/vtk-5.8/libvtkDICOMParser.5.8.dylib for architecture x86_64
:info:build clang: error: linker command failed with exit code 1 (use -v to see invocation)
[...]

It is apparently due to en error in the build order, and there is a known workaround, see :
http://web.archiveorange.com/archive/v/aysypnkvYPYzSAJ2f5kA
https://github.com/mxcl/homebrew/pull/9796
https://github.com/sorin-ionescu/homebrew/commit/21571448b2bd0c810b495579dc2e00da7ea8f0e4

Any chance the patch could make it in macports ?

Vincent

Attachments (3)

vtk-build-last500.log (248.3 KB) - added by v.favrenicolin@… 13 years ago.
vtk5 build log (sudo port install vtk5 +qt4_mac)
Portfile (8.9 KB) - added by v.favrenicolin@… 13 years ago.
Working portfile with a workaround kludge
vtk5-python.patch (4.7 KB) - added by seanfarley (Sean Farley) 13 years ago.
patch to fix the upstream bug of incorrect library search directories and also add all compatible python variants

Download all attachments as: .zip

Change History (14)

Changed 13 years ago by v.favrenicolin@…

Attachment: vtk-build-last500.log added

vtk5 build log (sudo port install vtk5 +qt4_mac)

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

Description: modified (diff)
Owner: changed from macports-tickets@… to adfernandes@…

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

Description: modified (diff)

comment:3 Changed 13 years ago by adfernandes (Andrew Fernandes)

Hmm... googling around (and seeing #33490) this has the bad smell of a parallel-build bug.

Could you please try building with

sudo port install vtk5 +qt4_mac build.jobs=1

in the Portfile?

Thanks for doing the background digging on this, too, by the way!

comment:4 Changed 13 years ago by v.favrenicolin@…

Trying:

 sudo port install vtk5 +qt4_mac build.jobs=1

Does not make a difference (of course, this times it finishes with the error). Last lines are :

:info:build /usr/bin/clang++   -pipe -O2 -arch x86_64   -O3 -DNDEBUG -arch x86_64 -Wl,-search_paths_first -Wl,-headerpad_max_install_names  -L/opt/local/lib -arch x86_64  -flat_namespace -undefined suppress -u _PyMac_Error CMakeFiles/vtkpython.dir/vtkPythonAppInit.cxx.o  -o ../../bin/vtkpython  -lpthread /opt/local/lib/libpython2.7.dylib ../../bin/libvtksys.5.8.0.dylib ../../bin/libvtkCommon.5.8.0.dylib ../../bin/libvtkFiltering.5.8.0.dylib ../../bin/libvtkIO.5.8.0.dylib ../../bin/libvtkGraphics.5.8.0.dylib ../../bin/libvtkImaging.5.8.0.dylib /usr/lib/libutil.dylib ../../bin/libvtkRendering.5.8.0.dylib ../../bin/libvtkVolumeRendering.5.8.0.dylib ../../bin/libvtkHybrid.5.8.0.dylib ../../bin/libvtkWidgets.5.8.0.dylib ../../bin/libvtkCharts.5.8.0.dylib ../../bin/libvtkGeovis.5.8.0.dylib ../../bin/libvtkInfovis.5.8.0.dylib ../../bin/libvtkViews.5.8.0.dylib ../../bin/libvtkInfovis.5.8.0.dylib ../../bin/libvtkWidgets.5.8.0.dylib ../../bin/libvtkVolumeRendering.5.8.0.dylib ../../bin/libvtkHybrid.5.8.0.dylib ../../bin/libvtkRendering.5.8.0.dylib ../../bin/libvtkIO.5.8.0.dylib ../../bin/libvtkGraphics.5.8.0.dylib ../../bin/libvtkImaging.5.8.0.dylib ../../bin/libvtkFiltering.5.8.0.dylib ../../bin/libvtkCommon.5.8.0.dylib ../../bin/libvtksys.5.8.0.dylib /opt/local/lib/libQtGui.dylib /opt/local/lib/libQtSql.dylib /opt/local/lib/libQtCore.dylib -lobjc -lm -lpthread /opt/local/lib/libpython2.7.dylib /usr/lib/libutil.dylib
:info:build ld: file not found: /opt/local/lib/vtk-5.8/libvtkDICOMParser.5.8.dylib for architecture x86_64
:info:build clang: error: linker command failed with exit code 1 (use -v to see invocation)
:info:build make[2]: *** [bin/vtkpython] Error 1
: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/VTK'
:info:build make[1]: *** [Wrapping/Python/CMakeFiles/vtkpython.dir/all] Error 2
: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/VTK'
: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/VTK'
:info:build shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_vtk5/vtk5/work/VTK" && /usr/bin/make -w all " returned error 2
:error:build Target org.macports.build returned: shell command failed (see log for details)
:debug:build Backtrace: shell command failed (see log for details)
    while executing
"command_exec build"
    (procedure "portbuild::build_main" line 8)
    invoked from within
"$procedure $targetname"
:info:build Warning: the following items did not execute (for vtk5): org.macports.activate org.macports.build org.macports.destroot org.macports.install
:notice:build Log for vtk5 is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_vtk5/vtk5/main.log


Something more strange (?): I tried building the previous version (4.6.8) by dowloading the portfile - but ended up with the same error - which would indicate that the error was triggered by a change outside vtk...

comment:5 Changed 13 years ago by v.favrenicolin@…

Ok, I finally got everything working, by adding the following lines to the port file (yes it is an ugly kludge but it works).

build.asroot yes

pre-build {
	system "rm -Rf /opt/local/lib/vtk-5.8"
	system "ln -sf /opt/local/var/macports/build/_Users_vincent/vtk5/work/VTK/bin/ /opt/local/lib/vtk-5.8"
}

post-build {
	system "rm -f /opt/local/lib/vtk-5.8"
}

I attach the portfile below.

Changed 13 years ago by v.favrenicolin@…

Attachment: Portfile added

Working portfile with a workaround kludge

comment:6 Changed 13 years ago by christophe.saintjean@…

I try the previous fix (Modified Portfile) with the command :

sudo port -o -v install vtk5 +x11 +python27

and the same error occurs ...

By changing the link creation command, it works !!!

system "ln -sf /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_graphics_vtk5/vtk5/work/VTK/bin/ /opt/local/lib/vtk-5.8"

Please provides a general fix.

comment:7 in reply to:  6 Changed 13 years ago by browntroutstream@…

Replying to christophe.saintjean@…:

I try the previous fix (Modified Portfile) with the command :

sudo port -o -v install vtk5 +x11 +python27

and the same error occurs ...

By changing the link creation command, it works !!!

system "ln -sf /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_graphics_vtk5/vtk5/work/VTK/bin/ /opt/local/lib/vtk-5.8"

Please provides a general fix.

So it depends where you put the Portfile that's attached. For example, if you overwrite the main portfile, then I believe your modification (/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_graphics_vtk5/vtk5/work/VTK/bin/) works. However, it appears that Vincent put it in

/Users/vincent/

I put mine in

/Users/myname/ports/graphics/vtk5

which follows the examples here: http://guide.macports.org/chunked/development.local-repositories.html

As a result, I used:

/opt/local/var/macports/build/_Users_myname_ports_graphics_vtk5/vtk5/work/VTK/bin/

in the symbolic link above.

This works fine. So in summary, I used the portfile attached by vincent and changed

	system "ln -sf /opt/local/var/macports/build/_Users_vincent/vtk5/work/VTK/bin/ /opt/local/lib/vtk-5.8"

to

    system "ln -sf /opt/local/var/macports/build/_Users_myname_ports_graphics_vtk5/vtk5/work/VTK/bin/ /opt/local/lib/vtk-5.8"

due to my placement of the Portfile. This should be automated somehow...

comment:8 Changed 13 years ago by v.favrenicolin@…

Yes I guess you have to use portfile variables like ${worksrcpath}, ${destroot}, ${name}, ... Not sure about their exact definition, so I could not write a general correct Portfile.

comment:9 in reply to:  8 Changed 13 years ago by browntroutstream@…

Replying to v.favrenicolin@…:

Yes I guess you have to use portfile variables like ${worksrcpath}, ${destroot}, ${name}, ... Not sure about their exact definition, so I could not write a general correct Portfile.

I think it's ${portpath} [1]

Nice mods to the Portfile, btw. The other workarounds were not as clear.

[1] http://guide.macports.org/chunked/reference.variables.html

Changed 13 years ago by seanfarley (Sean Farley)

Attachment: vtk5-python.patch added

patch to fix the upstream bug of incorrect library search directories and also add all compatible python variants

comment:10 Changed 13 years ago by seanfarley (Sean Farley)

The patch I just sent fixes vtk5's build issues (#33490 and #33465) with python by adding variants robustly (just like boost) and fixing the library search path based on Shinko's suggestion. This is still a hack but at least it doesn't do any funky linking outside the build tree. The proper fix needs to come from upstream (Kitware) by fixing their cmake variables for the python wrapping, though, this patch makes it work for now.

comment:11 Changed 13 years ago by adfernandes (Andrew Fernandes)

Resolution: fixed
Status: newclosed

Committed in r90726. Thanks!

Note: See TracTickets for help on using tickets.