Why is this? "error: clang: error: linker command failed with exit code 1 (use -v to see invocation)" - c

I was trying to build this Then i get this error
g++ -o rd_view -g -Wall libcs631.a rd_direct.o pnm_display.o -lm -lX11
ld: library not found for -lX11
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [rd_view] Error 1
I'm on m1 mac ventura. Any help will be appreciated. I tried installing libx11,Xquartz also.

You do not have libX11.a in your default library directories.
Locate (or/and install)it.
To install (ubuntu):
sudo apt-get install libx11-dev
To search
Use apt-file search [filename]
Location on my computer:
As an additional remark: move your libcs631.a after all the object files as libraries are are searched only one time so all needed symbols have to be known to the linker before it searches the library.


How to fix 'sincos##GLIBC_2.2.5' undefined reference for fftw3 library

I have been trying to install and execute a c-program using fftw3 library on Ubuntu machine but getting this error so many times.
How to fix the error? Help is much appreciated.
latest source code was downloaded: http://www.fftw.org/download.html
Install commands:
sudo -H ./configure --enable-float --enable-sse --enable-threads
sudo -H make
sudo -H make install
Trying to compile:
gcc -Wall -O3 -o jediconvolve jediconvolve.c -L /usr/local/lib -lm -lcfitsio -lfftw3f
bhishan#jedisim_sources:gcc -Wall -O3 -o jediconvolve jediconvolve.c -L /usr/local/lib -lm -lcfitsio -lfftw3f
/usr/bin/ld: /usr/local/lib/libfftw3f.a(trig.o): undefined reference to symbol 'sincos##GLIBC_2.2.5'
/lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
file jediconvolve.c to test

Error while trying to create shared library

I am trying to create the shared library (.so) so that I can call it using .External command from R for the lassoshooting package:
Basically, I have downloaded the package source from the above website. However, when I go the the correct directory (.../lassoshooting/src) and use the command
R CMD SHLIB -o ccd_r.so ccd_r.c
I get the following error:
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined
dynamic_lookup -single_module -multiply_defined suppress
-L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o ccd_r.so ccd_r.o -L/Library/Frameworks/R.framework/Resources/lib
-lRblas -L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2 -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [ccd_r.so] Error 1
Why is this happening?

Openssl (OS X Yosemite) Installation Make Errors

While OpenSSL ver. 0.9.8za was already installed on my system (darwin64-x86_64-cc), I elected to install the latest version, 1.0.1j, using the instructions for UNIX systems, in the "INSTALL" file within the downloaded tarball. I chose to configure with the 64-bit option, './Configure darwin64-x86_64-cc', and then ran the makefile. So far, so good. After about a minute, as I was thinking the installation would be successful, the compiler displayed following error messages, after compilation terminated:
Compile command line: './Configure darwin64-x86_64-cc' (Openssl suggestion for 64-bit)
duplicate symbol _OPENSSL_cleanse in:
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [link_app.] Error 1
make[1]: *** [openssl] Error 2
make: *** [build_apps] Error 1
The problem appears to originate in the linker, but then again, I'm still a command line novice.
So, given this error, what needs to be changed in order to fully compile OpenSSL 1.0.1j?
When the automatic configuration route was taken (./config), the following error is given:
cc -I.. -I../.. -I../modes -I../asn1 -I../evp -I../../include -DOPENSSL_THREADS -D_REENTRANT
DDSO_DLFCN -DHAVE_DLFCN_H -arch i386 -O3 -fomit-frame-pointer -DL_ENDIAN
DGHASH_ASM -c -o obj_xref.o obj_xref.c
ar r ../../libcrypto.a o_names.o obj_dat.o obj_lib.o obj_err.o obj_xref.o
ar: ../../libcrypto.a is a fat file (use libtool(1) or lipo(1) and ar(1) on it)
ar: ../../libcrypto.a: Inappropriate file type or format
make[2]: *** [lib] Error 1
make[1]: *** [subdirs] Error 1
make: *** [build_crypto] Error 1
Update: The "PROBLEMS" documentation suggests changing two lines in the apps/Makefile and test/Makefile:
"LIBCRYPTO= -L.. -lcrypto"
"LIBSSL=-L -lssl"
Re-attempting make afterward, the same message was given.
My sincere thanks for the help and comments by jww, Jonathan L. and others gave/made. Should errors persist, I'll continue the search for the missing information and eventually post a solution.
I'm not sure what your problem is. Using XCode 6 (6.1.1, I believe) on Yosemite 10.10.1, I was able to get openssl-1.0.1j from OpenSSL.org and extract it. I then configured it with:
./Configure --prefix=/usr/openssl/openssl-1.0.1j darwin64-x86_64-cc zlib threads shared
With those, I was able to build, test and install without problem. That's pretty close to what you did; I simply have noted the presence of zlib (compression) and requested thread and shared library support — and specified a slightly out-of-the-way location to install it. (The top-level directory specified with --prefix existed but was empty.) I tried adding sctp to the configuration options, but no dice — an SCTP header is missing, so I didn't bother to try further.

