SDL project CMake build failure - c++

I try to set up an SDL project using CMake, but it seems like the executable isn't linked properly.
This is the CMakeLists.txt I use
cmake_minimum_required(VERSION 3.0)
project(MuspellsheimR)
# includes cmake/FindSDL2.cmake
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)
# find SDL2
find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIR})
set(SOURCE_FILES src/main.cpp)
add_executable(MuspellsheimR ${SOURCE_FILES})
target_link_libraries(MuspellsheimR ${SDL_LIBRARY})
src/main.cpp looks like this:
#include <iostream>
#include <SDL.h>
int main(int, char**){
if (SDL_Init(SDL_INIT_VIDEO) != 0){
std::cout << "SDL_Init Error: " << SDL_GetError() << std::endl;
return 1;
}
SDL_Quit();
return 0;
}
Here is the log output.
[omtcyf0#localhost MuspellsheimR_Build]$ cmake -G "Unix Makefiles" ../MuspellsheimR
-- The C compiler identification is GNU 5.1.1
-- The CXX compiler identification is GNU 5.1.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found SDL2: /usr/local/lib/libSDL2main.a;/usr/local/lib/libSDL2.so;-lpthread
-- Configuring done
-- Generating done
-- Build files have been written to: /home/omtcyf0/Desktop/MuspellsheimR_Build
[omtcyf0#localhost MuspellsheimR_Build]$
[omtcyf0#localhost MuspellsheimR_Build]$ ls
CMakeCache.txt CMakeFiles cmake_install.cmake Makefile
[omtcyf0#localhost MuspellsheimR_Build]$ make
Scanning dependencies of target MuspellsheimR
[100%] Building CXX object CMakeFiles/MuspellsheimR.dir/src/main.cpp.o
Linking CXX executable MuspellsheimR
CMakeFiles/MuspellsheimR.dir/src/main.cpp.o: In function `main':
main.cpp:(.text+0x25): undefined reference to `SDL_Init'
main.cpp:(.text+0x3e): undefined reference to `SDL_SetVideoMode'
main.cpp:(.text+0x51): undefined reference to `SDL_RWFromFile'
main.cpp:(.text+0x5e): undefined reference to `SDL_LoadBMP_RW'
main.cpp:(.text+0x7c): undefined reference to `SDL_UpperBlit'
main.cpp:(.text+0x88): undefined reference to `SDL_Flip'
main.cpp:(.text+0x92): undefined reference to `SDL_Delay'
main.cpp:(.text+0x9e): undefined reference to `SDL_FreeSurface'
main.cpp:(.text+0xa3): undefined reference to `SDL_Quit'
collect2: error: ld returned 1 exit status
CMakeFiles/MuspellsheimR.dir/build.make:85: recipe for target 'MuspellsheimR' failed
make[2]: *** [MuspellsheimR] Error 1
CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/MuspellsheimR.dir/all' failed
make[1]: *** [CMakeFiles/MuspellsheimR.dir/all] Error 2
Makefile:116: recipe for target 'all' failed
make: *** [all] Error 2
What am I doing wrong?

SDL_LIBRARY is the wrong variable. You need to use SDL2_LIBRARY.

Related

Build using cmake a g++ command with -I,-L and -l

This is the program I want to run, main.cpp:
#include <iostream>
#include "yaracpp/yaracpp.h"
int main() {
yaracpp::YaraDetector yara;
yara.addRules(R"(
rule example {
strings:
$s = "Hello"
condition:
$s
})");
if (yara.analyze("test_file")) {
for (const auto& rule : yara.getDetectedRules()) {
std::cout << rule << '\n';
}
}
}
When I run this command on the terminal it compiles successfully:
g++ -Iinclude -Ibuild/deps/yara/src/yara/libyara/include/ -Lbuild/src/ -Lbuild/deps/yara/src/yara/libyara/.libs/ main.cpp -lyaracpp -lyara -lpthread -lssl -lcrypto
My CMakeLists.txt is:
cmake_minimum_required(VERSION 3.6)
project(main CXX C)
add_executable(main main.cpp)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Iinclude -Ibuild/deps/yara/src/yara/libyara/include -Lbuild/src -Lbuild/deps/yara/src/yara/libyara/.libs/")
target_link_libraries (main yaracpp yara pthread ssl crypto)
This happens when I try to build it:
cmake .
-- The CXX compiler identification is GNU 7.4.0
-- The C compiler identification is GNU 7.4.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mevasu/yaracpp
make
[ 50%] Building CXX object CMakeFiles/main.dir/main.cpp.o
/home/mevasu/yaracpp/main.cpp:2:10: fatal error: yaracpp/yaracpp.h: No such file or directory
#include "yaracpp/yaracpp.h"
^~~~~~~~~~~~~~~~~~~
compilation terminated.
CMakeFiles/main.dir/build.make:62: recipe for target 'CMakeFiles/main.dir/main.cpp.o' failed
make[2]: *** [CMakeFiles/main.dir/main.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/main.dir/all' failed
make[1]: *** [CMakeFiles/main.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
Looking at the output, there is the following line:
c++: error: yaracpp/main.cpp: No such file or directory
Does the file exist? Looking at your CMakeLists.txt, the file appears in the following command:
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} [..] yaracpp/main.cpp ")
^^^^^^^^^^^^^^^^
Why do you add yaracpp/main.cpp into CMAKE_CXX_FLAGS when it (apparently) has already been added in the following line?
add_executable(main main.cpp)
^^^^^^^^
I highly suggest learning the basics of CMake before continuing in your endeavors.

'undefined reference to' when using GTK with CMake

I'm trying to build basic GTK+ code(one of its tutorials) with CMake, but I keep getting 'undefined reference to *' where * is any GTK function that is in the code. I tried to look after guides/tutorials on this, but most of them are mostly similar to what I have.
Regular compilation from terminal works without a problem using command:
g++ ./test.cpp -o test `pkg-config --cflags --libs gtk+-3.0`
When I try using CMake my CMakeLists.txt is:
cmake_minimum_required(VERSION 3.0.2)
project(gtktest)
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
include_directories(${GTK3_INCLUDE_DIRS})
link_directories(${GTK3_LIBRARY_DIRS})
add_definitions(${GTK3_CFLAGS_OTHER})
add_executable(gtktest test.cpp)
target_link_libraries(gtktest ${GKT3_LIBRARIES})
Now cmake . seems to work without problems
cmake .
-- The C compiler identification is GNU 7.4.0
-- The CXX compiler identification is GNU 7.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- Checking for module 'gtk+-3.0'
-- Found gtk+-3.0, version 3.22.30
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dfdark/Desktop/gtk test
But make command after that is the problem:
make
Scanning dependencies of target gtktest
[ 50%] Building CXX object CMakeFiles/gtktest.dir/test.cpp.o
[100%] Linking CXX executable gtktest
CMakeFiles/gtktest.dir/test.cpp.o: In function `activate(_GtkApplication*, void*)':
test.cpp:(.text+0x27): undefined reference to `gtk_application_window_new'
test.cpp:(.text+0x30): undefined reference to `gtk_window_get_type'
test.cpp:(.text+0x42): undefined reference to `g_type_check_instance_cast'
test.cpp:(.text+0x51): undefined reference to `gtk_window_set_title'
test.cpp:(.text+0x56): undefined reference to `gtk_window_get_type'
test.cpp:(.text+0x68): undefined reference to `g_type_check_instance_cast'
test.cpp:(.text+0x7a): undefined reference to `gtk_window_set_default_size'
test.cpp:(.text+0x86): undefined reference to `gtk_widget_show_all'
CMakeFiles/gtktest.dir/test.cpp.o: In function `main':
test.cpp:(.text+0xcc): undefined reference to `gtk_application_new'
test.cpp:(.text+0xfb): undefined reference to `g_signal_connect_data'
test.cpp:(.text+0x100): undefined reference to `g_application_get_type'
test.cpp:(.text+0x112): undefined reference to `g_type_check_instance_cast'
test.cpp:(.text+0x126): undefined reference to `g_application_run'
test.cpp:(.text+0x135): undefined reference to `g_object_unref'
collect2: error: ld returned 1 exit status
CMakeFiles/gtktest.dir/build.make:94: recipe for target 'gtktest' failed
make[2]: *** [gtktest] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/gtktest.dir/all' failed
make[1]: *** [CMakeFiles/gtktest.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
test.cpp code (From GTK+ tutorials)
#include <gtk/gtk.h>
static void
activate (GtkApplication* app,
gpointer user_data)
{
GtkWidget *window;
window = gtk_application_window_new (app);
gtk_window_set_title (GTK_WINDOW (window), "Window");
gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
gtk_widget_show_all (window);
}
int
main (int argc,
char **argv)
{
GtkApplication *app;
int status;
app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
return status;
}
Is the problem messed up order of CMake's commands?
Use GTK in your CMakeLists.txt instead of GTK3:
cmake_minimum_required(VERSION 3.0.2)
project(gtktest)
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED gtk+-3.0)
include_directories(${GTK_INCLUDE_DIRS})
link_directories(${GTK_LIBRARY_DIRS})
add_definitions(${GTK_CFLAGS_OTHER})
add_executable(gtktest test.cpp)
target_link_libraries(gtktest ${GTK_LIBRARIES})
GTK or GTK3 is a prefix and you can use any prefix you want for example.
cmake_minimum_required(VERSION 3.0.0)
project(gtktest)
find_package(PkgConfig REQUIRED)
pkg_check_modules(HI REQUIRED gtk+-3.0)
add_executable(gtktest test.cpp)
target_include_directories(gtktest PRIVATE ${HI_INCLUDE_DIRS})
target_link_libraries(gtktest PRIVATE ${HI_LIBRARIES})
However the prefix must be the same through all the CMakeLists.txt file and you are using the prefix GTK3 but later you write GKT3_LIBRARIES

undefined reference to boost::filesystem::path_traits::dispatch

I wrote a simple program using boost filesystem library. I linked to libboost_filesystem but yet I get undefined reference linkage error.
Here is my CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
project(client)
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11")
add_executable(client main.cpp UploadWorker.cpp FileSystemWatcher.cpp)
target_link_libraries(client boost_filesystem boost_system pthread)
I tried all of the solutions in other topics, but none of them was helpful.
and here is my error:
-- The C compiler identification is GNU 5.4.1
-- The CXX compiler identification is GNU 4.9.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/saeed/projects/threads/Debug
Scanning dependencies of target client
Scanning dependencies of target server
[ 50%] Building CXX object server/CMakeFiles/server.dir/main.cpp.o
[ 50%] Building CXX object client/CMakeFiles/client.dir/main.cpp.o
[ 50%] Building CXX object client/CMakeFiles/client.dir/UploadWorker.cpp.o
[ 66%] Building CXX object client/CMakeFiles/client.dir/FileSystemWatcher.cpp.o
[ 83%] Linking CXX executable server
[ 83%] Built target server
[100%] Linking CXX executable client
CMakeFiles/client.dir/FileSystemWatcher.cpp.o: In function `boost::filesystem::path::path<boost::filesystem::directory_entry>(boost::filesystem::directory_entry const&, boost::enable_if<boost::filesystem::path_traits::is_pathable<boost::decay<boost::filesystem::directory_entry>::type>, void>::type*)':
/usr/include/boost/filesystem/path.hpp:140: undefined reference to `boost::filesystem::path_traits::dispatch(boost::filesystem::directory_entry const&, std::string&)'
collect2: error: ld returned 1 exit status
client/CMakeFiles/client.dir/build.make:146: recipe for target 'client/client' failed
make[2]: *** [client/client] Error 1
CMakeFiles/Makefile2:85: recipe for target 'client/CMakeFiles/client.dir/all' failed
make[1]: *** [client/CMakeFiles/client.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
My machine is Ubuntu 16.04, g++ v4.9.4 and boost v1.58.

make openmp g++-6.2.0 no such file [duplicate]

This question already has an answer here:
CMake - set_property could not find CACHE variable
(1 answer)
Closed 6 years ago.
cmakelist.txt
cmake_minimum_required(VERSION 3.7)
project(multithreading)
# Find ITK.
find_package(ITK REQUIRED)
include(${ITK_USE_FILE})
FIND_PACKAGE( OpenMP REQUIRED)
if(OPENMP_FOUND)
message("OPENMP FOUND")
set(CMAKE_C_FLAGS “${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}”)
set(CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}“)
set(CMAKE_EXE_LINKER_FLAGS “${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}”)
endif()
add_executable(multithreading multithreading.cpp )
target_link_libraries(multithreading ${ITK_LIBRARIES})
TARGET_LINK_LIBRARIES(multithreading ${OpenMP_CXX_LIBRARIES})
And then I change default compiler which is AppleClang to gcc-6.2.0, and then cmake
,all openmp flags find, and configure is fine.
cmake -DCMAKE_C_COMPILER=/usr/local/gcc-6.2.0/bin/gcc-6.2.0 -DCMAKE_CXX_COMPILER=/usr/local/gcc-6.2.0/bin/g++-6.2.0 ./
-- The C compiler identification is GNU 6.2.0
-- The CXX compiler identification is GNU 6.2.0
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Check for working C compiler: /usr/local/gcc-6.2.0/bin/gcc-6.2.0
-- Check for working C compiler: /usr/local/gcc-6.2.0/bin/gcc-6.2.0 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Check for working CXX compiler: /usr/local/gcc-6.2.0/bin/g++-6.2.0
-- Check for working CXX compiler: /usr/local/gcc-6.2.0/bin/g++-6.2.0 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Try OpenMP C flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Try OpenMP CXX flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Found OpenMP: -fopenmp
OPENMP FOUND
-- Configuring done
-- Generating done
then next when I do ‘make’ it shows me
canning dependencies of target multithreading
[ 50%] Building CXX object CMakeFiles/multithreading.dir/multithreading.cpp.o
g++-6.2.0: error: “: No such file or directory
g++-6.2.0: fatal error: no input files
compilation terminated.
/bin/sh: -fopenmp“: command not found
make[2]: *** [CMakeFiles/multithreading.dir/multithreading.cpp.o] Error 127
make[1]: *** [CMakeFiles/multithreading.dir/all] Error 2
make: *** [all] Error 2
If I do g++ -fopenmp myproject.cpp it will not link ITK Library
g++ -fopenmp multithreading.cpp
multithreading.cpp:4:44: fatal error: itkRescaleIntensityImageFilter.h: No such file or directory
#include "itkRescaleIntensityImageFilter.h"
^
compilation terminated.
So I am wondering how can I fix that issue, so use itk and openmp as library at the same time.
You're using language/locale-specific double quotes. Most programming languages don't support these, including CMake. Use the "normal" double quotes: "

Linking error of BLAS with CMake

I have the following CMakeLists.txt:
cmake_minimum_required (VERSION 2.6)
project (MTSOS)
# Select flags.
set(CMAKE_C_FLAGS "-std=c99")
# Blas library
find_package( BLAS REQUIRED )
include_directories(${BLAS_INCLUDE_DIR})
add_executable (test_MTSOS test_MTSOS.c barrier_front.c dynamics_front.c
MTSOS.c csparse.c)
# Linking CImg dependencies.
target_link_libraries (test_MTSOS m blas ${BLAS_LIBRARIES})
When I run cmake .. :
-- The C compiler identification is GNU 4.8.2
-- The CXX compiler identification is GNU 4.8.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for dgemm_
-- Looking for dgemm_ - found
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- A library with BLAS API found.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/jabuntu14/Desktop/MTSOS/build
However, when I try to compile with make:
Scanning dependencies of target test_MTSOS
[ 20%] Building C object CMakeFiles/test_MTSOS.dir/test_MTSOS.c.o
[ 40%] Building C object CMakeFiles/test_MTSOS.dir/barrier_front.c.o
/home/jabuntu14/Desktop/MTSOS/barrier_front.c: In function ‘so_barrier’:
/home/jabuntu14/Desktop/MTSOS/barrier_front.c:83:25: warning: implicit declaration of function ‘dsyr’ [-Wimplicit-function-declaration]
dsyr(uplo, &u_size, &alpha, &Df[i*U_size], &one, A, &u_size);
^
[ 60%] Building C object CMakeFiles/test_MTSOS.dir/dynamics_front.c.o
[ 80%] Building C object CMakeFiles/test_MTSOS.dir/MTSOS.c.o
/home/jabuntu14/Desktop/MTSOS/MTSOS.c: In function ‘so_MakeA’:
/home/jabuntu14/Desktop/MTSOS/MTSOS.c:1561:13: warning: implicit declaration of function ‘dgemv’ [-Wimplicit-function-declaration]
dgemv(chn, &m_m, &n_m, &one, &M_dynamics[i*State_size*State_size], &m_m, &S_prime[i*State_size], &p_m, &zero, datam, &p_m);
^
[100%] Building C object CMakeFiles/test_MTSOS.dir/csparse.c.o
Linking C executable test_MTSOS
CMakeFiles/test_MTSOS.dir/barrier_front.c.o: In function `so_barrier':
barrier_front.c:(.text+0x4a7): undefined reference to `dsyr'
CMakeFiles/test_MTSOS.dir/MTSOS.c.o: In function `so_MakeA':
MTSOS.c:(.text+0x5e41): undefined reference to `dgemv'
MTSOS.c:(.text+0x5ee4): undefined reference to `dgemv'
MTSOS.c:(.text+0x5f87): undefined reference to `dgemv'
collect2: error: ld returned 1 exit status
make[2]: *** [test_MTSOS] Error 1
make[1]: *** [CMakeFiles/test_MTSOS.dir/all] Error 2
make: *** [all] Error 2
So I am having a linking problem but I cannot figure out why. Any help is welcome. Thanks!!
NOTE: Working under Ubuntu 14.04 with GCC. In the .c files I have included #include "cblas.h" as I saw in other websites.
EDIT: running make VERBOSE=1 the output is:
jabuntu14#ubuntu:~/Desktop/MTSOS/build$ make VERBOSE=1
/usr/bin/cmake -H/home/jabuntu14/Desktop/MTSOS -B/home/jabuntu14/Desktop/MTSOS/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/jabuntu14/Desktop/MTSOS/build/CMakeFiles /home/jabuntu14/Desktop/MTSOS/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/home/jabuntu14/Desktop/MTSOS/build'
make -f CMakeFiles/test_MTSOS.dir/build.make CMakeFiles/test_MTSOS.dir/depend
make[2]: Entering directory `/home/jabuntu14/Desktop/MTSOS/build'
cd /home/jabuntu14/Desktop/MTSOS/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/jabuntu14/Desktop/MTSOS /home/jabuntu14/Desktop/MTSOS /home/jabuntu14/Desktop/MTSOS/build /home/jabuntu14/Desktop/MTSOS/build /home/jabuntu14/Desktop/MTSOS/build/CMakeFiles/test_MTSOS.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/home/jabuntu14/Desktop/MTSOS/build'
make -f CMakeFiles/test_MTSOS.dir/build.make CMakeFiles/test_MTSOS.dir/build
make[2]: Entering directory `/home/jabuntu14/Desktop/MTSOS/build'
Linking C executable test_MTSOS
/usr/bin/cmake -E cmake_link_script CMakeFiles/test_MTSOS.dir/link.txt --verbose=1
/usr/bin/cc -std=c99 CMakeFiles/test_MTSOS.dir/test_MTSOS.c.o CMakeFiles/test_MTSOS.dir/barrier_front.c.o CMakeFiles/test_MTSOS.dir/dynamics_front.c.o CMakeFiles/test_MTSOS.dir/MTSOS.c.o CMakeFiles/test_MTSOS.dir/csparse.c.o -o test_MTSOS -rdynamic -lm -lblas -lf77blas -latlas
CMakeFiles/test_MTSOS.dir/barrier_front.c.o: In function `so_barrier':
barrier_front.c:(.text+0x4a7): undefined reference to `dsyr'
CMakeFiles/test_MTSOS.dir/MTSOS.c.o: In function `so_MakeA':
MTSOS.c:(.text+0x5e41): undefined reference to `dgemv'
MTSOS.c:(.text+0x5ee4): undefined reference to `dgemv'
MTSOS.c:(.text+0x5f87): undefined reference to `dgemv'
collect2: error: ld returned 1 exit status
make[2]: *** [test_MTSOS] Error 1
make[2]: Leaving directory `/home/jabuntu14/Desktop/MTSOS/build'
make[1]: *** [CMakeFiles/test_MTSOS.dir/all] Error 2
make[1]: Leaving directory `/home/jabuntu14/Desktop/MTSOS/build'
make: *** [all] Error 2
The functions in standard blas libraries are
dgemv_
Instead of
dgemv
As shown in your error, notice the trailing underscore.
So you probably have something in your code calling dgemv() instead of dgemv_(), change that and then you should be fine.
(I had the same issue where the code I was using had some like #define dgemv_ dgemv)