when I open a terminal, switch to my project directory (which is in my home folder) and run the command "wmake" I get the error:
g++ -m32 -Dlinux -DWM_DP -Wall -Wextra -Wno-unused-parameter
-Wold-style-cast -O3 -DNoRepository -ftemplate-depth-100 -IphaseModel/lnInclude -ImultiphaseSystem/lnInclude -ImultiphaseFixedFluxPressure -IinterfacialModels/lnInclude -I/opt/openfoam221/src/transportModels -I/opt/openfoam221/src/transportModels/incompressible/lnInclude -I/opt/openfoam221/src/transportModels/interfaceProperties/lnInclude -I/opt/openfoam221/src/transportModels/incompressible/lnInclude -I/opt/openfoam221/src/transportModels/incompressible/singlePhaseTransportModel
-I/opt/openfoam221/src/turbulenceModels -I/opt/openfoam221/src/turbulenceModels/incompressible/LES/LESModel -I/opt/openfoam221/src/turbulenceModels/LES/LESdeltas/lnInclude -I/opt/openfoam221/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam221/src/OpenFOAM/lnInclude -I/opt/openfoam221/src/OSspecific/POSIX/lnInclude -fPIC -Xlinker --add-needed -Xlinker --no-as-needed Make/linuxGccDPOpt/multiphaseEulerFoam.o
-L/opt/openfoam221/platforms/linuxGccDPOpt/lib \
-lmultiphaseSystem -lcompressibleMultiPhaseModel -linterfaceProperties -lincompressibleTransportModels -lcompressibleMultiphaseEulerianInterfacialModels -lincompressibleLESModels -lincompressibleRASModels -lfiniteVolume -lOpenFOAM -ldl -lm -o /opt/openfoam221/platforms/linuxGccDPOpt/bin/multiphaseEulerFoam /usr/bin/ld: cannot open output file /opt/openfoam221/platforms/linuxGccDPOpt/bin/multiphaseEulerFoam: Permission denied collect2: ld returned 1 exit status make: * [/opt/openfoam221/platforms/linuxGccDPOpt/bin/multiphaseEulerFoam] Error 1
This error occured the first time today, yesterday everything compiled fine for me.
How can I fix this?
Related
Questions asked on stackoverflow about this question,have not been able to help me, this is complete error:
/usr/bin/ld: /tmp/ccgpX9K3.o: in function `connectDB(sql::Connection*)':
/home/erasmoh/sockets_c++/src/server.cpp:128: undefined reference to `get_driver_instance'
collect2: error: ld returned 1 exit status
i have tried this commands:
sudo g++ -Wall -I/usr/include/cppconn -o server server.cpp -L/usr/lib -lmysqlcppconn
g++ -g -o0 -I/usr/local/include -I/usr/local/boost/include -c server.cpp -o server.o
g++ -g -o0 -L/usr/local/lib -L/usr/local/mysql/lib server.o -o server -lmysqlcppconn
i have tried other ways to do it, creating a shared library as well, but, i getting the same error.
I am trying to compile a wallet for my JUMP coins (https://github.com/Jumperbillijumper/jumpcoin).
I cloned the repo,
cd to src/
and ran $ make -f makefile.unix
and now I am getting this error:
/home/pi/jumpcoin/jumpcoin/src/leveldb/libmemenv.a: error addingsymbols: Archive has no index; run ranlib to add one
collect2: error: ld returned 1 exit status
makefile.unix:206: recipe for target 'jumpcoind' failed
make: *** [jumpcoind] Error 1
Log:
pi#Raspberry_Pi:~/jumpcoin/jumpcoin/src $ make -f makefile.unix
/bin/sh ../share/genbuild.sh obj/build.h
g++ -c -O2 -pthread -Wall -Wextra -Wno-ignored-qualifiers -Wformat -Wformat-security -Wno-unused-parameter -g -DBOOST_SPIRIT_THREADSAFE -I/home/pi/jumpcoin/jumpcoin/src -I/home/pi/jumpcoin/jumpcoin/src/obj -DUSE_UPNP=0 -DUSE_IPV6=1 -I/home/pi/jumpcoin/jumpcoin/src/leveldb/include -I/home/pi/jumpcoin/jumpcoin/src/leveldb/helpers -DHAVE_BUILD_INFO -fno-stack-protector -fstack-protector-all -Wstack-protector -D_FORTIFY_SOURCE=2 -MMD -MF obj/txdb-leveldb.d -o obj/txdb-leveldb.o txdb-leveldb.cpp
g++ -O2 -pthread -Wall -Wextra -Wno-ignored-qualifiers -Wformat -Wformat-security -Wno-unused-parameter -g -DBOOST_SPIRIT_THREADSAFE -I/home/pi/jumpcoin/jumpcoin/src -I/home/pi/jumpcoin/jumpcoin/src/obj -DUSE_UPNP=0 -DUSE_IPV6=1 -I/home/pi/jumpcoin/jumpcoin/src/leveldb/include -I/home/pi/jumpcoin/jumpcoin/src/leveldb/helpers -DHAVE_BUILD_INFO -fno-stack-protector -fstack-protector-all -Wstack-protector -D_FORTIFY_SOURCE=2 -o jumpcoind obj/groestl.o obj/blake.o obj/skein.o obj/keccak.o obj/jh.o obj/alert.o obj/version.o obj/checkpoints.o obj/netbase.o obj/addrman.o obj/crypter.o obj/key.o obj/db.o obj/init.o obj/irc.o obj/keystore.o obj/miner.o obj/main.o obj/net.o obj/protocol.o obj/jumpcoinrpc.o obj/rpcdump.o obj/rpcnet.o obj/rpcmining.o obj/rpcwallet.o obj/rpcblockchain.o obj/rpcrawtransaction.o obj/script.o obj/sync.o obj/util.o obj/wallet.o obj/walletdb.o obj/noui.o obj/kernel.o obj/pbkdf2.o obj/scrypt.o obj/scrypt-arm.o obj/scrypt-x86.o obj/scrypt-x86_64.o obj/zerocoin/Accumulator.o obj/zerocoin/AccumulatorProofOfKnowledge.o obj/zerocoin/Coin.o obj/zerocoin/CoinSpend.o obj/zerocoin/Commitment.o obj/zerocoin/ParamGeneration.o obj/zerocoin/Params.o obj/zerocoin/SerialNumberSignatureOfKnowledge.o obj/zerocoin/SpendMetaData.o obj/zerocoin/ZeroTest.o obj/txdb-leveldb.o -Wl,-z,relro -Wl,-z,now -Wl,-Bdynamic -l boost_system -l boost_filesystem -l boost_program_options -l boost_thread -l db_cxx -l ssl -l crypto -l miniupnpc -Wl,-Bdynamic -l z -l dl -l pthread /home/pi/jumpcoin/jumpcoin/src/leveldb/libleveldb.a /home/pi/jumpcoin/jumpcoin/src/leveldb/libmemenv.a
/home/pi/jumpcoin/jumpcoin/src/leveldb/libmemenv.a: error adding symbols: Archive has no index; run ranlib to add one
collect2: error: ld returned 1 exit status
makefile.unix:206: recipe for target 'jumpcoind' failed
make: *** [jumpcoind] Error 1
ok the problem was in the src/leveldb directory (obviously)
I took the src/leveldb directory from this repo (https://github.com/sagacrypto/SagaCoin) and replaced the current one. Then everything works fine. (at least for me :P)
yeah I know it is not best practice but this one was driving me nuts :D
I installed Google perftools (google-perftools 1.7-1ubuntu1), and add -lprofiler to PKG_LIBS in R, when compiling the C++ code.
library(RcppArmadillo)
library(Rcpp)
Sys.setenv("PKG_CXXFLAGS"="-fopenmp")
Sys.setenv("PKG_LIBS"="-fopenmp -lprofiler")
sourceCpp('my.cpp')
The output is:
/usr/bin/ld: cannot find -lprofiler
collect2: ld returned 1 exit status
make: *** [sourceCpp_17496.so] Error 1
g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/RcppArmadillo/include" -fopenmp -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c my.cpp -o my.o g++ -shared -Wl,-Bsymbolic-functions -Wl,-z,relro -o sourceCpp_17496.so my.o -llapack -lblas -lgfortran -lm -lquadmath -fopenmp -fopenmp -lprofiler -L/usr/lib/R/lib -lR
Error in sourceCpp("my.cpp") :
Error 1 occurred building shared library.
WARNING: The tools required to build C++ code for R were not found.
Please install GNU development tools including a C++ compiler.
Even if I run g++ in bash, I get the same error
$ g++ -shared -Wl,-Bsymbolic-functions -Wl,-z,relro -o sourceCpp_17496.so my.o -llapack -lblas -lgfortran -lm -lquadmath -fopenmp -fopenmp -lprofiler -L/usr/lib/R/lib -lR
/usr/bin/ld: cannot find -lprofiler
collect2: ld returned 1 exit status
I wonder why -lprofiler doesn't specify google perfotools? How can I solve the problem? Thanks!
My g++ is g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3.
Quick ones:
Do you actually have the package libgoogle-perftools-dev installed? Ie do you have shared and static libraries /usr/lib/libprofiler.* ? This is the mother of all development FAQs: you need package libfoo to run code against foo, and package libfoo-dev to compile against foo.
I have old working examples in the slides from my 'HPC with R' talks from a few years ago; those should all work as is.
I just installed manually apr and apr_util so i can install activemq c++ library.
When i try to make the cpp library i get the following error:
**
libtool: link: g++ -ansi -pedantic -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -I/usr/local/apr/include/apr-1 -I/usr/local/apr/include/apr-1 -I/usr/kerberos/include -W -Wall -Wextra -Wconversion -fPIC -fstrict-aliasing -Wstrict-aliasing=2 -Wno-long-long -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -I/usr/local/apr/include/apr-1 -I/usr/local/apr/include/apr-1 -I/usr/kerberos/include -Wno-non-virtual-dtor -Wno-unused-parameter -Wno-uninitialized -I./../main -g -O2 -pthread -o .libs/example example-main.o ../main/.libs/libactivemq-cpp.so -lexpat -L/usr/kerberos/lib64 /usr/local/apr/lib/libaprutil-1.so /usr/local/apr/lib/libapr-1.so -luuid -lrt -lcrypt /usr/local/apr/lib/libexpat.so -lssl -lcrypto -ldl -lz -lpthread -pthread -Wl,-rpath -Wl,/usr/local/lib -Wl,-rpath -Wl,/usr/local/apr/lib
/usr/bin/ld: cannot find -lexpat
collect2: ld returned 1 exit status
**
and expat is within apr-util and not being linked. how can i update the ld path so that make or environment will find it?
or in short: how can i resolve this?
Usually you'll need to manually specify the library path using -L option.
It would look like ld filename -Lpath -llibname in a single ld operation. Or in this case you may need to add the paths of your library(apr-util here) to the constant of library paths in a Makefile.
I have a project that is a library that links against libresolv,
It works fine on recent distros: Ubuntu 10.x Fedora 13, Mandriva
2010.1 but on Centos 5.x I get the following errors
glibc installed is: glibc-2.5-18.el5_1.1
g++ -DHAVE_CONFIG_H -I. -I./include -I/usr/include/postgresql -O3
-ansi -Wall -Wno-deprecated -D_FORTIFY_SOURCE=0 -MT testUpLog.o -MD
-MP -MF .deps/testUpLog.Tpo -c -o testUpLog.o testUpLog.cc
mv -f .deps/testUpLog.Tpo .deps/testUpLog.Po
/bin/sh ./libtool --tag=CXX --mode=link g++ -O3 -ansi -Wall
-Wno-deprecated -D_FORTIFY_SOURCE=0 -L/usr/lib64 -L/lib64
-L/usr/lib64/mysql -o testUpLog testUpLog.o libUpTools.la -lpq
-lmysqlclient -lssl -lpthread
libtool: link: g++ -O3 -ansi -Wall -Wno-deprecated -D_FORTIFY_SOURCE=0
-o .libs/testUpLog testUpLog.o -L/usr/lib64 -L/lib64
-L/usr/lib64/mysql ./.libs/libUpTools.so -lpq -lmysqlclient -lssl
-lpthread
./.libs/libUpTools.so: undefined reference to `__ns_name_uncompress'
./.libs/libUpTools.so: undefined reference to `__ns_initparse'
./.libs/libUpTools.so: undefined reference to `__ns_parserr'
collect2: ld returned 1 exit status
make[1]: *** [testUpLog] Error 1
make[1]: Leaving directory `/tmp/UpTools-8.5.3'
make: *** [check-am] Error 2
library.la file contains:
dlname='libUpTools.so.0'
library_names='libUpTools.so.0.0.0 libUpTools.so.0 libUpTools.so'
old_library='libUpTools.a'
inherited_linker_flags=''
dependency_libs=' -L/usr/lib64 -L/lib64 -L/usr/lib64/mysql -lpq
-lmysqlclient -lssl -lpthread'
weak_library_names=''
current=0
age=0
revision=0
installed=no
shouldnotlink=no
dlopen=''
dlpreopen=''
libdir='/usr/lib'
You can read configure.ac on
http://pastebin.com/hs5q21Rq
Thanks in advance
If libUpTools uses functions lib libresolv, you need to say so:
libUpTools_la_LIBADD = -lresolv (of course -lresolv may be replaced by variables determined by configure etc.)
That way, -lresolv will end up in the .la file and also in the .so file (if you chose to build it) that you can run ldd on for verification.