Bazel build Tensorflow Serving fails in Mac - macos

I've a Mac which runs Sierra. I installed all pre-requisites for tensorflow serving as mentioned here.
https://www.tensorflow.org/serving/setup
But when I try to bazel build tensorflow serving as they mentioned, I get 3 errors and the build stops.
error use of undeclared identifier 'pthread_mach_thread_np'

Inserting following lines of code
#ifndef _MACH_PORT_T
#define _MACH_PORT_T
#include <sys/_types.h> /* __darwin_mach_port_t */
typedef __darwin_mach_port_t mach_port_t;
#include <pthread.h>
mach_port_t pthread_mach_thread_np(pthread_t);
#endif /* _MACH_PORT_T */
into file:
/Library/Developer/CommandLineTools/usr/include/c++/v1/__threading_support
This issue is discussed in this thread.

Related

How to fix "error: no member named 'fancy_abort' in namespace 'std::__1'; did you mean simply 'fancy_abort'? _VSTD::abort();"

Platform: Macos Catalina 10.15.2
Xcode version: Xcode 11
I have tried many times to make-all gcc to build my source code. However, I have encountered a problem:
In file included from ../.././gcc/c/c-objc-common.c:33:
In file included from /Applications/Xcode11.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:85:
/Applications/Xcode11.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/exception:181:5: error:
no member named 'fancy_abort' in namespace 'std::__1'; did you mean simply 'fancy_abort'?
_VSTD::abort();
^~~~~~~ /Applications/Xcode11.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:873:15: note:
expanded from macro '_VSTD' # _VSTD std::_LIBCPP_ABI_NAMESPACE
^ ../.././gcc/system.h:685:13: note: 'fancy_abort' declared here extern void fancy_abort (const char *, int, const char
*) ATTRIBUTE_NORETURN;
^
1 error generated.
make[1]: *** [c/c-objc-common.o] Error 1
make: *** [all-gcc] Error 2
I have tried to install another version of Xcode. I have installed Xcode6 but it still did not work, and I found a solution of this issue. But when I download Xcode8.3.3, it is not compatible with Catalina 10.15.2.
I ran in to this issue while using crosstools-ng on mac (mojave 10.14) to compile cross-platform toolchain with gcc 4.9.
Solution: Edit .build/src/gcc-4.9.4/gcc/system.h to add #include <map> in #ifdef __cplusplus block where other include statements are.
The problem is that is included (via ) after abort has been
defined as a macro to fancy_abort. And thus when the C++ standard headers try
to call std::abort, they end up calling std::fancy_abort, which of course
doesn't exist.
Source: https://gcc.gnu.org/legacy-ml/gcc-bugs/2017-09/msg00154.html

Cannot open include file: iwscapi.h

I am trying to build an application that requires iwscapi.h. I am getting error:
"Cannot open include file: 'iwscapi.h': No such file or directory".
Below are my includesthat I have used:
#include <stdio.h>
#include <atlbase.h>
#include <atlstr.h>
#include <wscapi.h>
#include <iwscapi.h>
I have added Wscapi.lib in the linker. My build machine is Windows 7 and I am using VS2005 compiler. I manually searched the file iwscapi.h in C drive but it is missing.
Please let me know what causing this error.
Thanks in advance.

Qt5 application compiles on Linux and Windows, but gives cryptic error on Mac OS X

I work on a small open source pc timer project. I'd love to get my client working on OS X, but I can even get it to launch! I installed xcode, and the qt5 sdk with qtcreator. When I compile I get the following warnings, but the binary compiles:
/Users/kylehall/Documents/Libki/main.cpp:25: In file included from ../Libki/main.cpp:25:
/Users/kylehall/Documents/Libki/timerwindow.h:20: warning: 'TIMERWINDOW_H' is used as a header guard here, followed by #define of a different macro [-Wheader-guard]
#ifndef TIMERWINDOW_H
^~~~~~~~~~~~~
/Users/kylehall/Documents/Libki/timerwindow.h:21: 'LOGINWINDOW_H' is defined here; did you mean 'TIMERWINDOW_H'?
#define LOGINWINDOW_H
^~~~~~~~~~~~~
TIMERWINDOW_H
/Users/kylehall/Documents/Libki/timerwindow.cpp:21: In file included from ../Libki/timerwindow.cpp:21:
/Users/kylehall/Documents/Libki/timerwindow.h:20: warning: 'TIMERWINDOW_H' is used as a header guard here, followed by #define of a different macro [-Wheader-guard]
#ifndef TIMERWINDOW_H
^~~~~~~~~~~~~
/Users/kylehall/Documents/Libki/timerwindow.h:21: 'LOGINWINDOW_H' is defined here; did you mean 'TIMERWINDOW_H'?
#define LOGINWINDOW_H
^~~~~~~~~~~~~
TIMERWINDOW_H
/Users/kylehall/Documents/build-Libki-Desktop_Qt_5_2_1_clang_64bit-Debug/moc_timerwindow.cpp:9: In file included from moc_timerwindow.cpp:9:
/Users/kylehall/Documents/Libki/timerwindow.h:20: warning: 'TIMERWINDOW_H' is used as a header guard here, followed by #define of a different macro [-Wheader-guard]
#ifndef TIMERWINDOW_H
^~~~~~~~~~~~~
/Users/kylehall/Documents/Libki/timerwindow.h:21: 'LOGINWINDOW_H' is defined here; did you mean 'TIMERWINDOW_H'?
#define LOGINWINDOW_H
^~~~~~~~~~~~~
TIMERWINDOW_H
When I try to run the binary I get the following error:
dyld: Library not loaded: /work/build/______________________________PADDING______________________________/lib/QtPositioning.framework/Versions/5/QtPositioning
Referenced from: /Users/kylehall/Documents/build-Libki-Desktop_Qt_5_2_1_clang_64bit-Debug/libkiclient.app/Contents/MacOS/libkiclient
Reason: image not found
Debugging has finished
At this point I don't even know where to begin with such a cryptic error. Any suggestions would be great! You can grab the code and try compiling it yourself from https://bitbucket.org/libki-kms/libki-client/src
Seems pretty clear:
warning: 'TIMERWINDOW_H' is used as a header guard here, followed by #define of a different macro [-Wheader-guard]
So you must have:
#ifndef TIMERWINDOW_H
#define LOGINWINDOW_H
Copy and paste error, I'd say...

