I need to start working on a project with SystemC. I managed to compile SystemC according to this instructions: how to use and install SystemC in terminal mac OS X?
Afterwards I adjusted the SYSTEMC_HOME variable in Makefile.config to "SYSTEMC_HOME?=~/Work/Other/systemc-2.3.1"
The problem occurs when i try to compile and run any of the provided examples.
The error I get is:
ld: unknown option: -rpath=/Users/admin/Work/Other/systemc-2.3.1/lib
clang: error: linker command failed with exit code 1
(use -void to see invocation)
The command I run is:
make -f Makefile run
And the whole output from the console:
simple_fifo admin$ make -f Makefile run
clang++ -fcolor-diagnostics -g -Wall -pedantic -Wno-long-long -Werror -L. -L.. -L /Users/admin/Work/Other/systemc-2.3.1/lib -Wl,-rpath=/Users/admin/Work/Other/systemc-2.3.1/lib -o simple_fifo.x simple_fifo.o -lsystemc -lm 2>&1 | c++filt
ld: unknown option: -rpath=/Users/admin/Work/Other/systemc-2.3.1/lib
clang: error: linker command failed with exit code 1 (use -void to see invocation)
make: *** [simple_fifo.x] Error 1
Any hints on what to look for would be highly appreciated.
= is a GNU linker feature, not Clang.
Edit examples/sysc/Makefile.rules and replace:
LDFLAG_RPATH ?= -Wl,-rpath=
with
LDFLAG_RPATH ?= -Wl,-rpath,
Related
I'm attempting to make a dylib using multiple files with the command:
g++ -std=c++11 rewrite.cpp Utilities/*.cpp -fpermissive -I /Users/x/Desktop/lua-5.1 -L/Users/x/Desktop/libs /usr/local/bin/lua -lm -ldl -o /Users/x/Desktop/Code/Result.dylib -v
However I'm encountering the error: ld: can't link with a main executable file '/usr/local/bin/lua' for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am working on mac system.
g++ version is "Apple clang version 12.0.0 (clang-1200.0.32.2) Target: x86_64-apple-darwin20.6.0"(I typed g++ --version).
I need to install a c++ package with command - ' $(COMPILER) $(FLAGS) <file_name>.o output.o -lm -o <file_name> '
What should I write in the place of $(FLAGS)?
This link says there is no flag for g++-12. Then, should I update the version of g++?
P.S.
Thanks who commented.
After reading all those, I tried to reinstall the package.
I know now that g++ version is 11.
I typed - 'g++ -std=c++11 <file_name>.o -lm -o <file_name>'
It worked without any error. There is a file in that folder with the name '<file_name>.o'.
After the installation (without any error) I typed - 'g++ <file1_name>.cpp -o <file1_name>' I have got an error -
Undefined symbols for architecture x86_64:
...
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
So, what should I do now?
I am new to OpenMP, and my professor gives us a project to do. There are only three files in the folder: a C++ source code a0.cpp, a header a0.h, and a Makefile. When I want to run the code in my terminal, it says:
clang: error: unsupported option '-fopenmp'
clang: error: unsupported option '-fopenmp'
make: *** [a0] Error 1
I am using a Macbook, and I do not know how to fix this. Can you help me? Thanks.
After installing libomp with homebrew using:
brew install libomp
I was able to compile an OpenMP program with this:
clang -Xpreprocessor -fopenmp -I/usr/local/include -L/usr/local/lib -lomp main.c -o main
If you are using C++, you'd likely want:
clang++ -Xpreprocessor -fopenmp -I/usr/local/include -L/usr/local/lib -lomp main.cpp -o main
I'm new to c++ rest sdk Casablanca and using it in Codelite ide.
Operating System : Arch Linux
gcc version : 6.1.1
While building the code I get the following error in debug mode:
/bin/sh -c '/usr/bin/make -j4 -e -f Makefile'
----------Building project:[ Casa - Debug ]----------
make[1]: Entering directory '/home/vinci/Documents/CPP_Projects_Programs/Casa'
/usr/bin/g++ -c "/home/vinci/Documents/CPP_Projects_Programs/Casa/main.cpp" -g -O0 -fopenmp -std=c++14 -std=c++11 -Wall -o ./Debug/main.cpp.o -I. -I/usr/local/include/cpprest -I/usr/local/include/pplx -I/home/vinci/casablanca/Release/src -I. -I/usr/local/include/cpprest -I/usr/local/include/pplx
/usr/bin/g++ -o ./Debug/Casa #"Casa.txt" -L. -L/usr/local/lib -L/usr/lib64 -L/usr/lib -lcpprest
/usr/bin/ld: ./Debug/main.cpp.o: undefined reference to symbol '_ZN5boost6system15system_categoryEv'
/usr/lib/libboost_system.so.1.60.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[1]: *** [Casa.mk:79: Debug/Casa] Error 1
make[1]: Leaving directory '/home/vinci/Documents/CPP_Projects_Programs/Casa'
make: *** [Makefile:5: All] Error 2
====1 errors, 0 warnings, total time: 00:00:14 seconds====
I searched this on Stackoverflow before asking and most of the answers just pointed to linking the libraries properly in project settings and I have done that as one can see in the code above but still keeps giving the error and I don't know what am i missing??
A little Help would be appreciated...
Thank You
/usr/lib/libboost_system.so.1.60.0: error adding symbols: DSO missing from command line
This DSO error means that libboost_system is missing from the command line.
You should also add:
-lboost_system
to your command line just like -lcpprest
This can happen if you reference libraries in the wrong order. I have a personal library that depends on -lboost_system, but I had listed my own library after the boost library and was getting this error. I moved my personal library to the front of the list, and the error went away.
I am trying to install and run a this project. It is written in C++ and R. I follow the instructions and when I type the make command, I get this error:
R CMD SHLIB src/C/util.c src/C/factor_model_util.c src/C/pagerank.c src/C/hierarchical.c src/C/factor_model_multicontext.c src/C/factor_model_util2.cpp -o lib/c_funcs.so
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 lib/c_funcs.so src/C/util.o src/C/factor_model_util.o src/C/pagerank.o src/C/hierarchical.o src/C/factor_model_multicontext.o src/C/factor_model_util2.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -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 -Wall -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[1]: *** [lib/c_funcs.so] Error 1
make: *** [c_funcs] Error 1
Here is my "clang --version" results:
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.3.0
Thread model: posix
Does anyone know what should I do? I saw the answers about xcode projects, but here I am only trying to use make for compiling.
Thanks
I had a very similar issue, and solved it by installing the newer gfortran 4.8.2. For some reason the main page links to version 4.3.2, which causes this issue (I believe because R binaries are actually built with a newer gfortran).