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

Can't build #13

Closed
swilliamshft opened this issue Oct 14, 2018 · 13 comments
Closed

Can't build #13

swilliamshft opened this issue Oct 14, 2018 · 13 comments
Labels
Bug Something isn't working

Comments

@swilliamshft
Copy link

Saw this on HN. Cloned master and tried to build. Cmake went okay but issued a make -j4 and got the below. Doing something wrong?

Scanning dependencies of target oatpp
[  2%] Building CXX object CMakeFiles/oatpp.dir/core/async/Coroutine.cpp.o
[  2%] Building CXX object CMakeFiles/oatpp.dir/algorithm/CRC.cpp.o
[  3%] Building CXX object CMakeFiles/oatpp.dir/core/async/Processor.cpp.o
[  4%] Building CXX object CMakeFiles/oatpp.dir/core/base/Controllable.cpp.o
In file included from /tmp/oatpp-master/core/async/Coroutine.cpp:25:0:
/tmp/oatpp-master/core/async/Coroutine.hpp:28:47: fatal error: oatpp/core/collection/FastQueue.hpp: No such file or directory
 #include "oatpp/core/collection/FastQueue.hpp"
                                               ^
compilation terminated.
In file included from /tmp/oatpp-master/algorithm/CRC.cpp:25:0:
/tmp/oatpp-master/algorithm/CRC.hpp:28:43: fatal error: oatpp/core/base/Environment.hpp: No such file or directory
 #include "oatpp/core/base/Environment.hpp"
                                           ^
compilation terminated.
In file included from /tmp/oatpp-master/core/async/Processor.hpp:28:0,
                 from /tmp/oatpp-master/core/async/Processor.cpp:25:
/tmp/oatpp-master/core/async/./Coroutine.hpp:28:47: fatal error: oatpp/core/collection/FastQueue.hpp: No such file or directory
 #include "oatpp/core/collection/FastQueue.hpp"

@lganzzzo
Copy link
Member

Hello @swilliamshft ,
I have to double-check this.
In the mean time you can just build it with the build_app.sh script included in the example projects.
Please check out this article:
https://medium.com/oatpp/c-oatpp-web-service-with-swagger-ui-and-auto-documented-endpoints-1d4bb7b82c21
It is a detailed description how to start a project with oatpp.

@FlorianRhiem can you please assist with CMake question.

Thank you for the question.
Will get back to you.

@FlorianRhiem
Copy link
Contributor

Hey @swilliamshft, you have cloned/downloaded the directory to a directory named oatpp-master. Please rename the oatpp-master directory to oatpp. Currently the directory name is required to be oatpp due to the internal directory structure.

Also make sure not to enable BUILD_SHARED_LIBS, to avoid issue #11.

The CMake build is brand new, so while I hope everything will work out fine for you after the rename, please let me know if there are any further problems.

@swilliamshft
Copy link
Author

