Compiling Mongo on Alpine - linux

I'm attempting to compile Mongo on Alpine Linux.
Anybody know how to get past this error?
In file included from src/mongo/util/net/socket_poll.h:20:0,
from src/mongo/util/net/sock.cpp:42:
/usr/include/sys/poll.h:1:2: error: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Werror=cpp]
#warning redirecting incorrect #include <sys/poll.h> to <poll.h>
^
cc1plus: all warnings being treated as errors
scons: *** [build/linux2/normal/mongo/util/net/sock.o] Error 1
scons: building terminated because of errors.

This comes from the build system adding a -Werror flag and therefore the compiler is treating warnings as errors and fails the build.
You'll probably be able to go past this step by using the ad hoc --disable-warnings-as-errors flag.

Related

compile GLFW in cygwin

I am trying to compile glfw with cygwin but getting errors like this
../src/glfw3.lib(win32_monitor.c.obj):win32_monitor.c:(.text+0x8a): undefined reference to `__imp_CreateDCW'
../src/glfw3.lib(win32_monitor.c.obj):win32_monitor.c:(.text+0x8a): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp_CreateDCW'
Can someone help here ?
Anyone has successfull experience in compiling glfw with cygwin ?
Have you linked the libraries opengl32 and glfw3dll? Also have you included glad.h in your code? If so you should also include windows.h. Include the files in this order:
#include <windows.h>
#include <path_to_glad/glad.h>
#include <path_to_glfw/glfw3.h>
Then compile the code like this:
gcc/g++ main.c glad.c -lglfw3dll -lopengl32
It would also be better if you included your code along with your question

Cmake linking thrift

I am trying to link thrift in CMake so that I can compile my test application.
cmake_minimum_required(VERSION 3.10)
project(TestApp)
set(CMAKE_CXX_STANDARD 11)
add_executable(TestApp main.cpp)
target_link_libraries(TestApp -lthrift --static -pthread )
Here is a simple test application including the thrift headers.
#include <iostream>
#include <thrift/protocol/TBinaryProtocol.h>
#include <thrift/transport/TSocket.h>
#include <thrift/transport/TBufferTransports.h>
#include <thrift/transport/TTransportUtils.h>
#include <thrift/stdcxx.h>
using namespace apache::thrift;
using namespace apache::thrift::protocol;
using namespace apache::thrift::transport;
int main() {
std::cout << "BlaBlaBla" << std::endl;
return 0;
}
When I am trying to compile the snippet shown above I am prompted with a linker error:
/opt/JetBrains/apps/CLion/ch-0/181.5087.36/bin/cmake/bin/cmake --build /home/user/Documents/Projects/TestApp/cmake-build-debug --target TestApp -- -j 2
[ 50%] Linking CXX executable TestApp
/usr/bin/ld: cannot find -lthrift
collect2: error: ld returned 1 exit status
make[3]: *** [CMakeFiles/TestApp.dir/build.make:95: TestApp] Error 1
make[2]: *** [CMakeFiles/Makefile2:68: CMakeFiles/TestApp.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:80: CMakeFiles/TestApp.dir/rule] Error 2
make: *** [Makefile:118: TestApp] Error 2
However, the thrift libraries are definitely installed.
How can I link fix this issue and link them correctly in the CMake file?
The issue got solved by cloning the thrift repository from github https://github.com/apache/thrift
Then I simply followed the build instruction there.
I did run ./bootstrap.sh and ./configure followed by make and then sudo make install.
Now the linker recognizes the -lthrift flag.

clang++ not finding "iostream"

I followed the guide's steps precisely except for the batch file step because I couldn't find setgcc.bat. I don't care about switching to the 32-bit version anyway.
I then performed clang++ -v and got:
clang version 3.8.0 (branches/release_38)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin
I feel as the error is the target is x86_64-pc-windows-msvc because I don't have VS installed.
I then performed g++ -v and got:
Reading specs from \cygnus\cygwin-b20\H-i586-cygwin32\lib\gcc-lib\i586-cygwin32\egcs-2.91.57\specs
gcc version egcs-2.91.57 19980901 (egcs-1.1 release)
I tried doing g++ -c HelloWorld.cpp and got an error that cygwin1.dll was missing, and then cpp.exe crashed.
How can I have clang++ -c HelloWorld.cpp run and give me an object file by not having the error below occur, and based on my details?
HelloWorld.cpp:1:10: fatal error: 'iostream' file not found
#include <iostream>
^
1 error generated.

unqlite.h:651:15: error: changes meaning of ‘pgno’ from ‘typedef sxu64 pgno’ [-fpermissive]

Just downloaded the unqlite.c and unqlite.h, created a new project in Eclipse, copied one of the examples from unqlite.org website and I'm getting the following error:
21:37:51 **** Build of configuration Debug for project nosql ****
make all
Building file: ../main.cpp
Invoking: Cross G++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"main.d" -MT"main.d" -o "main.o" "../main.cpp"
In file included from ../main.cpp:49:0:
../unqlite.h:661:8: error: declaration of ‘pgno unqlite_page::pgno’ [-fpermissive]
pgno pgno; /* Page number for this page */
^
../unqlite.h:651:15: error: changes meaning of ‘pgno’ from ‘typedef sxu64 pgno’ [-fpermissive]
typedef sxu64 pgno;
^
subdir.mk:25: recipe for target 'main.o' failed
make: *** [main.o] Error 1
21:37:51 Build Finished (took 171ms)
It was meant to be as simple, but I have no clue of what is going on... Has anyone tried this unqLite KV store?
I'm using
gcc version 4.9.2 (Debian 4.9.2-10)
Cheers
ttkdroid
This issue appears when including unqlite.h in a C++ file, and compiling it with a g++. You have two solutions to fix it:
You can get the patch produced by the author of the lib as indicated here: https://github.com/symisc/unqlite/issues/24
Or you can edit the unqlite.h file on line 661 replacing:
pgno pgno; /* Page number for this page */
by
::pgno pgno; /* Page number for this page */
Which will work with a g++ compiler as well as other C++ compilers. Of course, you cannot compile unqlite.c with this edited header, with a C compiler.
If you want to learn more about this error, this might be a good link: typedef changes meaning
Have a good day!

gcc compile errors

I am getting these errors when I compile sim_routing.cc program by this command
../../bin/cxx sim_routing.cc
g++ -Wall -o sim_routing sim_routing.cxx
following errors are produced:
../../common/priority_q.h : In member function 'bool guardedQueue<ITEM>::Validate(Const char*);
error : there are no argument to 'strcat' that depend on template parameter so a declaration of 'strcat' must be avaible.
error : <if you use -fpermissive g++ will accept your code but allowing use of undeclared name is deprecated>
When I tried to change commom/priority_q.h, it shows it is read only; file changes cannot be accepted.
How these errors can be removed?
#include <cstring> before the header triggering your error.

Resources