Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve obvious build problems #22

Open
smarek opened this issue Jan 20, 2019 · 5 comments
Open

Resolve obvious build problems #22

smarek opened this issue Jan 20, 2019 · 5 comments
Labels
backlog Issues for upcoming releases (to be done soon) build prio7

Comments

@smarek
Copy link

smarek commented Jan 20, 2019

Fix no.1

diff --git a/tpwriter.cpp b/tpwriter.cpp
index ded5831..116b54f 100644
--- a/tpwriter.cpp
+++ b/tpwriter.cpp
@@ -11,6 +11,7 @@
 #include <tarantool/tarantool.h>
 #include <tarantool/tnt_net.h>
 #include <tarantool/tnt_opt.h>
+#define MP_SOURCE 1
 #include <msgpuck.h>
 extern "C" {
 #include <tarantool/tnt_io.h>

Fixes build issue like this:

/usr/bin/c++   -pipe -O2 -fomit-frame-pointer -ffunction-sections -fdata-sections  -rdynamic -Wl,-s -Wl,--gc-sections CMakeFiles/rp.dir/dbreader.cpp.o CMakeFiles/rp.dir/main.cpp.o CMakeFiles/rp.dir/tpwriter.cpp.o  -o replicatord -lrt -ldl -ltarantool lib/libslave/libslave_a.a lib/yaml-cpp/libyaml-cpp.a -lpthread
/usr/bin/ld: CMakeFiles/rp.dir/tpwriter.cpp.o: undefined reference to symbol 'mp_type_hint'
/usr/bin/ld: //usr/local/lib/libmsgpuck.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

Fix no.2

diff --git a/CMakeLists.txt b/CMakeLists.txt
index be1ff02..cfeb942 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -40,7 +40,7 @@ find_library(LPTHREAD pthread)
 
 add_executable(rp ${REPLICATOR_SRC})
 set_target_properties(rp PROPERTIES COMPILE_FLAGS "-std=c++11" LINK_FLAGS "-Wl,-s -Wl,--gc-sections" OUTPUT_NAME replicatord)
-target_link_libraries(rp rt dl tnt slave_a yaml-cpp ${LPTHREAD})
+target_link_libraries(rp rt dl tarantool slave_a yaml-cpp ${LPTHREAD})
 
 install(TARGETS rp RUNTIME DESTINATION sbin)
 install(FILES replicatord.yml DESTINATION etc)

Fixes build issue like this:

/usr/bin/c++   -pipe -O2 -fomit-frame-pointer -ffunction-sections -fdata-sections  -rdynamic -Wl,-s -Wl,--gc-sections CMakeFiles/rp.dir/dbreader.cpp.o CMakeFiles/rp.dir/main.cpp.o CMakeFiles/rp.dir/tpwriter.cpp.o  -o replicatord -lrt -ldl -ltnt lib/libslave/libslave_a.a lib/yaml-cpp/libyaml-cpp.a -lpthread 
/usr/bin/ld: cannot find -ltnt
collect2: error: ld returned 1 exit status

Fix no.3 is PR in libslave
tarantool/libslave#12

@smarek
Copy link
Author

smarek commented Jan 20, 2019

Fix no.2 ammended, because tarantool-c is popular, and might be installed from other sources, allow the CMake to use locally installed library, instead of force using the git-submodule

Currently submodule links to tarantool/tarantool-c@653d673 which is Feb 9, 2017
Since neither major or minor version of library changed (still 2.0.0) so we can simply search for exact match on major or minor version (in diff only major version "2.0" match)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index be1ff02..0b23187 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,7 +21,11 @@ set(TARANTOOL_C_EMBEDDED ON)
 
 add_subdirectory(lib/libslave)
 add_subdirectory(lib/yaml-cpp)
-add_subdirectory(lib/tarantool-c)
+
+find_library(TNT_LIB tarantool.so.2.0)
+if(NOT TNT_LIB)
+  add_subdirectory(lib/tarantool-c)
+endif()
 
 include_directories(
        BEFORE SYSTEM
@@ -40,7 +44,7 @@ find_library(LPTHREAD pthread)
 
 add_executable(rp ${REPLICATOR_SRC})
 set_target_properties(rp PROPERTIES COMPILE_FLAGS "-std=c++11" LINK_FLAGS "-Wl,-s -Wl,--gc-sections" OUTPUT_NAME replicatord)
-target_link_libraries(rp rt dl tnt slave_a yaml-cpp ${LPTHREAD})
+target_link_libraries(rp rt dl tarantool slave_a yaml-cpp ${LPTHREAD})
 
 install(TARGETS rp RUNTIME DESTINATION sbin)
 install(FILES replicatord.yml DESTINATION etc)

@kostja
Copy link

kostja commented Jan 21, 2019

Please feel free to send us a pull request.

smarek added a commit to smarek/mysql-tarantool-replication that referenced this issue Jan 21, 2019
@smarek
Copy link
Author

smarek commented Jan 21, 2019

@kostja #23

@smarek
Copy link
Author

smarek commented Jan 21, 2019

Still waits for libslave to merge the vector PR, after that this repository must update the submodule reference

@Totktonada
Copy link
Member

See also #31.

@Totktonada Totktonada added the backlog Issues for upcoming releases (to be done soon) label Dec 20, 2020
@Totktonada Totktonada changed the title Build update Resolve obvious build problems Dec 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Issues for upcoming releases (to be done soon) build prio7
Projects
None yet
Development

No branches or pull requests

4 participants