[Rename went okay. Now I'm getting this:

[ 97%] Building CXX object CMakeFiles/oatppAllTests.dir/test/parser/json/mapping/DTOMapperPerfTest.cpp.o
In file included from /tmp/oatpp/test/parser/json/mapping/DeserializerTest.cpp:34:0:
/tmp/oatpp/test/parser/json/mapping/DeserializerTest.cpp: In static member function âstatic oatpp::data::mapping::type::Type::Property* oatpp::test::parser::json::mapping::{anonymous}::Test1::Z__CLASS_GET_FIELD_strF(oatpp::base::Controllable*, oatpp::data::mapping::type::AbstractObjectWrapper*)â:
/tmp/oatpp/../oatpp/codegen/codegen_define_DTO_.hpp:105:79: error: expected primary-expression before â,â token
                                                      OATPP_MACRO_FIRSTARG LIST, \
                                                                               ^
/tmp/oatpp/../oatpp/codegen/codegen_define_DTO_.hpp:112:53: note: in expansion of macro âOATPP_MACRO_DTO_FIELD_1â
 #define OATPP_MACRO_DTO_FIELD_(X, TYPE, NAME, LIST) OATPP_MACRO_DTO_FIELD_##X(TYPE, NAME, LIST)
                                                     ^
/tmp/oatpp/../oatpp/codegen/codegen_define_DTO_.hpp:113:54: note: in expansion of macro âOATPP_MACRO_DTO_FIELD_â
 #define OATPP_MACRO_DTO_FIELD__(X, TYPE, NAME, LIST) OATPP_MACRO_DTO_FIELD_(X, TYPE, NAME, LIST)
                                                      ^
/tmp/oatpp/../oatpp/codegen/codegen_define_DTO_.hpp:114:52: note: in expansion of macro âOATPP_MACRO_DTO_FIELD__â
 #define OATPP_MACRO_DTO_FIELD___(TYPE, NAME, LIST) OATPP_MACRO_DTO_FIELD__(OATPP_MACRO_HAS_ARGS LIST, TYPE, NAME, LIST)
                                                    ^
/tmp/oatpp/../oatpp/codegen/codegen_define_DTO_.hpp:117:1: note: in expansion of macro âOATPP_MACRO_DTO_FIELD___â
 OATPP_MACRO_DTO_FIELD___(TYPE, NAME, (__VA_ARGS__))
 ^
/tmp/oatpp/test/parser/json/mapping/DeserializerTest.cpp:45:3: note: in expansion of macro âDTO_FIELDâ
   DTO_FIELD(String, strF);
   ^

@lganzzzo
Copy link
Member

Looks like some troubles with the encoding and new line symbol.
What OS do you use?

@lganzzzo lganzzzo reopened this Oct 14, 2018
@swilliamshft
Copy link
Author

$ cat /etc/centos-release
CentOS Linux release 7.5.1804 (Core)

@swilliamshft
Copy link
Author

$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC)

@FlorianRhiem
Copy link
Contributor

@lganzzzo The error is in line 105, so OATPP_MACRO_DTO_FIELD_1 is being called. Shouldn't DTO_FIELD(String, strF) call OATPP_MACRO_DTO_FIELD_0, as its varargs are empty?

@lganzzzo
Copy link
Member

Thank you for the details.
Oat++ has been tested on ubuntu 16, 18, and MacOS.
I will test it on CentOs and get back to you.

@lganzzzo
Copy link
Member

@FlorianRhiem yes it might be. Seema like it is a platform specific issue.
We have to check this.

@FlorianRhiem
Copy link
Contributor

I was able to reproduce the issue on CentOS 7 using a quick GitLab CI setup: https://gitlab.com/florianrhiem/oatpp/-/jobs/107929722
I got the code to compile by enabling CXX_EXTENSIONS for both oatpp and the oatpp tests: https://gitlab.com/florianrhiem/oatpp/-/jobs/107930192
This means that the preprocessor usage for these macros likely isn't 100% standard and gcc 4.8 needs the proper flags to enable it (CXX_EXTENSIONS is the CMake equivalent to using -std=g++11 instead of -std=c++11). The tests failed on GitLab CI after some time, but I'm not sure whether it ran into any system limitation or if there's another bug there.

@swilliamshft To try this, replace the two occurances of CXX_EXTENSIONS OFF in CMakeLists.txt with CXX_EXTENSIONS ON, here and here.

@swilliamshft
Copy link
Author

Turning on CXX_EXTENSIONS worked. This is okay but the project advertised no external dependencies, I would consider having to turn on GNU-specific language extensions to be a dependency of sorts.

That said, I ran the tests and they don't pass.

$ ./oatppAllTests
terminate called after throwing an instance of 'std::runtime_error'
  what():  ASSERT[FAILED]:obj1->strF
Aborted (core dumped)

@FlorianRhiem
Copy link
Contributor

This seems to be due to #11, even when not building a shared object. There simply does not seem to be a guarantee for shared literals. I've merged an updated version of the feature-nameptr branch and that way it passed the tests.

And yes, I would also prefer if the project were standard C++. I'm sure there is a way to detect the empty __VA_ARGS__ without enabling gnu extensions.

@lganzzzo
Copy link
Member

Fixed.
Now it should be possible to build with -std=c++11 (NOT -std=gnu++11)
Tested on CentOS Linux release 7.5.1804.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants