Libpqxx complaining about missing references - c++

So I have the following problem:
g++ -std=c++0x -O3 -I/usr/include/scip main.cpp locations/locationreader.cpp locations/locationassigner.cpp scheduler.o optimizer.o dbmanager.o scheduleData.o exam.o -o main -L/usr/lib -lscip -lreadline -lgmp -lz -llpispx -lsoplex -lobjscip -lnlpi.cppad -lscipopt -lzimpl -lpqxx -lpq -pthread
/usr/lib/../lib64/libpqxx.so: undefined reference to `PQescapeIdentifier'
collect2: error: ld returned 1 exit status
make: *** [main] Error 1
And I cannot figure out why it cannot find the reference because I have libpq installed and its right there in /usr/lib64
$ ls | grep pq
libpq.so
libpq.so.5
libpq.so.5.2
libpqxx-4.0.so
libpqxx.so
So if I could get any help with this that would be lovely

PQescapeIdentifier appeared in PostgreSQL 9.0, which corresponds to libpq.so.5.3
9.0 release notes have this entry:
Add libpq functions PQescapeLiteral() and PQescapeIdentifier() (Robert
Haas)
You seem to use client libraries from PostgreSQL-8.4 (libpq.so.5.2), that would be why it lacks this function.

Related

/usr/bin/ld cannot find <library> only during compilation

The error it throws:
g++ -m64 -std=c++17 main.cpp -o vulkanprogram -lvulkan
/usr/bin/ld: cannot find -lvulkan
collect2: error: ld returned 1 exit status
what ld returns when I find it myself:
ld -lvulkan --verbose
attempt to open /usr/lib/libvulkan.so succeeded
/usr/lib/libvulkan.so
can someone help explain this to me?
This is because ld cannot search the correct path
use this before running: export LD_LIBRARY_PATH=/usr/lib
or this g++ -m64 -std=c++17 main.cpp -o vulkanprogram -I/usr/include/ -L/usr/lib/ -lvulkan
On surface, based on comments, the problem is with the LD search path. Providing the full path (/usr/lib/lib...) seems to address the problem.
g++ -m64 -std=c++17 main.cpp -o vulkanprogram /usr/lib/libvulkan.so
For permanent solution - troubleshoot with
Verbose ld output: g++ --Wl,--verbose m64 -std=c++17 main.cpp -o vulkanprogram /usr/lib/libvulkan.so
Check type of library file /usr/lib/libvulkan.so

How to fix "Unexpected token... for architecture x86_64" error when running makefile

I'm trying to install HLA-LA on my 2016 MacBookPro (running Mojave 10.14.3) but I've been having issues compiling the makefile. I've installed all the dependencies, added the bamtools and boost paths as the README describes, and added CFLAGS to specify c++11. Still, when I run the makefile I get the following error:
$ make all
/usr/local/Cellar/gcc/8.3.0/bin/g++-8 -I/usr/local/Cellar/boost/1.68.0_1/include -I/usr/local/Cellar/bamtools/2.5.1/include/bamtools -I/usr/local/Cellar/bamtools/2.5.1/src -std=c++11 -ggdb -O2 -fopenmp -std=gnu++0x -fstack-protector-all HLA-LA.cpp -c -o ../obj/HLA-LA.o;
/usr/local/Cellar/gcc/8.3.0/bin/g++-8 -I/usr/local/Cellar/boost/1.68.0_1/include -I/usr/local/Cellar/bamtools/2.5.1/include/bamtools -I/usr/local/Cellar/bamtools/2.5.1/src -std=c++11 -ggdb -O2 -fopenmp -std=gnu++0x -fstack-protector-all ../obj/Edge.o ../obj/Graph.o ../obj/GraphAndEdgeIndex.o ../obj/Node.o ../obj/HaplotypePanel.o ../obj/simpleGraphSimulator.o ../obj/LocusCodeAllocation.o ../obj/simulator.o ../obj/readSimulator.o ../obj/trueReadLevels.o ../obj/processBAM.o ../obj/protoSeeds.o ../obj/oneRead.o ../obj/oneReadPair.o ../obj/oneReadPairwithSeedChains.o ../obj/alignerBase.o ../obj/alignmentContext.o ../obj/extensionAligner.o ../obj/BWAmapper.o ../obj/Bowtie2mapper.o ../obj/statistics.o ../obj/VirtualNWUnique.o ../obj/PRGContigBAMAlignment.o ../obj/verboseSeedChain.o ../obj/HLATyper.o ../obj/pathFinder.o ../obj/linearALTs.o ../obj/oneExonPosition.o ../obj/seedChain.o ../obj/Utilities.o ../obj/HLA-LA.o -o ../bin/HLA-LA -L/usr/local/Cellar/boost/1.68.0_1/lib -L/usr/local/Cellar/bamtools/2.5.1/lib64 -L/usr/local/Cellar/zlib/1.2.11/lib -lboost_random -lboost_filesystem -lboost_system -lbamtools -lz -lboost_serialization;
collect2: fatal error: ld terminated with signal 11 [Segmentation fault: 11]
compilation terminated.
ld: unexpected token: !tapi-tbd-v3 file '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd' for architecture x86_64
make: *** [HLA-LA] Error 1
I've seen other people with similar errors, but the recommended fixes havent worked. I've also tried specifying CLT via the path: /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/ but it doesn't change the outcome at all. I read some thread that suggested it could be an ld issue but I'm not sure how I can fix that? Here are my specs:
macOS: 10.14.3-x86_64
CLT: 10.1.0.0.1.1539992718
Xcode: 10.1

Install gdb-7.2 on Solaris 11 for segmentation fault error

I am trying to install gdb-7.2 on Solaris 11 for debugging a c++ script that is issuing a segmentation fault alert.
Once configured (./configure),
checking whether -fkeep-inline-functions is supported... yes
configure: creating ./config.status
config.status: creating Makefile
I move on make (make) however this fails with the following errors:
ar: creating libgdb.a ranlib libgdb.a
rm -f gdb
gcc -g -O2 -rdynamic \
-o gdb gdb.o libgdb.a \
../readline/libreadline.a ../opcodes/libopcodes.a ../bfd/libbfd.a \
../libiberty/libiberty.a ../libdecnumber/libdecnumber.a \
-ldl -lcurses -lz -lsocket -lnsl -lm -lsocket -lnsl -ldl -lm \
-lpython2.6 -lexpat ../libiberty/libiberty.a gnulib/libgnu.a
Undefined first referenced symbol in file
wattr_on libgdb.a(tui-wingeneral.o)
wattr_off libgdb.a(tui-wingeneral.o)
ld: fatal: symbol referencing errors. No output written to gdb collect2: ld returned 1 exit status
*** Error code 1 make: Fatal error: Command failed for target `gdb'
What could be the possible issue and is there any solution for this?
It looks like some bug linking against the Solaris curses library. Offhand I can't diagnose it. It's worth digging into and patching upstream...
Meanwhile, you can probably work around it by configuring with --disable-tui.

