Author Topic: Build error cannot find -lwx_gtk-2.4 (hackish workaround found)  (Read 8513 times)

Offline ideasman42

  • Single posting newcomer
  • *
  • Posts: 4
Build error cannot find -lwx_gtk-2.4 (hackish workaround found)
« on: November 25, 2008, 01:02:21 am »
Just built wxGTK-2.8.9, was able to build CodeLite, but having this odd problem linking CodeBlocks from svn rev 5322

Heres the error,
/bin/sh ../../libtool --tag=CXX   --mode=link g++  -O2 -ffast-math -O2 -pipe -fomit-frame-pointer -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -L/root/garnome/lib -L/usr/local/lib -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lgio-2.0 -lXext -lXrender -lX11 -lXinerama -lXi -lXrandr -lXcursor -lXcomposite -lXdamage -lcairo -lXfixes -lpango-1.0 -lfreetype -lz -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lglib-2.0    -o codeblocks app.o appglobals.o compilersettingsdlg.o crashhandler.o dlgabout.o dlgaboutplugin.o environmentsettingsdlg.o infopane.o main.o prefix.o printdlg.o scriptconsole.o scriptingsettingsdlg.o splashscreen.o startherepage.o -LwxAUI -lwxaui -L../sdk -lcodeblocks -L/usr/local/lib -pthread   -L/usr/local/lib   -lwx_gtk2u-2.8  -lpthread -ldl
g++ -O2 -ffast-math -O2 -pipe -fomit-frame-pointer -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -o codeblocks app.o appglobals.o compilersettingsdlg.o crashhandler.o dlgabout.o dlgaboutplugin.o environmentsettingsdlg.o infopane.o main.o prefix.o printdlg.o scriptconsole.o scriptingsettingsdlg.o splashscreen.o startherepage.o -pthread  -L/root/garnome/lib -L/usr/local/lib -L/usr/src/codeblocks/src/src/wxAUI /usr/src/codeblocks/src/src/wxAUI/.libs/libwxaui.a /root/garnome/lib/libgtk-x11-2.0.so /root/garnome/lib/libgdk-x11-2.0.so /root/garnome/lib/libatk-1.0.so /root/garnome/lib/libgdk_pixbuf-2.0.so /root/garnome/lib/libpangocairo-1.0.so /root/garnome/lib/libglitz.so /root/garnome/lib/libpangoft2-1.0.so /root/garnome/lib/libgio-2.0.so /usr/lib/libXinerama.so /usr/lib/libXi.so /usr/lib/libXrandr.so /usr/lib/libXcursor.so /usr/lib/libXcomposite.so /usr/lib/libXext.so /usr/lib/libXdamage.so /usr/local/lib/libcairo.so /root/garnome/lib/libpixman-1.so /usr/local/lib/libpng12.so /root/garnome/lib/libXrender.so /usr/lib/libXfixes.so /usr/lib/libX11.so /usr/lib/libxcb-xlib.so /usr/lib/libxcb.so /usr/lib/libXau.so /usr/lib/libXdmcp.so /root/garnome/lib/libpango-1.0.so /root/garnome/lib/libfontconfig.so /root/garnome/lib/libfreetype.so -lz /root/garnome/lib/libexpat.so /root/garnome/lib/libgobject-2.0.so /root/garnome/lib/libgmodule-2.0.so /root/garnome/lib/libglib-2.0.so /usr/local/lib/libstdc++.so -lm -L/usr/src/codeblocks/src/sdk /usr/lib/libcodeblocks.so /usr/lib/libwxscintilla.a -lwx_gtk-2.4 -lwx_gtk2u-2.8 -lpthread -ldl   -Wl,--rpath -Wl,/root/garnome/lib -Wl,--rpath -Wl,/usr/local/lib -Wl,--rpath -Wl,/root/garnome/lib -Wl,--rpath -Wl,/usr/local/lib
/usr/bin/../lib/gcc/i686-pc-linux-gnu/4.3.2/../../../../i686-pc-linux-gnu/bin/ld: cannot find -lwx_gtk-2.4
collect2: ld returned 1 exit status
make[3]: *** [codeblocks] Error 1
make[3]: Leaving directory `/usr/src/codeblocks/src/src'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/usr/src/codeblocks/src/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/src/codeblocks/src'
make: ***
« Last Edit: November 26, 2008, 03:34:01 am by ideasman42 »

Offline linkerlin

  • Single posting newcomer
  • *
  • Posts: 5
Re: Build error cannot find -lwx_gtk-2.4
« Reply #1 on: November 25, 2008, 04:20:31 am »
gtk-2.4 != wxGTK-2.8.9

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7786
    • My Best Post
Re: Build error cannot find -lwx_gtk-2.4
« Reply #2 on: November 25, 2008, 05:42:40 am »
wx_gtk-2.4 != gtk-2.4
In other words, I think you meant to use gtk library version 2.4.

Note, the prior gtk-2.4 != wxGTK-2.8.9; might implies they think you should remove one of two; or like me remove the wx_.

Tim S

C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline ideasman42

  • Single posting newcomer
  • *
  • Posts: 4
Re: Build error cannot find -lwx_gtk-2.4
« Reply #3 on: November 25, 2008, 09:13:25 am »
yep, I know that these are different libs.
I have "gtk+-2.14.4" and "wxGTK-2.8.9"

I also removed everything todo with wxGTK before rebuilding wxGTK and installing.
"wx-config --version" returns
2.8.9

So I'm not sure why its asking for -lwx_gtk-2.4, since it obviously knows about "-lwx_gtk2u-2.8" for eg.
« Last Edit: November 25, 2008, 09:30:50 am by ideasman42 »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7786
    • My Best Post
Re: Build error cannot find -lwx_gtk-2.4
« Reply #4 on: November 25, 2008, 02:30:37 pm »
yep, I know that these are different libs.
I have "gtk+-2.14.4" and "wxGTK-2.8.9"

I also removed everything todo with wxGTK before rebuilding wxGTK and installing.
"wx-config --version" returns
2.8.9

So I'm not sure why its asking for -lwx_gtk-2.4, since it obviously knows about "-lwx_gtk2u-2.8" for eg.


what is returned by "wx-config --libs" This is an guess on the command.
Look in "Other linker options" to confirm command.

Tim S

Also, look for stray wx_gtk-2.4 in the rest of places suggested by Morten here.
Check the following build options in your project file:
1.) Project level: Tab "Linker settings" -> "Link libraries", "Other linker options"
2.) Target level: Tab "Linker settings" -> "Link libraries", "Other linker options"
3.) Project level: Tab "Compiler settings" -> "Other options"
4.) Target level: Tab "Compiler settings" -> "Other options"

If you still have not found the cause look at the "global compiler settings"
"Settings" -> "Compiler and debugger"
Select the correct compiler
"Linker settings" -> "Link libraries", "Other linker options"

« Last Edit: November 25, 2008, 02:38:06 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline ideasman42

  • Single posting newcomer
  • *
  • Posts: 4
Re: Build error cannot find -lwx_gtk-2.4
« Reply #5 on: November 26, 2008, 03:31:26 am »
Hey there, Im on linux so no UI for looking at libs

However I ran all wx-config examples from the makefiles and found no references to  wx_gtk-2.4 from their output
I also grepped the entire tree for "wx_gtk-2.4", and found no result, so this is very confusing.

Finally wrapping g++ seemed to be the last resort....
Code
#!/usr/bin/python
# rename g++ to g++.real
import sys
import os
# print ' '.join(sys.argv)
args = sys.argv

args = [a for a in args if 'wx_gtk-2.4' not in a]
args = [a for a in args if 'DAPP_PREFIX' not in a]

os.system(' '.join(args).replace('g++', 'g++.real'))

APP_PREFIX define's to "\"/usr/local\"" gave a compile error
Code
g++ -DHAVE_CONFIG_H -I. -I../../src/include -I/usr/local/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/local/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -I../../src/include/wxscintilla/include -I../../src/include -I../../src/include/scripting/include -I../../src/include/scripting/sqplus -I../../src/include/wxFlatNotebook/include -I../../src/src/wxAUI -DENABLE_BINRELOC -DAPP_PREFIX="\"/usr/local\"" -Ulinux -Uunix  -O2 -ffast-math -O2 -pipe -fomit-frame-pointer -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -MT app.o -MD -MP -MF .deps/app.Tpo -c -o app.o app.cpp
appglobals.h:231:1: error: pasting "L" and "/" does not give a valid preprocessing token
In file included from ./sdk_precomp.h:10:
appglobals.h: In member function 'bool CodeBlocksApp::LoadConfig()':
appglobals.h:231: error: 'L' was not declared in this scope
appglobals.h:231: error: 'usr' was not declared in this scope
appglobals.h:231: error: 'local' was not declared in this scope

removing this define with the wrapped g++ worked.

but after that I had linking errors

Code
test -z "/usr/local/share/codeblocks/plugins" || /usr/local/bin/mkdir -p "/usr/local/share/codeblocks/plugins"
 /bin/sh ../../../libtool   --mode=install /usr/local/bin/ginstall -c  'libdebugger.la' '/usr/local/share/codeblocks/plugins/libdebugger.la'
libtool: install: warning: relinking `libdebugger.la'
(cd /usr/src/codeblocks/src/plugins/debuggergdb; /bin/sh ../../../libtool  --tag=CXX --mode=relink g++ -O2 -ffast-math -O2 -pipe -fomit-frame-pointer -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -L/usr/local/lib -L/root/garnome/lib -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lz -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -module -version-info 0:1:0 -shared -no-undefined -avoid-version -o libdebugger.la -rpath /usr/local/share/codeblocks/plugins backtracedlg.lo breakpointsdlg.lo cdb_driver.lo cpuregistersdlg.lo databreakpointdlg.lo debugger_defs.lo debuggerdriver.lo debuggergdb.lo debuggeroptionsdlg.lo debuggeroptionsprjdlg.lo debuggerstate.lo debuggertree.lo disassemblydlg.lo editbreakpointdlg.lo editwatchdlg.lo editwatchesdlg.lo examinememorydlg.lo gdb_driver.lo gdb_tipwindow.lo threadsdlg.lo ../../sdk/libcodeblocks.la -lpthread -ldl ) 
mv: cannot stat `libdebugger.so': No such file or directory
libtool: install: error: relink `libdebugger.la' with the above command before installing it
make[5]: *** [install-libLTLIBRARIES] Error 1
make[5]: Leaving directory `/usr/src/codeblocks/src/plugins/debuggergdb'
make[4]: *** [install-am] Error 2
make[4]: Leaving directory `/usr/src/codeblocks/src/plugins/debuggergdb'
make[3]: *** [install-recursive] Error 1
make[3]: Leaving directory `/usr/src/codeblocks/src/plugins/debuggergdb'
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory `/usr/src/codeblocks/src/plugins'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/usr/src/codeblocks/src'
make: *** [install-recursive] Error 1

Configuring with these options worked though...
Code
make distclean ; ./configure; make -j3; make install
make distclean ; ./configure --enable-static --disable-shared ; make -j3; make instal

Yes thats right, for some reason the static codeblocks still wants wants libcodeblocks.so, and it only works with the libcodeblocks.so created from a clean build, the clean build however fails with plugins, so doing a static build after that gives a working binary.
phew :/

so, I have codeblocks now :), Im not certain if these problems are on my system or with codeblocks... I can build wine, gimp, blender3d, xorg, linux kernel, qt4.x, mesa, gnome, gcc... on my system so its unusual I have these problems.
« Last Edit: November 26, 2008, 04:03:41 am by ideasman42 »