Ethiraric / mysql_orm

A C++ ORM for MySQL
MIT License
10 stars 2 forks source link

I encountered these bugs while compiling the project, please help me, thank you. I really like this project. #2

Open yourfriendyo opened 6 months ago

yourfriendyo commented 6 months ago

I'm unable to successfully compile this project. I'm using Ubuntu 22.04 with g++ 13.1. I really want to use this project and hope you can help me. Below is the process I've tried to resolve the errors.

First, there is this error. I found the value corresponding to SIGSTKSZ and directly replaced it, which I consider as solving this error.

/home/yyx/mysql_orm/tests/catch.hpp:7441:45: error: size of array ‘altStackMem’ is not an integral constant-expression
 7441 |     char FatalConditionHandler::altStackMem[SIGSTKSZ] = {};
      |                                             ^~~~~~~~

Then there is this error. I don't understand why you are using <> to include your own project's header files, so I

$ ln -s ../include/mysql_orm/ ./tests/
$ ln -s ../deps/include/ ./tests/
/home/yyx/mysql_orm/tests/test_Column.cpp:1:10: fatal error: mysql_orm/Column.hpp: No such file or directory
    1 | #include <mysql_orm/Column.hpp>

This is the third error. I searched the entire project and found no definition for my_bool, so I had to replace all instances with bool.

/home/yyx/mysql_orm/tests/./mysql_orm/Connection.hpp:36:22: error: ‘my_bool’ was not declared in this scope; did you mean ‘bool’?
   36 |     auto reconnect = my_bool{1};

This is the fourth error, I really have no idea how to solve it.

$ make
Consolidate compiler generated dependencies of target mysql_orm_tests
[  6%] Building CXX object CMakeFiles/mysql_orm_tests.dir/test_Database.cpp.o
[ 13%] Building CXX object CMakeFiles/mysql_orm_tests.dir/test_Delete.cpp.o
[ 20%] Building CXX object CMakeFiles/mysql_orm_tests.dir/test_Insert.cpp.o
[ 26%] Building CXX object CMakeFiles/mysql_orm_tests.dir/test_Limit.cpp.o
[ 33%] Building CXX object CMakeFiles/mysql_orm_tests.dir/test_Pack.cpp.o
[ 40%] Building CXX object CMakeFiles/mysql_orm_tests.dir/test_RemoveOccurences.cpp.o
[ 46%] Building CXX object CMakeFiles/mysql_orm_tests.dir/test_GetAll.cpp.o
[ 53%] Building CXX object CMakeFiles/mysql_orm_tests.dir/test_Table.cpp.o
[ 60%] Building CXX object CMakeFiles/mysql_orm_tests.dir/test_Update.cpp.o
[ 66%] Building CXX object CMakeFiles/mysql_orm_tests.dir/test_Varchar.cpp.o
[ 73%] Building CXX object CMakeFiles/mysql_orm_tests.dir/test_Where.cpp.o
[ 80%] Linking CXX executable mysql_orm_tests
/usr/bin/ld: cannot find -lmysql_orm: No such file or directory
collect2: error: ld returned 1 exit status
Ethiraric commented 6 months ago

Hi! The first error stems from Catch2, the unit testing framework. I have bundled it with mysql_orm and it seems that the error happens because the library is not up-to-date. I have pushed a commit with the library updated. Can you please tell me if this solves your first error?

Regarding header files, <> should work for including your own files. Using double quotes only changes the order in which the include directories are searched, so that files from the projects are prioritized over system headers. Since I include long paths, it is highly unlikely to collide with a system header. These normally should get resolved by cmake.

my_bool comes from mysql.h. Replacing it with a boolean should not be much of an issue,.

Please do try to have a build folder for cmake. Instead of running cmake ., use mkdir build && cd build && cmake .. instead. This makes all build artifacts be written in a build/ subfolder. This way, cmake or make won't create files that might collision with the sources.

I'd also like to state that this is a toy project. It is not mature enough to be used in real-world projects. You can have a look at #1 for more details about its status.