link to boost library

I am trying to build a project using Boost's Asio , but I am getting linking error:
g++ -o homework main.o -L/usr/lib64/qt-3.3/lib -L/usr/X11R6/lib64 -L/home/student/boost_1_46_1/libs -lboost_system -lqt-mt -lXext -lX11 -lm
/usr/bin/ld: cannot find -lboost_system
collect2: ld returned 1 exit status
make: *** [homework] Error 1
How can I resolve the problem?
I think it's a typo. You said -l boost_system in command line, while it should be -lboost_system.
Update:
Nope! I get my answer back. Just found that it's OK to pass -l <libname>. In fact it's equal to -l<libname>. As others said, double-check paths.

Messed up Berkeley DB error message with C++ build of Fix8 in CentOS Linux

I built BerkleyDB successfully with the instructions found at:
http://www.linuxfromscratch.org/blfs/view/svn/server/db.html
I am trying to build Fix8 (fix8.org) on my CentOS 6.3 with a required dependency of BerkleyDB but I get a failed error:
libtool: link: g++ -g -O2 -Wall -rdynamic -o .libs/f8c f8c.o f8cutils.o f8precomp.o
-lrt /home/caustic/dev/dakka-fix8-b0a60e9/runtime/.libs/libfix8.so -lcrypt
-lPocoFoundation -lPocoNet -lPocoUtil -ltbb -L/home/caustic/dev/dakka-fix8-b0a60e9
/runtime -ldb_cxx -lz -Wl,-rpath -Wl,/usr/local/lib
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.4.6/../..
/../libdb_cxx.so when searching for -ldb_cxx
/usr/bin/ld: skipping incompatible /usr/lib/libdb_cxx.so when searching for -ldb_cxx
/usr/bin/ld: cannot find -ldb_cxx
collect2: ld returned 1 exit status
make: *** [f8c] Error 1
When I "ls" the specified problem file, I get:
[root#hft x86_64-redhat-linux]# ls /usr/lib/gcc/x86_64-redhat-linux/4.4.6/../.. /../libdb_cxx.so
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../libdb_cxx.so
[root#hft x86_64-redhat-linux]# ls -l /usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../libdb_cxx.so
lrwxrwxrwx. 1 root root 16 Nov 23 17:36 /usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../libdb_cxx.so -> libdb_cxx-5.3.so
I removed all older or conflicting instances of BerkleyDB using "yum remove". IS there any hints that can get me on track with this?
Thanks