build error / user error?

82 views
Skip to first unread message

Andre Mermegas

unread,
Apr 27, 2016, 4:50:48 PM4/27/16
to fix8 support
Hi All!

Anybody have a clue what I may have done wrong?

andmer@andmer-virtual-machine:~/projects/gilead_fix8/build$ cmake ..
-- Configuring done
-- Generating done
-- Build files have been written to: /home/andmer/projects/gilead_fix8/build
andmer@andmer-virtual-machine:~/projects/gilead_fix8/build$ make
[ 16%] Building CXX object CMakeFiles/gilead_fix8.dir/main.cpp.o
[ 33%] Linking CXX executable gilead_fix8
[ 33%] Built target gilead_fix8
[ 50%] Building CXX object gen/CMakeFiles/fix8_gen.dir/Myfix_classes.cpp.o
[ 66%] Building CXX object gen/CMakeFiles/fix8_gen.dir/Myfix_traits.cpp.o
[ 83%] Building CXX object gen/CMakeFiles/fix8_gen.dir/Myfix_types.cpp.o
[100%] Linking CXX executable fix8_gen
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
gen/CMakeFiles/fix8_gen.dir/build.make:159: recipe for target 'gen/fix8_gen' failed
make[2]: *** [gen/fix8_gen] Error 1
CMakeFiles/Makefile2:122: recipe for target 'gen/CMakeFiles/fix8_gen.dir/all' failed
make[1]: *** [gen/CMakeFiles/fix8_gen.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Ian McKane

unread,
Apr 27, 2016, 5:13:57 PM4/27/16
to fix8 support
Who could know? We can't see your code, or your cmake makefiles. However I think the error 
(.text+0x20): undefined reference to `main'
is a strong clue.
/Ian

Andre Mermegas

unread,
Apr 28, 2016, 10:09:19 AM4/28/16
to fix8 support
thank you for the breadcrumbs!

C++ is not my primary domain and I clobbered up the cmake file for the fix8 gen portion. I had this line in there

add_executable(fix8_gen ${SOURCE_FILES})

and I had no cpp with main in that source tree.



One last thing is there a better way to add link in CMake?

# set the paths and libs
set(PREFIX      "/usr/local") # the directory containing "include" and "lib"
set(INCLUDE_DIR "${PREFIX}/include")
set(LIB_DIR     "${PREFIX}/lib")
set(LIBS
    "${LIB_DIR}/libfix8.so"
    "${LIB_DIR}/libhftest.so"
    "${LIB_DIR}/libmyfix.so"
    "${LIB_DIR}/libPocoFoundationd.so"
    "${LIB_DIR}/libPocoFoundation.so"
    "${LIB_DIR}/libPocoJSONd.so"
    "${LIB_DIR}/libPocoJSON.so"
    "${LIB_DIR}/libPocoNetd.so"
    "${LIB_DIR}/libPocoNet.so"
    "${LIB_DIR}/libPocoUtild.so"
    "${LIB_DIR}/libPocoUtil.so"
    "${LIB_DIR}/libPocoXMLd.so"
    "${LIB_DIR}/libPocoXML.so"
    )

Andre Mermegas

unread,
May 2, 2016, 2:34:12 PM5/2/16
to fix8 support
I'm pretty sure I have all the fix8 libs included,
almost compiled, getting this now any idea what lib i could be missing in my cmake?

I have
    "${LIB_DIR}/libfix8.so"
    "${LIB_DIR}/libhftest.so"
    "${LIB_DIR}/libmyfix.so"


CMakeFiles/gilead_fix8.dir/main.cpp.o: In function `FIX8::SessionConfig::SessionConfig(FIX8::F8MetaCntx const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/home/andmer/projects/gilead_fix8/main.cpp:(.text._ZN4FIX813SessionConfigC2ERKNS_10F8MetaCntxERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESB_[_ZN4FIX813SessionConfigC2ERKNS_10F8MetaCntxERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESB_]+0x35c): undefined reference to `FIX8::Configuration::create_clients(XmlElement const*) const'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Mazz Barker

unread,
May 2, 2016, 5:19:58 PM5/2/16
to fix8 support
create_clients is found in configuration.cpp. This is not being linked in.
You need to attach your CMakeLists.txt (s) if you want us to help you 

Mazz 

Andre Mermegas

unread,
May 3, 2016, 10:06:59 AM5/3/16
to fix8 support
Yeah your right, here is my test project for reference:
https://github.com/andmer/fix8.git

I have included
#include <fix8/f8includes.hpp>
so it does pull in configuration.hpp header, there is some error on linkage I can not figure out why.

please take a look at the cmake if you get a chance, thanks.

Andre Mermegas

unread,
May 9, 2016, 2:20:42 PM5/9/16
to fix8 support
turns out to be clang 3.8 problem?
clang version 3.8.0-2ubuntu3 (tags/RELEASE_380/final)

i swapped to g++ 5.3 and it links correctly now.
g++ (Ubuntu 5.3.1-14ubuntu2) 5.3.1 20160413

I don't know why, but for informational purposes it is what occurred for me.

Ian McKane

unread,
May 13, 2016, 5:47:38 PM5/13/16
to fix8 support
I've used clang previously but not for a while. You should raise an issue in Jira as the project maintainers will want to fix this.
/Ian
Reply all
Reply to author
Forward
0 new messages