I write this command:
gcc drr.c -o drr -pthread -lcdsl -L./../synch_implementations -I./../synch_implementations
And I can't understand why I get this response:
usr/bin/ld: ./../synch_implementations/libcdsl.a(cdsl_queue_list.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
usr/bin/ld: ./../synch_implementations/libcdsl.a(cdsl_deque_list.o): relocation R_X86_64_32S against symbol `cdsl_deque_list_lock_based_pthread_push_tail' can not be used when making a PIE object; recompile with -fPIC
usr/bin/ld: ./../synch_implementations/libcdsl.a(cdsl_lock.o): relocation R_X86_64_32S against symbol `cdsl_pthread_lock_request' can not be used when making a PIE object; recompile with -fPIC
usr/bin/ld: final link failed: Nonrepresentable section on output
ollect2: error: ld returned 1 exit status
Can anyone help me understand what is wrong?
Notes:
1)I use ubuntu (via VirtualBox).
2)I am very inexperienced, so probably this is not a very bright question.
Solution:
When you compile ./../synch_implementations/libcdsl.a you need to add an extra "-fPIC" flag to produce position-independent-code (see comments above).
Note:
The PIC flag is in general needed when producing library object code since it creates objects relative to a global offset table (GOT) which subsequently allows to link library objects with your code.
this is a bit of a long shot but:
I'm following this guide: https://www.tutorialspoint.com/postgresql/postgresql_c_cpp.htm
But when running ./configure I get the following error:
(previous checking lines omitted for brevity)
checking for main in -lpq... yes
checking for PQexec in -lpq... yes
checking for correct C++ linkage of basic libpq functions...
sed: character class syntax is [[:space:]], not [:space:]
configure: error:
Linking a call to libpq failed in C++, even though it succeeded in C. If your
C and C++ compilers are very different beasts, this may mean that we do not have
the right options for linking with it after all.
Read the config.log file for more detailed information. Look for the last error
message, which may be several pages up from the end of the file.
And the configure.log file looks like this:
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by libpqxx configure 4.0, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ ./configure
## --------- ##
## Platform. ##
## --------- ##
(some lines omitted)
configure:3039: g++ -V >&5
g++: error: unrecognized command line option '-V'
g++: fatal error: no input files
compilation terminated.
configure:3050: $? = 1
configure:3039: g++ -qversion >&5
g++: error: unrecognized command line option '-qversion'; did you mean '--version'?
g++: fatal error: no input files
compilation terminated.
(some lines omitted)
configure:7629: gcc -E conftest.c
conftest.c:11:10: fatal error: ac_nonexistent.h: No such file or directory
#include <ac_nonexistent.h>
^~~~~~~~~~~~~~~~~~
compilation terminated.
(some lines omitted)
configure:8319: gcc -c -g -O2 -fno-rtti -fno-exceptions conftest.c >&5
cc1: warning: command line option '-fno-rtti' is valid for C++/ObjC++ but not for C
(some lines omitted)
configure:16424: g++ -o conftest -g -O2 -L/usr/lib/x86_64-linux-gnu conftest.cpp >&5
/tmp/ccfFBf4K.o: In function `main':
/home/peter/libpqxx-4.0/conftest.cpp:44: undefined reference to `PQexec'
collect2: error: ld returned 1 exit status
(some liens omitted)
I don't believe I have any packages missing. I have the newest version of g++, psql and libpqxx installed.
I have updated and upgraded all packages on my system.
I have crawled the web for solutions to this error, but I have no clue what is wrong.
Do you have an idea where I can go from here?
There hasn't been a tarball release of libpqxx at the old spot in a long time, so the tutorial you used with its wget command to download the tarball is very outdated.
The issue you encountered looks related to this issue and appears to have been fixed in this commit:
commit 85e9336740475be25ed19924cca0961f7d844c4b
Author: Jeroen Vermeulen <jtvjtv#gmail.com>
Date: Thu Jun 1 11:39:08 2017 +0700
Fix #13: not linking to libpq.
This was that annoying interaction between autoconf, m4, GNU sed syntax,
and the shell which broke the "remove redundant -lpq options" code in
the configure script.
Solution: forget about GNU sed's "[[:space:]]" syntax, and just look for
a literal space. There aren't going to be any tabs, newlines,
non-breaking spaces, etc. there in even a moderately sane world.
I'm using poky and meta-openembedded(git://git.openembedded.org/meta-openembedded(branch: master)) in yocto
I want to build metacity and cyrus-sasl(2.1.26) for my SDK platform
I run the following command
I add BBCLASSEXTEND += " nativesdk" to metacity's bb
and run bitbake nativesdk-metacity
but I will get error message
ERROR: Nothing RPROVIDES 'nativesdk-dbus-x11' (but virtual:nativesdk:poky/meta/rec on or otherwise requires it)
ERROR: Nothing RPROVIDES 'nativesdk-dbus-x11' (but virtual:nativesdk:poky/meta/recipes-core/dbus/dbus-glib_0.110.bb RDEPENDS on or otherwise requires it) ERROR: Required build target 'nativesdk-metacity' has no buildable providers. Missing or unbuildable dependency chain was: ['nativesdk-metacity', 'nativesdk-libcanberra', 'nativesdk-pulseaudio', 'nativesdk-gconf', 'nativesdk-dbus-glib', 'nativesdk-dbus-x11']
ERROR: Nothing PROVIDES 'dbus-x11'. Close matches:
dbus RPROVIDES dbus-x11
I cannot find dbus-x11's bb in my all meta
and I cannot see dbus-x11 then run bitbake -s
How can I enable dbus-x11 ??
and...
I also add BBCLASSEXTEND += " nativesdk" to cyrus-sasl_2.1.26.bb
and bitbake nativesdk-cyrus-sasl
get error message
| x86_64-pokysdk-linux-gcc --sysroot=/poky/build-fw/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-cyrus-sasl/2.1.26-r0/recipe-sysroot -O2 -pipe -Wl,-O1 -o saslauthd mechanisms.o auth_dce.o auth_getpwent.o auth_krb5.o auth_krb4.o auth_pam.o auth_rimap.o auth_httpform.o auth_shadow.o auth_sia.o auth_sasldb.o lak.o auth_ldap.o cache.o cfile.o krbtf.o utils.o ipc_unix.o ipc_doors.o saslauthd-main.o md5.o -lresolv
| auth_getpwent.o: In function `auth_getpwent':
| auth_getpwent.c:(.text+0x42): undefined reference to `crypt'
| auth_shadow.o: In function `auth_shadow':
| auth_shadow.c:(.text+0x109): undefined reference to `crypt'
| collect2: error: ld returned 1 exit status
| Makefile:456: recipe for target 'saslauthd' failed
How can I add -lcrypt to cyrus-sasl_2.1.26.bb bb??
thanks a lot
John
I have a code by name mexCodeCuda.cu which uses dynamic parallelism. In the matlab interface, when I try to execute the following commands, I get the following error :
system('nvcc --compile mexCodeCuda.cu -o mexCodeCuda.o --compiler-options -fPIC -m64 -rdc=true -gencode arch=compute_35,code=sm_35 -O3 -lineinfo -use_fast_math -lcudadevrt -I/cm/shared/apps/MATLAB/extern/include')
system('nvcc -arch=sm_35 -dlink mexCodeCuda.o -o dlink.o')
eval('mex mexCodeCuda.o dlink.o -L'CUDA_LIB_PATH '-lcudart')
It gives the following error :
Error using mex
/usr/bin/ld: dlink.o: relocation R_X86_64_32S against `__nv_module_id' can
not be used when making a shared object; recompile with -fPIC
dlink.o: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
Can anyone help me ?
Thanks in advance...
A few changes:
Add -fPIC to the second nvcc command (using --compiler-options, just as you did with the first nvcc).
Specify the cudadevrt runtime option on the mex command (-lcudadevrt), just as you have with the first nvcc call.
And you may need to add -fPIC to the mex linking via LDCXXFLAGS or LDFLAGS. Not sure.
So I am really not a Fortran programmer at all, but I have some code I am working with that uses the pgplot graphics libraries in fortran. I am able to get the code running in fortran from the console using the following commands.
gfortran -o simple discrete.f -lpgplot -IX11
discrete.f is the name of the file. So this works when I run it from the console. However, I want to run the code in the eclipse photran plugin so that I can use the debugger so that I can step through the code and observe some of the variables. I tried to put the -lpgplot and -IX11 flags in Eclipse, but I am getting errors about pgbbuf and pgnumb_ functions as undefined reference (which means that the -lpgplot function is not working when called from eclipse.
Can anyone please tell me how to set the flags correctly to run this code in Photran so that I can compile it and see the pgplot figure come up?
I am adding the console output:
02:57:05 **** Clean-only build of configuration Debug for project burglar_code_martin ****
make clean
rm -rf ./burglary_model.o burglar_code_martin
02:57:05 Build Finished (took 61ms)
02:57:05 **** Build of configuration Debug for project burglar_code_martin ****
make all
Building file: ../burglary_model.f
Invoking: GNU Fortran Compiler
gfortran -funderscoring -I/usr/lib -O0 -g -Wall -c -fmessage-length=0 -lpgplot -IX11 -o "burglary_model.o" "../burglary_model.f"
Warning: Nonconforming tab character in column 1 of line 225
Warning: Nonconforming tab character in column 1 of line 228
../burglary_model.f:155.27:
call probcheck(frac,1,outc)
1
Warning: Rank mismatch in argument 'problist' at (1) (rank-1 and scalar)
../burglary_model.f:54.33:
call probcheck(robprob,1,outcome)
1
Warning: Rank mismatch in argument 'problist' at (1) (rank-1 and scalar)
../burglary_model.f:95.30:
call probcheck(placeprob,1,outcome)
1
Warning: Rank mismatch in argument 'problist' at (1) (rank-1 and scalar)
../burglary_model.f:206.36:
subroutine output(A,burgsatloc,t,l,pic,screen,A0,Bbar)
1
Warning: Unused dummy argument 'burgsatloc' at (1)
../burglary_model.f:206.44:
subroutine output(A,burgsatloc,t,l,pic,screen,A0,Bbar)
1
Warning: Unused dummy argument 'pic' at (1)
../burglary_model.f:206.51:
subroutine output(A,burgsatloc,t,l,pic,screen,A0,Bbar)
1
Warning: Unused dummy argument 'screen' at (1)
../burglary_model.f:145.32:
integer l,pic,screen,i,j,k,PGOPEN,burgsatloc(512,*),nbar,outc
1
Warning: Unused variable 'k' declared at (1)
../burglary_model.f:146.15:
real rand,red,green,blue
1
Warning: Unused variable 'rand' declared at (1)
../burglary_model.f:143.53:
subroutine initialize(burgsatloc,B,l,pic,screen,rbar,Bbar)
1
Warning: Unused dummy argument 'screen' at (1)
../burglary_model.f:4.58:
integer i,j,n,l,pic,screen,guy,burgsatloc(512,512),k,
1
Warning: Unused variable 'k' declared at (1)
Finished building: ../burglary_model.f
Building target: burglar_code_martin
Invoking: GNU Fortran Linker
gfortran -lpgplot -IX11 -o "burglar_code_martin" ./burglary_model.o
./burglary_model.o: In function `output_':
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:241: undefined reference to `pgbbuf_'
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:242: undefined reference to `pgnumb_'
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:244: undefined reference to `pgenv_'
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:246: undefined reference to `pglab_'
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:247: undefined reference to `pgimag_'
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:253: undefined reference to `pgebuf_'
./burglary_model.o: In function `initialize_':
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:165: undefined reference to `pgopen_'
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:168: undefined reference to `pgpap_'
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:169: undefined reference to `pgask_'
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:170: undefined reference to `pgscir_'
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:175: undefined reference to `pgscr_'
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:181: undefined reference to `pgscr_'
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:187: undefined reference to `pgscr_'
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:193: undefined reference to `pgscr_'
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:199: undefined reference to `pgscr_'
./burglary_model.o: In function `implicit':
/media/jaimini/workspace/eclipsejuno/burglar_code_martin/Debug/../burglary_model.f:109: undefined reference to `pgclos_'
collect2: ld returned 1 exit status
make: *** [burglar_code_martin] Error 1
02:57:05 Build Finished (took 209ms)