Opened 11 years ago

Closed 11 years ago

#41382 closed defect (fixed)

libQGLViewer example fails to link when building universal

Reported by: dv30fps-macosx@… Owned by: raphael-st (Raphael Straub)
Priority: Normal Milestone:
Component: ports Version: 2.2.1
Keywords: Cc: michaelld (Michael Dickens)
Port: libQGLViewer

Description

After the fix for ticket #41358, libQGLViewer.dylib builds successfully for x86_64, but the link of the example program called animation fails. libQGLViewer.dylib is built for x86_64 only and the example program is trying to link i386.

:info:build /usr/bin/clang++ -headerpad_max_install_names -arch x86_64 -arch i386 -Xarch_x86_64 -mmacosx-version-min=10.8 -o animation.app/Contents/MacOS/animation .obj/animation.o .obj/main.o   -F/opt/local/Library/Frameworks -F/opt/local/lib  -L/opt/local/lib -lQGLViewer -framework OpenGL -framework AGL -F/opt/local/Library/Frameworks -F/opt/local/lib -framework QtXml -framework QtCore -framework QtOpenGL -framework QtGui 
:info:build ld: warning: ignoring file /opt/local/lib/libQGLViewer.dylib, file was built for x86_64 which is not the architecture being linked (i386): /opt/local/lib/libQGLViewer.dylib
:info:build Undefined symbols for architecture i386:
:info:build   "QGLViewer::closeEvent(QCloseEvent*)", referenced from:
:info:build       vtable for Viewer in animation.o
:info:build   "QGLViewer::setPathKey(int, int)", referenced from:
:info:build       vtable for Viewer in animation.o
:info:build   "QGLViewer::timerEvent(QTimerEvent*)", referenced from:
:info:build       vtable for Viewer in animation.o
:info:build   "QGLViewer::wheelEvent(QWheelEvent*)", referenced from:
:info:build       vtable for Viewer in animation.o
...
:info:build ld: symbol(s) not found for architecture i386
:info:build clang: error: linker command failed with exit code 1 (use -v to see invocation)
:info:build make[2]: *** [animation.app/Contents/MacOS/animation] 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_libQGLViewer/libQGLViewer/work/libQGLViewer-2.4.0/examples/animation'
:info:build make[1]: *** [sub-animation-all] Error 2

Attachments (1)

main.log (68.9 KB) - added by dv30fps-macosx@… 11 years ago.
Log file of libQGLViewer after clean and install build.

Download all attachments as: .zip

Change History (4)

Changed 11 years ago by dv30fps-macosx@…

Attachment: main.log added

Log file of libQGLViewer after clean and install build.

comment:1 Changed 11 years ago by raphael-st (Raphael Straub)

Cc: michaelld@… added; raphael@… removed
Owner: changed from macports-tickets@… to raphael@…
Status: newassigned
Summary: libQGLViewer example fails to linklibQGLViewer example fails to link when building universal

You are trying to build the universal variant. The non-universal build works for me and also on the BuildBot.

Your main.log shows that for every call to clang++ the architecture specific options

-arch x86_64 -arch i386 -Xarch_x86_64

are used and the -Xarch_x86_64 option probably comes from QMake. I guess that either this option should be removed or that the option -Xarch_i386 should be added.

Michael, do you have any idea how to fix this?

comment:2 Changed 11 years ago by michaelld (Michael Dickens)

It's trying to link to an already-installed /opt/local/lib/libQGLViewer.dylib, which was built for just x86_64. Try adding the following to the Portfile:

configure.cppflags-delete -I/opt/local/include
configure.ldflags-delete -L/opt/local/lib

and see if that helps.

comment:3 in reply to:  2 Changed 11 years ago by raphael-st (Raphael Straub)

Resolution: fixed
Status: assignedclosed
:info:build ld: warning: ignoring file /opt/local/lib/libQGLViewer.dylib, file was built for x86_64 which is not the architecture being linked (i386): /opt/local/lib/libQGLViewer.dylib

Replying to michaelld@…:

It's trying to link to an already-installed /opt/local/lib/libQGLViewer.dylib, which was built for just x86_64.

Ah, sorry, I missed that.

Try adding the following to the Portfile:

configure.cppflags-delete -I/opt/local/include
configure.ldflags-delete -L/opt/local/lib

and see if that helps.

Here, these two lines remove the -L/opt/local/lib before -lQGLViewer in the linker call, so I added these lines to the Portfile in r113512.

dv30fps, please selfupdate, try again to install libQGLViewer and reopen this ticket if you still have the same problem.

Note: See TracTickets for help on using tickets.