Linking problems with wxGTK
Brought to you by:
tgilling
In Gentoo linux, I can compile AMDOverdrive Ctrl 1.2.1 sources and get the objects fine. But at the linking stage with wxGTK 2.8.11 and 2.8.12 libraries, I kept getting errors like:
CFanSpeedPanel.cpp:(.text+0x2b3): undefined reference to `wxStringBase::npos'
To solve this, wxlibraries must come *after* the objects in the LDFLAGS definition in the makefile. So now my makefile looks like:
makefile:23: $(CC) $(OBJECTS) $(LDFLAGS) -o $@
I found this solution here: http://stackoverflow.com/questions/2372150/wxwidgets-linking-problem
I wrote a patch for this bug and a couple of other issues:
Description: fix linking problems with wxWidgets (sf#3519709), use RPM optflags, remove wrong LDFLAGS.
Author: Alexey Svistunov <svalx@svalx.net>
Index: makefile
===================================================================
--- makefile.orign 2011-06-14 21:58:22.000000000 +0400
+++ makefile 2012-04-27 15:51:39.507983300 +0400
@@ -7,9 +7,13 @@
OBJECTS = $(SOURCES:.cpp=.o)
+ifndef OPTFLAGS
+ OPTFLAGS = -O3 -Wall
+endif
+
CC = g++
-CFLAGS = -c -I./ADL_SDK/include -O3 -fexpensive-optimizations -W -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) -DLINUX
-LDFLAGS = -mwindows -s $(shell wx-config --debug=no --libs --unicode=yes) -ldl -o$(OUTPUT_DIR)/$(EXECUTABLE)
+CFLAGS = -c -I./ADL_SDK/include -fexpensive-optimizations -W $(shell wx-config --cxxflags --unicode=yes --debug=no) -DLINUX $(OPTFLAGS)
+LDFLAGS = -s $(shell wx-config --debug=no --libs --unicode=yes) -ldl
.cpp.o:
$(CC) $(CFLAGS) $< -o $@
@@ -19,7 +23,7 @@
$(OUTPUT_DIR)/$(EXECUTABLE): $(OBJECTS)
@rm -rf $(OUTPUT_DIR)
@mkdir $(OUTPUT_DIR)
- $(CC) $(LDFLAGS) $(OBJECTS) -o $@
+ $(CC) $(OBJECTS) $(LDFLAGS) -o $@
@echo ...
@echo build completed.
@echo ...
Is your patch applied to the sources already? If so, I can notify the Gentoo maintainers to update their packages.
Yes it is. Thank you for a commit!
This ticket can be closed. Patch applied to the sources and issue fixed.