I recently started working with QNX 6.5.0 and can't understand how in QNX develop programs using Intel AVX. Installed QNX Development Studio 6.5.0 with GCC 4.4.2, I'm trying to write a simple program, but the build fails.
#include <immitnrin.h>
int main( int argc, char** argv )
{
__m256 var;
__m256 var2;
__m256 result;
var = _mm256_set1_ps(1.f);
var2 = _mm256_set1_ps(3.f);
result = _mm256_add_ps(var,var2);
return 0;
}
error: immitnrin.h: No such file or directory
In function 'int main(int, char**)':
error: '__m256' was not declared in this scope
error: expected ';' before 'var'
error: expected ';' before 'var2'
error: expected ';' before 'result'
error: 'var' was not declared in this scope
error: '_mm256_set1_ps' was not declared in this scope
error: 'var2' was not declared in this scope
error: 'result' was not declared in this scope
error: '_mm256_add_ps' was not declared in this scope
How and where can I learn how to work with SIMD instructions Intel in QNX?
Update
Here's the output from the program make.exe:
make.exe -k CPULIST=x86 all --file=C:/DOCUME~1/Andrew/LOCALS~1/Temp/QMakefile.tmp
C:/QNX650/host/win32/x86/usr/bin/make.exe -j 1 -Cx86 -fMakefile all
make.exe[1]: Entering directory C:/ide-4.7-workspace/project_test_avx/x86'
C:/QNX650/host/win32/x86/usr/bin/make.exe -j 1 -Co -fMakefile all
make.exe[2]: Entering directoryC:/ide-4.7-workspace/project_test_avx/x86/o'
Related
Just for fun, I'm attempting to build the irixxxx's qemu-irix as a Docker image.
It builds successfuly under Debian Buster (using GCC 8 container). However, it fails to build under Alpine 3.10 (it fails only when I selected the Irix targets), with the following errors (at the make stage):
CC util/oslib-posix.o
In file included from util/oslib-posix.c:39:
/usr/include/sys/signal.h:1:2: warning: #warning redirecting incorrect #include <sys/signal.h> to <signal.h> [-Wcpp]
#warning redirecting incorrect #include <sys/signal.h> to <signal.h>
^~~~~~~
CC util/qemu-openpty.o
util/qemu-openpty.c: In function 'qemu_openpty_raw':
util/qemu-openpty.c:123:9: warning: implicit declaration of function 'openpty'; did you mean 'openat'? [-Wimplicit-function-declaration]
if (openpty(&amaster, aslave, pty_buf, NULL, NULL) < 0) {
^~~~~~~
openat
util/qemu-openpty.c:123:9: warning: nested extern declaration of 'openpty' [-Wnested-externs]
(...)
CC irix-linux-user/linux-user/syscall.o
/qemu-irix/linux-user/syscall.c:6784:22: error: 'F_EXLCK' undeclared here (not in a function); did you mean 'F_RDLCK'?
TRANSTBL_CONVERT(F_EXLCK),
^~~~~~~
/qemu-irix/linux-user/syscall.c:6779:51: note: in definition of macro 'TRANSTBL_CONVERT'
#define TRANSTBL_CONVERT(a) { -1, TARGET_##a, -1, a }
^
/qemu-irix/linux-user/syscall.c:6785:22: error: 'F_SHLCK' undeclared here (not in a function); did you mean 'F_RDLCK'?
TRANSTBL_CONVERT(F_SHLCK),
^~~~~~~
/qemu-irix/linux-user/syscall.c:6779:51: note: in definition of macro 'TRANSTBL_CONVERT'
#define TRANSTBL_CONVERT(a) { -1, TARGET_##a, -1, a }
^
In file included from /qemu-irix/linux-user/syscall.c:121:
/qemu-irix/linux-user/syscall.c: In function 'target_to_host_sigevent':
/qemu-irix/linux-user/syscall.c:7422:27: error: 'struct sigevent' has no member named '_sigev_un'; did you mean 'sigev_value'?
__get_user(host_sevp->_sigev_un._tid, &target_sevp->_sigev_un._tid);
^~~~~~~~~
/qemu-irix/linux-user/qemu.h:501:5: note: in definition of macro '__get_user_e'
((x) = (typeof(*hptr))( \
^
/qemu-irix/linux-user/syscall.c:7422:5: note: in expansion of macro '__get_user'
__get_user(host_sevp->_sigev_un._tid, &target_sevp->_sigev_un._tid);
^~~~~~~~~~
/qemu-irix/linux-user/syscall.c:7422:36: error: '(const bitmask_transtbl *)&<erroneous-expression>' is a pointer; did you mean to use '->'?
__get_user(host_sevp->_sigev_un._tid, &target_sevp->_sigev_un._tid);
^
/qemu-irix/linux-user/qemu.h:501:5: note: in definition of macro '__get_user_e'
((x) = (typeof(*hptr))( \
^
/qemu-irix/linux-user/syscall.c:7422:5: note: in expansion of macro '__get_user'
__get_user(host_sevp->_sigev_un._tid, &target_sevp->_sigev_un._tid);
^~~~~~~~~~
/qemu-irix/linux-user/qemu.h:506:13: warning: left-hand operand of comma expression has no effect [-Wunused-value]
(hptr)), (void)0)
^
/qemu-irix/linux-user/qemu.h:510:31: note: in expansion of macro '__get_user_e'
# define __get_user(x, hptr) __get_user_e(x, hptr, be)
^~~~~~~~~~~~
/qemu-irix/linux-user/syscall.c:7422:5: note: in expansion of macro '__get_user'
__get_user(host_sevp->_sigev_un._tid, &target_sevp->_sigev_un._tid);
^~~~~~~~~~
/qemu-irix/linux-user/syscall.c: In function 'do_syscall':
/qemu-irix/linux-user/syscall.c:13545:25: warning: implicit declaration of function 'sethostid'; did you mean 'gethostid'? [-Wimplicit-function-declaration]
ret = get_errno(sethostid(arg1));
^~~~~~~~~
gethostid
/qemu-irix/linux-user/syscall.c:13545:25: warning: nested extern declaration of 'sethostid' [-Wnested-externs]
make[1]: *** [/qemu-irix/rules.mak:66: linux-user/syscall.o] Error 1
make: *** [Makefile:472: subdir-irix-linux-user] Error 2
The command '/bin/sh -c make && DESTDIR=/tmp/qemu make install' returned a non-zero code: 2
I researched about the differences between Debian's and Alpine's GCC (in fact, libc6 and musl) about similar failures, but I haven't found any information about how to solve this without modifying the code.
So, where can I find more information about this issue and which packages may solve it? Thanks.
Dockerfiles and full log here. Docker container image (Debian Buster) here.
The difference seems to be caused by the underlying libc implementations: glibc of Debian, vs musl-libc of Alpine.
While GNU libc is the defacto standard libc implementation in Linux, musl libc is used by a handful of distributions, such as Alpine Linux and Void Linux. musl is a minimalistic strict-POSIX libc implementation, and is generally not compatible with glibc. Usually, software projects have to be ported to musl libc to be supported on Alpine, especially non trivial applications.
The compilation of syscall.c breaks on several places, the first being:
/qemu-irix/linux-user/syscall.c:6784:22: error: 'F_EXLCK' undeclared here (not in a function); did you mean 'F_RDLCK'?
TRANSTBL_CONVERT(F_EXLCK)
The F_EXLCK is macro is not defined in musl libc's fcntl.h. However, it could be easily patched by defining it manually, for example with make CFLAGS='"-DF_EXLCK=4"'. This is how qemu is patched for musl for non-irix targets (patch link).
However, there are more undefined macros down the road, such as __SIGRTMIN and __SIGRTMAX, the macro TRANSTBL_CONVERT, and probably others. Patching them ad-hoc may not be enough - so it appears to be that the qemu-irix project has to be properly ported for Alpine and musl libc.
If you're willing, you could try following existing qemu musl patches, and attempt to patch it yourself for qemu-irix:
- https://lists.gnu.org/archive/html/qemu-devel/2014-04/msg04773.html
- https://github.com/NixOS/nixpkgs/pull/46449/files
Off topic comment, use make -j to build parallely, which will end much faster.
I used CMake to compile a static version of (a fairly recent of) z3 using:
cmake -DBUILD_LIBZ3_SHARED=false -DCMAKE_INSTALL_PREFIX=/opt/z3-devel -G "Unix Makefiles" ../
Now when I statically link the library against a C++ program, say this small variation of a z3 example:
#include"z3++.h"
using namespace z3;
int main(int argc, char** argv) {
config conf;
context c(conf);
expr x = c.int_const("x");
expr y = c.int_const("y");
expr z = c.int_const("z");
goal g(c);
g.add( ((2*x)+y)+z == 4);
g.add( (x+(2*y))+z == 4);
g.add( x+y == 4);
std::cout << g << "\n";
tactic t(c, "fm");
apply_result r = t(g);
std::cout << r << "\n";
return 0;
}
via
g++ -c -I /opt/z3-devel/include -static -o main.o main.cc
g++ -static -L /opt/z3-devel/lib64 -o main main.o -lz3
I receive a long list of undefined reference linking errors. What solves the issue is to add -lgomp -pthread -lrt -ldl as additional libraries. The linker outputs the following warning:
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/8/libgomp.a(target.o): in function `gomp_target_init':
(.text+0x32c): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
Nevertheless, the program runs fine on my own machine and on Starexec.
Is this combination of static and dynamic linking the best I can do? Shouldn't those libraries be already statically linked into libz3.a? I have static versions of gomp, pthread and rt available on the system.
I am debugging a C program on arm64 with lldb and in order to implement my own debugging function I wrote a standalone debug helper program, compiled it as a dylib and imported it into lldb by using:
(lldb) target modules add debugHelper.dylib
However when I call the function declared in the dylib, lldb errors:
(lldb) expression debugPrint()
error: Couldn't lookup symbols:
_debugPrint
If I type in a random function name (e.g. foo):
(lldb) expression foo()
error: use of undeclared identifier 'foo'
, which makes me believe importing the dylib is indeed successful, since debugPrint is not an undeclared identifier.
// debugHelper.c
#include <stdio.h>
int debugPrint() {
printf("%s\n", "Debug info printed! \n");
return 0;
}
debugHelper.dylib is compiled with:
$ xcrun --sdk iphoneos cc debugHelper.c -o debugHelper.dylib -dynamiclib -arch arm64 -g
I also verified with nm that debugHelper.dylib does have the _debugPrint symbol:
$ nm debugHelper.dylib
0000000000007f2c T _debugPrint
U _printf
U dyld_stub_binder
Results of (lldb) image list :
[263]... debugHelper.dylib.dSYM/Contents/Resources/DWARF/debugHelper.dylib
target modules add loads the binary (and its dSYM, if there is one) into lldb's pool of binaries it knows about. But the dylib has not been loaded into your inferior process -- you will not be able to run the functions in there.
Instead, run dlopen() in your process:
(lldb) p (int)dlopen("debugHelper.dylib", 10)
(that 10 is RTLD_GLOBAL|RTLD_NOW, v. dlfcn.h). There's also an SB API method to do this, SBProcess::LoadImage which doesn't require you to look up the details of dlopen. e.g.
(lldb) script lldb.process.LoadImage(lldb.SBFileSpec("debugHelper.dylib", False), lldb.SBError())
I can't get the cv::Mat_ constructor to compile that makes a view over user-allocated data. Here's a toy example that'll crash upon execution, but suffices for demonstrating compilation errors.
#include <opencv2/core/core.hpp>
using namespace cv;
void f(){
int size_[] = {1, 2, 3};
int dimension_ = 3;
float* data = nullptr;
size_t bytes = 0;
Mat_<float> image_mat(dimension_, size_, data, &bytes);
}
Compiling above code with
nick#hawaii:~/opencv-undefined-ref$ clang++ main.cpp -std=c++11 -l opencv_core
Gives me
/tmp/main-15f5e8.o: In function `f()':
main.cpp:(.text+0x4c): undefined reference to `cv::Mat_<float>::Mat_(int, int const*, float*, unsigned long const*)'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Looking through opencv2/core/mat.hpp, I also can't find the template-definition for this constructor... is it forgotten? Or am I missing something? Should I include another header?
This is on Ubuntu 14.04 LTS, opencv-core-dev Version: 2.4.8+dfsg1-2ubuntu1
I'm installing Passenger on Mac OSX (10.9.5) and have been getting errors. If it matters, Ruby 2.1.2 is installed through rbenv and I have Rails 4.0.0 installed. Per the 'Agile Web Development with Rails 4' book I'm installing Passenger version 4.0.8. After typing the command
> sudo passenger-install-apache2-module
in Terminal it takes me through some prompts for the installation process and then I get the following error section
In file included from ext/common/Logging.cpp:31:
In file included from ext/common/Utils/IOUtils.h:39:
ext/common/FileDescriptor.h:99:2: error: unknown type name 'shared_ptr'
shared_ptr<SharedData> data;
^
ext/common/FileDescriptor.h:99:12: error: expected member name or ';' after declaration specifiers
shared_ptr<SharedData> data;
~~~~~~~~~~^
ext/common/FileDescriptor.h:126:4: error: use of undeclared identifier 'data'
data = make_shared<SharedData>(fd, autoClose);
^
ext/common/FileDescriptor.h:145:7: error: use of undeclared identifier 'data'; did you mean
'StaticString::data'?
if (data != NULL) {
^~~~
StaticString::data
ext/common/StaticString.h:161:14: note: 'StaticString::data' declared here
const char *data() const {
^
In file included from ext/common/Logging.cpp:31:
In file included from ext/common/Utils/IOUtils.h:39:
ext/common/FileDescriptor.h:145:7: error: call to non-static member function without an object
argument
if (data != NULL) {
^~~~
ext/common/FileDescriptor.h:146:4: error: use of undeclared identifier 'data'; did you mean
'StaticString::data'?
data->close(checkErrors);
^~~~
StaticString::data
ext/common/StaticString.h:161:14: note: 'StaticString::data' declared here
const char *data() const {
^
In file included from ext/common/Logging.cpp:31:
In file included from ext/common/Utils/IOUtils.h:39:
ext/common/FileDescriptor.h:146:4: error: call to non-static member function without an object
argument
data->close(checkErrors);
^~~~
ext/common/FileDescriptor.h:147:4: error: use of undeclared identifier 'data'; did you mean
'StaticString::data'?
data.reset();
^~~~
StaticString::data
ext/common/StaticString.h:161:14: note: 'StaticString::data' declared here
const char *data() const {
^
In file included from ext/common/Logging.cpp:31:
In file included from ext/common/Utils/IOUtils.h:39:
ext/common/FileDescriptor.h:147:4: error: call to non-static member function without an object
argument
data.reset();
^~~~
ext/common/FileDescriptor.h:160:7: error: use of undeclared identifier 'data'; did you mean
'StaticString::data'?
if (data != NULL) {
^~~~
StaticString::data
ext/common/StaticString.h:161:14: note: 'StaticString::data' declared here
const char *data() const {
^
In file included from ext/common/Logging.cpp:31:
In file included from ext/common/Utils/IOUtils.h:39:
ext/common/FileDescriptor.h:160:7: error: call to non-static member function without an object
argument
if (data != NULL) {
^~~~
ext/common/FileDescriptor.h:161:13: error: use of undeclared identifier 'data'; did you mean
'StaticString::data'?
int fd = data->fd;
^~~~
StaticString::data
ext/common/StaticString.h:161:14: note: 'StaticString::data' declared here
const char *data() const {
^
In file included from ext/common/Logging.cpp:31:
In file included from ext/common/Utils/IOUtils.h:39:
ext/common/FileDescriptor.h:161:13: error: call to non-static member function without an object
argument
int fd = data->fd;
^~~~
ext/common/FileDescriptor.h:162:4: error: use of undeclared identifier 'data'; did you mean
'StaticString::data'?
data->detach();
^~~~
StaticString::data
ext/common/StaticString.h:161:14: note: 'StaticString::data' declared here
const char *data() const {
^
In file included from ext/common/Logging.cpp:31:
In file included from ext/common/Utils/IOUtils.h:39:
ext/common/FileDescriptor.h:162:4: error: call to non-static member function without an object
argument
data->detach();
^~~~
ext/common/FileDescriptor.h:163:4: error: use of undeclared identifier 'data'; did you mean
'StaticString::data'?
data.reset();
^~~~
StaticString::data
ext/common/StaticString.h:161:14: note: 'StaticString::data' declared here
const char *data() const {
^
In file included from ext/common/Logging.cpp:31:
In file included from ext/common/Utils/IOUtils.h:39:
ext/common/FileDescriptor.h:163:4: error: call to non-static member function without an object
argument
data.reset();
^~~~
ext/common/FileDescriptor.h:177:7: error: use of undeclared identifier 'data'; did you mean
'StaticString::data'?
if (data == NULL) {
^~~~
StaticString::data
ext/common/StaticString.h:161:14: note: 'StaticString::data' declared here
const char *data() const {
^
In file included from ext/common/Logging.cpp:31:
In file included from ext/common/Utils/IOUtils.h:39:
ext/common/FileDescriptor.h:177:7: error: call to non-static member function without an object
argument
if (data == NULL) {
^~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
rake aborted!
Command failed with status (1): [g++ -Iext -Iext/common -Iext/libev -Wno-ambiguous-member-template -fPIC -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -I/usr/include/apr-1 -I/usr/include/apr-1 -I/usr/include/apache2 -D_REENTRANT -I/usr/local/include -DHASH_NAMESPACE="__gnu_cxx" -DHASH_MAP_HEADER="<ext/hash_map>" -DHASH_MAP_CLASS="hash_map" -DHAS_ALLOCA_H -DHAS_SFENCE -DHAS_LFENCE -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-long-long -Wno-missing-field-initializers -ggdb -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS -fcommon -fvisibility=hidden -DVISIBILITY_ATTRIBUTE_SUPPORTED -o buildout/apache2/module_libpassenger_common/Logging.o -c ext/common/Logging.cpp]
/Library/Ruby/Gems/2.0.0/gems/passenger-4.0.8/build/cplusplus_support.rb:51:in `run_compiler'
/Library/Ruby/Gems/2.0.0/gems/passenger-4.0.8/build/cplusplus_support.rb:61:in `compile_cxx'
/Library/Ruby/Gems/2.0.0/gems/passenger-4.0.8/lib/phusion_passenger/common_library.rb:133:in `block (2 levels) in define_category_tasks'
Tasks: TOP => apache2 => buildout/apache2/mod_passenger.so => buildout/apache2/module_libpassenger_common/Logging.o
(See full trace by running task with --trace)
--------------------------------------------
It looks like something went wrong
Please read our Users guide for troubleshooting tips:
/Library/Ruby/Gems/2.0.0/gems/passenger-4.0.8/doc/Users guide Apache.html
If that doesn't help, please use our support facilities at:
https://www.phusionpassenger.com
We'll do our best to help you.
I've looked through the documentation like it suggested but can't seem to find what could cause these errors. I've also looked online with the same result. Any idea what could cause this? How should I fix it?
I think you're using too outdated version of passenger. Try install it from http://brew.sh/. https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html#install_osx_homebrew