gcc creates a different folder base on its version

When I try to rpmbuild something I got this error message
checking for x86_64-redhat-linux-gcc... no
checking for gcc... no
checking for x86_64-redhat-linux-cc... no
checking for cc... no
checking for x86_64-redhat-linux-cl.exe... no
checking for cl.exe... no
And I found out that, the tool are in /usr/bin/gcc48 what I did is link the gcc48 to gcc folder: Which I got the idea from this link https://stackoverflow.com/a/13327320/612920
ln /usr/bin/gcc48 /usr/bin/gcc
And when I tried to run rpmbuild again I got this error message:
checking for x86_64-redhat-linux-gcc... no
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/usr/src/rpm/BUILD/courier-unicode-1.1':
configure: error: C compiler cannot create executables
See `config.log' for more details
error: Bad exit status from /var/tmp/rpm-tmp.jrbnrw (%prep)
What is wrong? I had already installed all development tools and its on its latest versions. Can Somebody help me?
And by the way I am using Amazons Redhat (gcc version 4.8.2 20131212 (Red Hat 4.8.2-7) (GCC))
configure:3499: $? = 0
configure:3488: gcc -v >&5
Using built-in specs.
Target: x86_64-amazon-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugu$
Thread model: posix
gcc version 4.8.2 20131212 (Red Hat 4.8.2-7) (GCC)
configure:3499: $? = 0
configure:3488: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:3499: $? = 4
configure:3488: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'
gcc: fatal error: no input files
compilation terminated.
configure:3499: $? = 4
configure:3519: checking whether the C compiler works
configure:3541: gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp$
collect2: fatal error: cannot find 'ld'
compilation terminated.
configure:3545: $? = 1
configure:3583: result: no
configure: failed program was:
| /* end confdefs.h. */
| int
| main ()
| {
| ;
| return 0;
| }
configure:3588: error: in `/home/falko/rpm/BUILD/courier-unicode-1.1':
configure:3590: error: C compiler cannot create executables
gcc is one of a number of tools required to build a software package, and as you can see from the error in your config.log, some more are missing from your system:
collect2: fatal error: cannot find 'ld'
It is complaining that it cannot find the system linker (ld).
Before addressing this, I recommend you set the gcc version to be used correctly. Unfortunately the advice you followed from https://stackoverflow.com/a/13327320/612920 is somewhat incomplete.
Redhat based systems provide a mechanism for being able to switch between different implementations of a piece of software at will (for example, different versions). This tool is called alternatives. You should use that to set the GCC version that will be used when you run 'gcc' at the command line. It will update a whole set of symlinks, not just the one you manually set.
sudo alternatives --config gcc
After doing this set the linker to be used:
sudo alternatives --config ld
Note that when I've tried out an AMI linux image, I found that by installing gcc like this:
sudo yum install gcc48
it automatically set the correct 'alternatives' for the newly installed compiler and corresponding linker. I'm not sure how your system got into the state that it is currently in, but if you still have problems after the above procedure, I recommend uninstalling and re-installing gcc and binutils.
After a couple of research I had found out that I am just lacking of ld(GNU linker) tool from RedHat's developer tool set and I also found out that there is an alternative tool just in case ld(GNU linker) is not available, ld.bfd(alternative to the GNU linker) which is in my case it is available. What I did, I make a link from ld.bfd to ld:
ln /usr/bin/ld.bfd /usr/bin/ld
I don't know if it is the proper solution but it works for me.
Reference: Red_Hat_Developer_Toolset

Error occurs when compiling with GCC

I am attempting to compile a C program with multiple files on window platform. However, when I make it, errors are occurred. I have already tried to modify command in makefile but still could not fix it.
This is my GCC command:
gcc -o "SYSMONTR" $(OBJPATH)/chkdsksp ../chkdsksp.c -g -I"$(DB2PATH)/include" -I"$(MYLIBDIR)" $(MYIQDIR)/iqclilib.a $(OBJPATH)/icrou.a -lc -ldb2 -lnsl -L"$(DB2PATH)/lib"
This is result:
gcc -o "SYSMONTR" ../../iLINKOBJ/chkdsksp ../chkdsksp.c -g -I"C:/Program Files/IBM/SQLLIB/include" -I"../../iLINKCLIB" ../../iLINKIQOBJ/iqclilib.a ../../iLINKOBJ/icrou.a -lc -ldb2 -lnsl -L"C:/Program Files/IBM/SQLLIB/lib"
../../iLINKOBJ/chkdsksp: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
makefile:49: recipe for target `SYSMONTR' failed
make: *** [SYSMONTR] Error 1
What could cause such error and what should I do with it? Using cygwin on Window (IDE: Eclipse).
Any supports will be appreciated.
If chkdsksp is an object file built by another team to run on AIX, you cannot expect it to function -- or even be recognized by your compiler -- on Cygwin. You must contact that team and get a) the source code or b) a version of the object file compiled for your platform (and tested).