Opened 11 years ago

Closed 11 years ago

#40531 closed defect (fixed)

codeblocks: universal variant fails when non-universal codeblocks is already installed

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: mojca (Mojca Miklavec)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: codeblocks

Description

Probably the -L flags are in the wrong order.

Attachments (2)

main.log.bz2 (29.8 KB) - added by ryandesign (Ryan Carsten Schmidt) 11 years ago.
patch-src-src-Makefile.in.diff (358 bytes) - added by mojca (Mojca Miklavec) 11 years ago.
experimental patch for proper linking of the library

Download all attachments as: .zip

Change History (10)

Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)

Attachment: main.log.bz2 added

comment:1 Changed 11 years ago by mojca (Mojca Miklavec)

I wanted to test, but figured out I wasn't able to. I'm unable to install codeblocks as single architecture. The reason seems to be that Makefile contains undesired arch flags (most probably in one of the packages, most probably wxGTK's wx-config returns -arch)

PLUGIN_WX_LIBS = -L/opt/unilocal/Library/Frameworks/wxWidgets.framework/Versions/wxGTK/2.8/lib  -arch x86_64 -arch i386 -L/opt/unilocal/lib -Wl,-headerpad_max_install_names -arch x86_64 -arch i386   -L/opt/unilocal/lib -framework IOKit -framework CoreServices -framework System -framework ApplicationServices  -lwx_gtk2u_richtext-2.8 -lwx_gtk2u_aui-2.8 -lwx_gtk2u_xrc-2.8 -lwx_gtk2u_qa-2.8 -lwx_gtk2u_html-2.8 -lwx_gtk2u_adv-2.8 -lwx_gtk2u_core-2.8 -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8 -lwx_baseu-2.8

and I end up with:

:info:build /bin/sh ../../libtool --tag=CXX   --mode=link /usr/bin/clang++  -O2 -ffast-math -DCB_AUTOCONF -pipe -Os -arch x86_64 -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -version-info 0:1:0 -L/opt/unilocal/lib -Wl,-headerpad_max_install_names -arch x86_64 -o libcodeblocks.la -rpath /opt/unilocal/lib annoyingdialog.lo autodetectcompilers.lo base64.lo blockallocated.lo cbauibook.lo cbdebugger_interfaces.lo cbeditor.lo cbeditorprintout.lo cbexception.lo cbplugin.lo cbproject.lo cbstatusbar.lo cbstyledtextctrl.lo cbthreadpool.lo cbtreectrl.lo cbworkspace.lo compileoptionsbase.lo compiler.lo compilercommandgenerator.lo compilerfactory.lo compileroptions.lo compiletargetbase.lo configmanager-revision.lo configmanager.lo configurationpanel.lo configuretoolsdlg.lo confirmreplacedlg.lo crc32.lo debuggermanager.lo editarrayfiledlg.lo editarrayorderdlg.lo editarraystringdlg.lo editkeywordsdlg.lo editor_hooks.lo editorbase.lo editorcolourset.lo editorconfigurationdlg.lo editorlexerloader.lo editormanager.lo editpairdlg.lo editpathdlg.lo edittooldlg.lo encodingdetector.lo externaldepsdlg.lo filefilters.lo filegroupsandmasks.lo filemanager.lo findreplacedlg.lo genericmultilinenotesdlg.lo globals.lo importers_globals.lo incrementalselectlistdlg.lo infowindow.lo loggers.lo logmanager.lo macrosmanager.lo managedthread.lo manager.lo menuitemsmanager.lo multiselectdlg.lo newfromtemplatedlg.lo personalitymanager.lo pipedprocess.lo pluginmanager.lo pluginsconfigurationdlg.lo printing_types.lo projectbuildtarget.lo projectdepsdlg.lo projectfile.lo projectfileoptionsdlg.lo projectlayoutloader.lo projectloader.lo projectloader_hooks.lo projectmanager.lo projectoptionsdlg.lo projectsfilemasksdlg.lo projecttemplateloader.lo scriptingmanager.lo scriptsecuritywarningdlg.lo scrollingdialog.lo sdk_events.lo searchresultslog.lo selecttargetdlg.lo templatemanager.lo toolsmanager.lo uservarmanager.lo virtualbuildtargetsdlg.lo workspaceloader.lo xtra_res.lo CharDistribution.lo JpCntx.lo LangBulgarianModel.lo LangCyrillicModel.lo LangGreekModel.lo LangHebrewModel.lo LangHungarianModel.lo LangThaiModel.lo nsBig5Prober.lo nsCharSetProber.lo nsEscCharsetProber.lo nsEscSM.lo nsEUCJPProber.lo nsEUCKRProber.lo nsEUCTWProber.lo nsGB2312Prober.lo nsHebrewProber.lo nsLatin1Prober.lo nsMBCSGroupProber.lo nsMBCSSM.lo nsSBCharSetProber.lo nsSBCSGroupProber.lo nsSJISProber.lo nsUniversalDetector.lo nsUTF8Prober.lo -L/opt/unilocal/Library/Frameworks/wxWidgets.framework/Versions/wxGTK/2.8/lib  -arch x86_64 -arch i386 -L/opt/unilocal/lib -Wl,-headerpad_max_install_names -arch x86_64 -arch i386   -L/opt/unilocal/lib -framework IOKit -framework CoreServices -framework System -framework ApplicationServices  -lwx_gtk2u_richtext-2.8 -lwx_gtk2u_aui-2.8 -lwx_gtk2u_xrc-2.8 -lwx_gtk2u_qa-2.8 -lwx_gtk2u_html-2.8 -lwx_gtk2u_adv-2.8 -lwx_gtk2u_core-2.8 -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8 -lwx_baseu-2.8  scripting/bindings/libsqbindings.la scripting/sqplus/libsqplus.la scripting/sqstdlib/libsqstdlib.la scripting/squirrel/libsquirrel.la ../base/tinyxml/libtinyxml.la wxscintilla/libwxscintilla.la wxpropgrid/libwxpropgrid.la -lpthread -ldl

I suspect that either the following line in wxWidgets' Portfile is missing the full path:

reinplace -E {s|-arch [a-z0-9_]+||g} lib/wx/config/${wxtype}-unicode-${installtype}-${branch}

or I must have a really old installation of wxGTK.

Last edited 11 years ago by mojca (Mojca Miklavec) (previous) (diff)

comment:2 Changed 11 years ago by mojca (Mojca Miklavec)

Sorry, it turned out to be my outdated installation of wxGTK. I'll try to explore if there is anything I can do, but I don't promise that I know how to fix this.

comment:3 Changed 11 years ago by mojca (Mojca Miklavec)

For me the solution was to replace

/opt/local/libcodeblocks.dylib

by

../sdk/.libs/libcodeblocks.dylib

in the following command that creates the codeblocks binary:

/usr/bin/clang++ -O2 -ffast-math -DCB_AUTOCONF -pipe -Os -arch x86_64 -arch i386 -stdlib=libstdc++ -fPIC -DPIC -fexceptions -Wl,-headerpad_max_install_names -arch x86_64 -arch i386 -o codeblocks app.o appglobals.o backtracedlg.o breakpointsdlg.o compilersettingsdlg.o cpuregistersdlg.o crashhandler.o debugger_interface_creator.o debuggermenu.o debuggersettingscommonpanel.o debuggersettingsdlg.o debuggersettingspanel.o disassemblydlg.o dlgabout.o dlgaboutplugin.o environmentsettingsdlg.o examinememorydlg.o infopane.o main.o notebookstyles.o prefix.o printdlg.o scriptconsole.o scriptingsettingsdlg.o splashscreen.o startherepage.o switcherdlg.o threadsdlg.o watchesdlg.o -Wl,-headerpad_max_install_names  -L/opt/local/lib -L../sdk /opt/local/lib/libcodeblocks.dylib -L/opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxGTK/2.8/lib -lwx_gtk2u_richtext-2.8 -lwx_gtk2u_aui-2.8 -lwx_gtk2u_xrc-2.8 -lwx_gtk2u_qa-2.8 -lwx_gtk2u_html-2.8 -lwx_gtk2u_adv-2.8 -lwx_gtk2u_core-2.8 -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8 -lwx_baseu-2.8 /opt/local/lib/libgtk-x11-2.0.dylib /opt/local/lib/libgdk-x11-2.0.dylib /opt/local/lib/libpangocairo-1.0.dylib /opt/local/lib/libXrender.dylib /opt/local/lib/libXinerama.dylib /opt/local/lib/libXi.dylib /opt/local/lib/libXrandr.dylib /opt/local/lib/libXcursor.dylib /opt/local/lib/libXcomposite.dylib /opt/local/lib/libXdamage.dylib /opt/local/lib/libXfixes.dylib /opt/local/lib/libX11.dylib /opt/local/lib/libXext.dylib /opt/local/lib/libatk-1.0.dylib /opt/local/lib/libcairo.dylib /opt/local/lib/libgdk_pixbuf-2.0.dylib /opt/local/lib/libgio-2.0.dylib /opt/local/lib/libpangoft2-1.0.dylib /opt/local/lib/libpango-1.0.dylib -lm /opt/local/lib/libgobject-2.0.dylib /opt/local/lib/libglib-2.0.dylib /opt/local/lib/libintl.dylib /opt/local/lib/libfontconfig.dylib /opt/local/lib/libfreetype.dylib -lpthread -ldl -pthread -framework ApplicationServices -framework System -framework CoreServices -framework IOKit

Now I'm buffled because I don't understand the following Makefile rules.

am_codeblocks_OBJECTS = app.$(OBJEXT) appglobals.$(OBJEXT) \
	backtracedlg.$(OBJEXT) breakpointsdlg.$(OBJEXT) \
	compilersettingsdlg.$(OBJEXT) cpuregistersdlg.$(OBJEXT) \
	crashhandler.$(OBJEXT) debugger_interface_creator.$(OBJEXT) \
	debuggermenu.$(OBJEXT) debuggersettingscommonpanel.$(OBJEXT) \
	debuggersettingsdlg.$(OBJEXT) debuggersettingspanel.$(OBJEXT) \
	disassemblydlg.$(OBJEXT) dlgabout.$(OBJEXT) \
	dlgaboutplugin.$(OBJEXT) environmentsettingsdlg.$(OBJEXT) \
	examinememorydlg.$(OBJEXT) infopane.$(OBJEXT) main.$(OBJEXT) \
	notebookstyles.$(OBJEXT) prefix.$(OBJEXT) printdlg.$(OBJEXT) \
	scriptconsole.$(OBJEXT) scriptingsettingsdlg.$(OBJEXT) \
	splashscreen.$(OBJEXT) startherepage.$(OBJEXT) \
	switcherdlg.$(OBJEXT) threadsdlg.$(OBJEXT) \
	watchesdlg.$(OBJEXT)
codeblocks_OBJECTS = $(am_codeblocks_OBJECTS)

codeblocks_LDADD = -L../sdk -lcodeblocks \
	$(WX_LIBS) \
	$(WX_GTK2_LIBS)

codeblocks$(EXEEXT): $(codeblocks_OBJECTS) $(codeblocks_DEPENDENCIES) $(EXTRA_codeblocks_DEPENDENCIES)~
	@rm -f codeblocks$(EXEEXT)
	$(CXXLINK) $(codeblocks_OBJECTS) $(codeblocks_LDADD) $(LIBS)

The variable $(codeblocks_OBJECTS) is:

app.o appglobals.o backtracedlg.o breakpointsdlg.o compilersettingsdlg.o cpuregistersdlg.o crashhandler.o debugger_interface_creator.o debuggermenu.o debuggersettingscommonpanel.o debuggersettingsdlg.o debuggersettingspanel.o disassemblydlg.o dlgabout.o dlgaboutplugin.o environmentsettingsdlg.o examinememorydlg.o infopane.o main.o notebookstyles.o prefix.o printdlg.o scriptconsole.o scriptingsettingsdlg.o splashscreen.o startherepage.o switcherdlg.o threadsdlg.o watchesdlg.o

and $(WX_LIBS) start with:

-L/opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxGTK/2.8/lib ...

So how does the

-L../sdk -lcodeblocks

part of $(codeblocks_LDADD) result in

-Wl,-headerpad_max_install_names -L/opt/local/lib -L../sdk /opt/local/lib/libcodeblocks.dylib

?

Changed 11 years ago by mojca (Mojca Miklavec)

experimental patch for proper linking of the library

comment:4 Changed 11 years ago by mojca (Mojca Miklavec)

As Rainer Müller pointed it out on IRC, the Makefile first generates

/bin/sh ../../libtool --tag=CXX   --mode=link ccache /usr/bin/clang++  -O2 -ffast-math -DCB_AUTOCONF -pipe -Os -arch x86_64 -arch i386 -stdlib=libstdc++  -fPIC -DPIC -fexceptions  -L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 -arch i386 -o codeblocks app.o [...] watchesdlg.o -L../sdk -lcodeblocks [...]

but libtool turns that into

libtool: link: ccache /usr/bin/clang++ -O2 -ffast-math -DCB_AUTOCONF -pipe -Os -arch x86_64 -arch i386 -stdlib=libstdc++ -fPIC -DPIC -fexceptions -Wl,-headerpad_max_install_names -arch x86_64 -arch i386 -o codeblocks app.o [...] watchesdlg.o -Wl,-headerpad_max_install_names  -L/opt/local/lib -L../sdk /opt/local/lib/libcodeblocks.dylib [...]

The problem is that

-L/opt/local/lib -L../sdk -lcodeblocks

will would link against the wrong library in either case (even if libtool didn't replace the link). Based on his advice I created a patch that replaces

-L../sdk -lcodeblocks

with

../sdk/.libs/libcodeblocks.dylib

in the original Makefile, hoping that this would solve the problem.

I'm not sure about a sane way to fix this upstream.

comment:5 Changed 11 years ago by mojca (Mojca Miklavec)

Ryan: please test if this works for you and if so, it may be committed and the ticket can be closed.

comment:6 Changed 11 years ago by mojca (Mojca Miklavec)

Committed in r111715. (An ugly solution, but feel free to close the ticket if it works.)

comment:7 Changed 11 years ago by mojca (Mojca Miklavec)

I made an upstream report (but I'm not exactly sure what to write there/how to describe the problem): https://developer.berlios.de/bugs/?func=detailbug&bug_id=19136&group_id=5358

comment:8 Changed 11 years ago by mojca (Mojca Miklavec)

Resolution: fixed
Status: newclosed
Version: 2.2.0
Note: See TracTickets for help on using tickets.