I'm trying to build the latest gdb 10.1 from source.
[My reason for wanting to do it is that I'm trying to debug a program that links to a custom build of Python 2.7.18, and my system gdb was linked to the build of Python 2.7.5 in my /lib64 directory and doesn't work with the newer version].
Having read through the README file, I have configured using:
../gdb-10.1/configure --with-python=<path to my 2.7.18 installation> --prefix=<path to where I want the new gdb to go>
...and then run
make all install
...per the instructions. However, every attempt to build then fails in a slew of error messages of the form:
python/py-arch.o: In function `gdbarch_to_arch_object(gdbarch*)':
.../build/gdb/../../../gdb-10.1/gdb/python/py-arch.c:86: undefined reference to `_Py_RefTotal'
python/py-arch.o: In function `gdbpy_ref_policy<_object>::decref(_object*)':
.../build/gdb/../../../gdb-10.1/gdb/python/py-ref.h:36: undefined reference to `_Py_RefTotal'
.../build/gdb/../../../gdb-10.1/gdb/python/py-ref.h:36: undefined reference to `_Py_NegativeRefcount'
.../build/gdb/../../../gdb-10.1/gdb/python/py-ref.h:36: undefined reference to `_Py_Dealloc'
.../build/gdb/../../../gdb-10.1/gdb/python/py-ref.h:36: undefined reference to `_Py_RefTotal'
.../build/gdb/../../../gdb-10.1/gdb/python/py-ref.h:36: undefined reference to `_Py_RefTotal'
.../build/gdb/../../../gdb-10.1/gdb/python/py-ref.h:36: undefined reference to `_Py_RefTotal'
.../build/gdb/../../../gdb-10.1/gdb/python/py-ref.h:36: undefined reference to `_Py_NegativeRefcount'
.../build/gdb/../../../gdb-10.1/gdb/python/py-ref.h:36: undefined reference to `_Py_Dealloc'
.../build/gdb/../../../gdb-10.1/gdb/python/py-ref.h:36: undefined reference to `_Py_RefTotal'
.../build/gdb/../../../gdb-10.1/gdb/python/py-ref.h:36: undefined reference to `_Py_Dealloc'
.../build/gdb/../../../gdb-10.1/gdb/python/py-ref.h:36: undefined reference to `_Py_NegativeRefcount'
On inspecting the output of the configure step, and the Makefile itself, I can find no reference at all to the Python installation that I specified at configure time (and which I've also placed at the head of my LD_LIBRARY_PATH to ensure that the compiler and linker can find it when building).
What am I missing here?
I did something similar recently, and also struggled, although for different problems.
I suspect your build issue might be related to your use of LD_LIBRARY_PATH, or other things coming from your environment (PATH, CFLAGS, LDFLAGS etc). You shouldn't have to set these during the build.
Here's outline of what I did:
(1) For the build of gdb, I used approach like this:
export PATH=/usr/local/bin:/usr/bin:/bin:/sbin:/usr/sbin
unset LD_LIBRARY_PATH
../gdb-10.1/configure --prefix=/opt/gdb-10.1 --with-python=/opt/conda-py2.7.18
make &> make.log
make install &> make-install.log
The set of PATH and unset of LD_LIBRARY_PATH are intended to sanitise the environment. This ensures the build can only use --with-python for locating python (which itself is at bin/python, under the python prefix). (CFLAGS & LDFLAGS were also not set, nor any PYTHON variables.)
I kept the output of the make stage. If you look in there you should see the with-python option is picked up.
This all built fine.
(2) To invoke the debugger (and use my python under /opt), I needed an extra step: to set LD_LIBRARY_PATH so that my pythons libpython is used:
export LD_LIBRARY_PATH=/opt/conda-py2.7.18/lib
/opt/gdb-10.1/bin/gdb
(gdb) python import sys; print(sys.version)
2.7.18 | Anaconda, Inc.
It would be nice to find a way to avoid this need to set LD_LIBRARY_PATH; this would possibly require linking libpython statically, or introduction of some build flags, eg, to use rpath.
Related
I have two Arch Linux machines on one I can compile my code but on my new one I get the following errors:
:-1: warning: libwebp.so.5, needed by /usr/local/lib/libopencv_imgcodecs.so, not found (try using -rpath or -rpath-link)
/usr/local/lib/libopencv_imgcodecs.so:-1: error: undefined reference to `WebPEncodeBGRA'
/usr/local/lib/libopencv_imgcodecs.so:-1: error: undefined reference to `WebPDecodeBGRAInto'
/usr/local/lib/libopencv_imgcodecs.so:-1: error: undefined reference to `WebPEncodeLosslessBGR'
/usr/local/lib/libopencv_imgcodecs.so:-1: error: undefined reference to `WebPDecodeBGRInto'
/usr/local/lib/libopencv_imgcodecs.so:-1: error: undefined reference to `WebPEncodeLosslessBGRA'
/usr/local/lib/libopencv_imgcodecs.so:-1: error: undefined reference to `WebPGetFeaturesInternal'
/usr/local/lib/libopencv_imgcodecs.so:-1: error: undefined reference to `WebPEncodeBGR'
:-1: error: collect2: error: ld returned 1 exit status
My .pro file looks like this:
#-------------------------------------------------
#
# Project created by QtCreator 2015-11-15T16:30:56
#
#-------------------------------------------------
QT += core gui opengl
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = ColonyCounter
TEMPLATE = app
CONFIG += c++11
INCLUDEPATH += /usr/local/include/opencv
LIBS += -L/usr/local/lib -lopencv_core -lopencv_imgcodecs -lopencv_imgproc
SOURCES += main.cpp\
mainwindow.cpp \
cellcounter.cpp
HEADERS += mainwindow.h \
cellcounter.h
FORMS += mainwindow.ui
DISTFILES += \
to-do.txt
How can I link the library or something like this, haven't found anything in the web right know.
I have checked my libs and found out that I do not have a libwep.so.5 but libwebp.so.6 and libwebp.so and libwebp.so.2, but I do not know how to fix it, install libwebp.so.5 or change something in my .pro file?
Looks like the version of OpenCV that you installed wants to link with an older version of libwebp (specifically version 0.4.4 which contains libwebp.so.5) than what you have installed (probably version 0.5.0-1). Some options are:
Downgrade libwebp to 0.4.4 and ignore libwebp 0.5.0-1 to avoid reverting back with future upgrades. This is probably not the best choice, but it is easy and would work unless you have other packages which depend on 0.5.0-1.
Manually download and build the 0.4.4 version of libwebp and install in a non-standard location. In this case, you would need to modify/use LD_LIBRARY_PATH to point opencv there. This is probably your easiest best option.
Download some more recent version of the OpenCV source and build it. It will find and link to your current libwep.so.6, if it is compatible. The latest version of OpenCV (as of this writing 3.1.0) is compatible. This option is the best option but the most involved as compiling OpenCV can be trivial or painful depending upon the features you want to include.
Now a comment about your currently marked solution: Making a link from one soname to another is highly not recommended. In many cases, it won't compile, but even if it does, your application may exhibit arbitrary and unstable behavior and/or segfault unless the binaries are completely compatible. But if they were compatible, the packager would probably not have changed the soname. If this is for a school project, you might be ok, but if this is for anything important, don't do it.
Hope this helps.
I solved the problem with a not so elegant solution:
I just created a symbolic link:
$ file libwebp.so.5
libwebp.so.5: symbolic link to libwebp.so.6.0.0
with:
ln /usr/lib/libwebp.so.6 /usr/lib/libwebp.so.5
I want to run a project that communicates with a USB device using libusb. I already have it on Linux, and it works great there, so I want to run it on Windows with Cygwin. I installed libusb for Windows and libusb in Cygwin, then tried to compile it. It turns out that you need pciutils, unlike on Linux in which it's really easy to get it. In Cygwin it's a problem.
After overcoming some difficulties I managed to get further with my purpose of compiling pciutil in the Cygwin environment. I follwed these steps:
Download winio package for Windows and went to Winio\Binaries and copied winio32.dll and winio32.sys to the pciutil directory.
Copy config.h/mk from ../win32 to ../lib
Go to ..\lib\i386-io-winodws.h and change line 39 to "lib = LoadLibrary("WinIo32.dll");"
$ make
The make step didn't work. It showed me a makefile error, so I tried to play with it without any luck.
I got this error:
gcc lspci.o ls-vpd.o ls-caps.o ls-ecaps.o ls-kernel.o ls-tree.o ls-map.o common.o lib/libpci.a -o lspci
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x95): undefined reference to `_outpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0xd3): undefined reference to `_outpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0xf1): undefined reference to `_outpw'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x110): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x170): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x184): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x1af): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x204): undefined reference to `_outpw'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x218): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x242): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x259): undefined reference to `_outpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x2d5): undefined reference to `_outpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x30c): undefined reference to `_inpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x328): undefined reference to `_inpw'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x348): undefined reference to `_inp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x3b2): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x3c6): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x3ed): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x417): undefined reference to `_inpw'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x42f): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x447): undefined reference to `_inp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x457): undefined reference to `_inpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x65a): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x666): undefined reference to `_inpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x67c): undefined reference to `_outpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x688): undefined reference to `_inpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x69f): undefined reference to `_outpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x6c3): undefined reference to `_outpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x729): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x73d): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x751): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x75d): undefined reference to `_inp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x778): undefined reference to `_inp'
collect2: error: ld returned 1 exit status
Makefile:96: recipe for target 'lspci' failed
make: *** [lspci] Error 1
I went to the Makefile, line 96, but I didn't understand what to change there in order to make it work (if you like, I could post the entire makefile too):
%: %.o
$(CC) $(LDFLAGS) $(TARGET_ARCH) $^ $(LDLIBS) -o $#
Since you're using a 32-bit version of Windows you can use the Cygwin port of pciutils. The files in the win32 subdirectory are actually for the MinGW port, and that's why you get the link errors.
The first thing you should do unpack the source files to a new directory so you can start from fresh. Your changes and modifications aren't necessary to compile it using Cygwin. Be sure not to copy any of the files in the win32 directory this time, they're not needed. Also don't copy the winio32 files, you don't need them either. Don't make any changes to any of the files.
The next thing to do is to install the ioperm package using Cygwin's setup-x86.exe. Type ioperm in the search box to quickly find it amongst all the other packages. Once it's been installed run ioperm -i from the Cygwin prompt to install the driver that allows applications to do direct I/O.
Next change directory to where you unpacked the fresh copy of pciutils and run the following command from the Cygwin shell:
make HOST=i386-pc-cygwin
That should be all you need to do to create the library and utilities.
I've tired to maintenance the latest VIM/GVIM for windows, here is my OpenSource project.
However, I found the compile always failed by cygwin since the vim version higher than v7.4.399 (including v7.4.399).
Version less than v7.4.399 can be compiled with the same command successfully!
Failed Information:
obj/ex_docmd.o:ex_docmd.c:(.text+0x45f): undefined reference to `crypt_get_key'
obj/fileio.o:fileio.c:(.text+0xbb7): undefined reference to `crypt_works_inplace'
obj/fileio.o:fileio.c:(.text+0xbe6): undefined reference to `crypt_encode_alloc'
obj/fileio.o:fileio.c:(.text+0xd69): undefined reference to `crypt_encode_inplace'
obj/fileio.o:fileio.c:(.text+0x69e3): undefined reference to `crypt_free_state'
obj/fileio.o:fileio.c:(.text+0x6c66): undefined reference to `crypt_free_state'
obj/fileio.o:fileio.c:(.text+0x6c97): undefined reference to `crypt_free_key'
obj/fileio.o:fileio.c:(.text+0x716f): undefined reference to `crypt_get_method_nr'
obj/fileio.o:fileio.c:(.text+0x7177): undefined reference to `crypt_get_header_len'
obj/fileio.o:fileio.c:(.text+0x8e48): undefined reference to `crypt_works_inplace'
obj/fileio.o:fileio.c:(.text+0x8e73): undefined reference to `crypt_decode_inplace'
obj/fileio.o:fileio.c:(.text+0x906d): undefined reference to `crypt_method_nr_from_magic'
obj/fileio.o:fileio.c:(.text+0x9098): undefined reference to `crypt_set_cm_option'
obj/fileio.o:fileio.c:(.text+0x90c8): undefined reference to `crypt_create_from_header'
obj/fileio.o:fileio.c:(.text+0x90df): undefined reference to `crypt_set_cm_option'
obj/fileio.o:fileio.c:(.text+0x90e7): undefined reference to `crypt_get_header_len'
obj/fileio.o:fileio.c:(.text+0x9158): undefined reference to `crypt_decode_alloc'
obj/fileio.o:fileio.c:(.text+0x9e3f): undefined reference to `crypt_append_msg'
obj/fileio.o:fileio.c:(.text+0x9ed4): undefined reference to `crypt_get_method_nr'
obj/fileio.o:fileio.c:(.text+0x9edc): undefined reference to `crypt_get_header_len'
obj/fileio.o:fileio.c:(.text+0xa5bc): undefined reference to `crypt_get_key'
obj/fileio.o:fileio.c:(.text+0xca32): undefined reference to `crypt_free_state'
obj/fileio.o:fileio.c:(.text+0xdd15): undefined reference to `crypt_get_method_nr'
obj/fileio.o:fileio.c:(.text+0xdd37): undefined reference to `crypt_create_for_writing'
obj/fileio.o:fileio.c:(.text+0xe2d2): undefined reference to `crypt_append_msg'
/usr/lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/bin/ld: obj/fileio.o: bad reloc address 0x2e8 in section `.rdata'
/usr/lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/bin/ld: final link failed: Invalid operation
collect2: error: ld returned 1 exit status
Make_cyg.mak:603: recipe for target 'vim.exe' failed
make: *** [vim.exe] Error 1
The compile command:
make -B -f Make_cyg.mak PYTHON=/cygdrive/c/Marslo/MyProgramFiles/Python27 DYNAMIC_PYTHON=yes PYTHON_VER=27 PYTHON3=/cygdrive/c/Marslo/MyProgramFiles/Python34 DYNAMIC_PYTHON3=yes PYTHON3_VER=34 FEATURES=huge IME=yes GIME=yes MBYTE=yes CSCOPE=yes USERNAME=Marslo.Jiao USERDOMAIN=China GUI=no
I checked the difference between v7-4-398 and v7-4-399, and found there something updated with encryption. Then I added the libs and other stuff about crypt in cygwin as below, but the compile still CANNOT work....
What should I do can compile the higher version vim ?
Environments:
Cygwin version: Latest setup-x86_64.exe, mintty 1.2-beta1 (x86_64-pc-cygwin)
Have you tried compiling with all the patches that are currently available. I think Bram Moolenaar (Maintainer for vim) forgot to add some of the files in one of the patches and one of the later one fixes that. If not post to vim_dev#vim.org
This was also reported to at https://groups.google.com/forum/#!topic/vim_dev/D8FyRd0EwlE.
Patch 7.4.401 should fix it https://groups.google.com/forum/#!topic/vim_dev/q0dbl0_9k9U
Got this issue again on CentOS 7, Python 2.7.10, 64bit.
According to this answer, this issue has been fixed;
export vi_cv_path_python_plibs="-L/<python_config_path> ..."
For example in my situation:
export vi_cv_path_python_plibs="-L/usr/local/lib/python2.7/config ..."
Compile command:
$ ./configure --prefix=$HOME/.marslo/myprograms/vim74 --enable-pythoninterp --with-python-config-dir=/usr/local/lib/python2.7/config --with-features=huge --disable-smack --enable-cscope --with-tlib=ncurses --with-compiledby=marslo#china
$ cd src && make first
$ cd .. && make
$ make install
You can disable sodium library in ./configure such as :
./configure -disable-libsodium
I want to use the command line to compile a simple program using the VTK library:
g++ -IC:\VTK\Install\includes\vtk-5.10 SimpleTest.cpp -LC:\VTK\Install\lib
\vtk_5.10 -lvtkCommon -lvtkGraphics
SimpleTest.cpp
#include "vtkConeSource.h"
int main()
{
vtkConeSource* cone = vtkConeSource::New();
cone->SetHeight(5.0);
return 1;
}
but I always get many errors about "undefined references". For example:
C:\VTK\Install\lib\vtk_5.10/libvtkGraphics.a(vtkConeSource.cxx.obj):vtkConeSource.cxx:(.text+0x1c): undefined reference to `vtkInformationVector::GetInformationObject(int)'
C:\VTK\Install\lib\vtk_5.10/libvtkGraphics.a(vtkConeSource.cxx.obj):vtkConeSource.cxx:(.text+0x24): undefined reference to `vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES()'
C:\VTK\Install\lib\vtk_5.10/libvtkGraphics.a(vtkConeSource.cxx.obj):vtkConeSource.cxx:(.text+0x36): undefined reference to `vtkInformation::Set(vtkInformationIntegerKey*, int)'
C:\VTK\Install\lib\vtk_5.10/libvtkGraphics.a(vtkConeSource.cxx.obj):vtkConeSource.cxx:(.text+0x85): undefined reference to `vtkPolyDataAlgorithm::PrintSelf(std::ostream&, vtkIndent)'
C:\VTK\Install\lib\vtk_5.10/libvtkGraphics.a(vtkConeSource.cxx.obj):vtkConeSource.cxx:(.text+0x9f): undefined reference to `operator<<(std::ostream&, vtkIndent const&)'
and many more ...
I can't tell if I am using wrong syntax for g++ or if there is something wrong with my VTK library.
I am using:
VTK 5.10.1
minGW 4.7.2, 32 bit
VTK was compiled from source with minGW using CMake 2.8.11.2
update:
I did find this tutorial http://vtkblog.blogspot.com/2008/05/build-vtk-from-source-using-mingwmsys.html about this. However I used minGW32-make instead of installing MSYS and using it's "make". Could this be part of the problem?
As a very first test, try explicitly including all vtk libraries contained in Install\lib\vtk_5.10 - to ensure those undefined references are not coming from those missing libraries.
I'm trying to use libxml2 with android ndk. When I run the make file, I got errors saying that file 'unicode/ucnv.h' does not exist. I've seen 'unicode/ucnv.h' is included in one of the files and no such header file is present. So I downloaded unicode header files from http://site.icu-project.org/ and placed them in include folder.
Now the previous error is gone but I've got these errors.
SharedLibrary : libxml2.so
./obj/local/armeabi/objs-debug/xml2/encoding.o: In function `openIcuConverter':
C:\test\hello-jni/jni/encoding.c:109: undefined reference to `ucnv_open_49'
C:\test\hello-jni/jni/encoding.c:115: undefined reference to `ucnv_setToUCallBack_49'
C:\test\hello-jni/jni/encoding.c:119: undefined reference to `ucnv_setFromUCallBack_49'
C:\test\hello-jni/jni/encoding.c:126: undefined reference to `ucnv_open_49'
C:\test\hello-jni/jni/encoding.c:132: undefined reference to `ucnv_close_49'
C:\test\hello-jni/jni/encoding.c:135: undefined reference to `UCNV_TO_U_CALLBACK_STOP_49'
C:\test\hello-jni/jni/encoding.c:135: undefined reference to `UCNV_FROM_U_CALLBACK_STOP_49'
./obj/local/armeabi/objs-debug/xml2/encoding.o: In function `closeIcuConverter':
C:\test\hello-jni/jni/encoding.c:141: undefined reference to `ucnv_close_49'
C:\test\hello-jni/jni/encoding.c:142: undefined reference to `ucnv_close_49'
./obj/local/armeabi/objs-debug/xml2/encoding.o: In function `xmlUconvWrapper':
C:\test\hello-jni/jni/encoding.c:1865: undefined reference to `ucnv_convertEx_49'
C:\test\hello-jni/jni/encoding.c:1870: undefined reference to `ucnv_convertEx_49'
collect2: ld returned 1 exit status
make: * [obj/local/armeabi/libxml2.so] Error 1
I didn't find function ucnv_open_49 in any of the files.
Am I the only one who is facing this problem?
Build unicode library (icu) along with libxml2 and mention in LOCAL_SHARED_LIBRARIES.
That's it!
Are you intending to link libxml2 against ICU (e.g. use it for conversion)? It's optional but currently you have it enabled. With such you'll need ICU to be linked in as well rather static or dynamic. See the libxml2's configure script for options. Some of which are iconv or even no converters if you intend to work with UTF-8 only.