Trying to include OpenSSL headers in Visual Studio 2012: error LNK2019: unresolved external symbol

I know this problem is pretty common. In fact, I searched a lot about the problem but I can't find any solution which fits my case.
I'm working in a C++ Visual Studio 2012 project which uses openssl libraries.
This is a minimum sample code.
#include <iostream>
#include <stdio.h>
//OpenSSL
#include <openssl/bio.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
#include <openssl/x509.h>
using namespace std;
int main(){
SSL_library_init ();
return 0;
}
I'm running Visual Studio 2012 Proffesional in a Windows7-64b machine.
I downloaded the Win64 OpenSSL v1.0.1e Light installer from here
and installed it. Then I added to Project Properties-> Configuration Properties-> C/C++-> General-> Additional Include Directories the path "C:\OpenSSL-Win64\include".
So by this moment, the sample code is not showing compilation errors in Visual Studio.
Then, I also added to the Linker-> Additional library directories, the path "C:\OpenSSL-Win64\lib" and then in Linker-> Additional Dependencies, I added "libeay32.lib;" and "ssleay32.lib".
However, when I tried to compile I got this error:
1>------ Build started: Project: Client, Configuration: Debug Win32 ------
1> Client.cpp
1>Client.obj : error LNK2019: unresolved external symbol _SSL_library_init referenced in function _main
1>c:\users\gabi\documents\visual studio 2012\Projects\Project1\Debug\Client.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I also tried with the rest of the OpenSSL libraries, because it's possible that SSL_init_function() doesn't belong to "libeay32.lib" or "ssleay32.lib". So I added in the source code :
#pragma comment(lib, "libeay32.lib")
#pragma comment(lib, "ssleay32.lib")
#pragma comment(lib, "VC\\libeay32MD.lib")
#pragma comment(lib, "VC\\libeay32MDd.lib")
#pragma comment(lib, "VC\\libeay32MT.lib")
#pragma comment(lib, "VC\\libeay32MTd.lib")
#pragma comment(lib, "VC\\ssleay32MD.lib")
#pragma comment(lib, "VC\\ssleay32MDd.lib")
#pragma comment(lib, "VC\\ssleay32MT.lib")
#pragma comment(lib, "VC\\ssleay32MTd.lib")
Those are all the libraries, except the ones which are in the subfolder "VC\static", because the files in static folder have the same name as some of those and it could be a conflict.
Anyway, the error it's the same.
Oh, I also added the string "C:\OpenSSL-Win64\bin" to the PATH environment variable.
And...I also tried by linking to the Win32 OpenSSL which I installed too, and compiling my own "libeay32.lib" and "ssleay32.lib" following this tutorial. Both, 32b or 64b didn't work.
I'm quite desperate with this, can anyone help me?
Thanks!
I had the problem like yours.
The problem was that my project's platform were for WIN32 but I downloaded OpenSSL x64, so I couldn't call SSL_library_init ();
OpenSSL for Windows (code.google.com)
Hope my answer will help you, even I am late for 2 years :3

how to get kernel header file?

i'm trying to make new system calls in kernel 2.6.21
and one of the new system calls use 'sys_write' function,
but to use this function, i realized that i must install kernel header file according to 2.6.21 version.
but i can't find kernel header file(2.6.21)
i tried apt-get install linux-headers-'uname -r' , apt-cache search linux-headers-$(uname -r)
but i can't find anything..
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/syscalls.h>
#include <linux/fcntl.h>
#include <asm/uaccess.h>
int main(){
int fd;
int old_fs;
old_fs = get_fs();
set_fs(KERNEL_DS);
fd = sys_open("config.txt", O_RDONLY, 0);
if(fd >= 0)
sys_close(fd);
set_fs(old_fs);
return 0;
}
vv.c:2:24: error: linux/init.h: No such file or directory
vv.c:3:26: error: linux/module.h: No such file or directory
vv.c:4:28: error: linux/syscalls.h: No such file or directory
In file included from /usr/include/asm/fcntl.h:1,
from /usr/include/linux/fcntl.h:4,
from vv.c:5:
/usr/include/asm-generic/fcntl.h:120: error: expected specifier-qualifier-list before ‘off_t’
/usr/include/asm-generic/fcntl.h:143: error: expected specifier-qualifier-list before ‘loff_t’
vv.c:6:25: error: asm/uaccess.h: No such file or directory
vv.c: In function ‘main’:
vv.c:12: error: ‘KERNEL_DS’ undeclared (first use in this function)
vv.c:12: error: (Each undeclared identifier is reported only once
vv.c:12: error: for each function it appears in.)
additionally, above header files is what i want to.
how can i get the kernel header file?
please help me..
Did installing the headers complete? If so then they should be installed in /usr/include and the include directives you gave should just work.
Edit:
First run:
sudo apt-get update
To make sure you have the latest packages, then:
sudo apt-get install linux-headers-$(uname -r)
This is the one package that should contain all the kernel header files in Ubuntu.

Resources