How to compile Simple C program in QNX - qnx

I am trying to compile simple C program using QNX as shown below.
conftest.c
int main ()
{
return 0;
}
compiling with option:
qcc conftest.c -V4.7.3,gcc_ntoarmv7le_cpp
compiler throw error like below
cc: ignoring unknown option '"-D__GNUC__'
cc: ignoring unknown option '"-D__GNUC__'
cc: ignoring unknown option ' --dynamic-linker /usr/lib/ldqnx.so.2 --sysroot'
cc: ignoring unknown option ' --hash-style'
cc: ignoring unknown option '%(fmudflap: --wrap'
cc: ignoring unknown option '"-D__GNUC__'
cc: ignoring unknown option '"-D__GNUC__'
cc: ignoring unknown option ' --dynamic-linker /usr/lib/ldqnx.so.2 --sysroot'
cc: ignoring unknown option ' --hash-style'
cc: ignoring unknown option '%(fmudflap: --wrap'
failed: No such file or directoryys-qnx-660-all/bin/sys/qnx/host/linux/x86/usr/lib/gcc/arm-unknown-nto-qnx6.6.0eabi/4.7.3/
failed: No such file or directoryys-qnx-660-all/bin/sys/qnx/host/linux/x86/usr/bin/arm-unknown-nto-qnx6.6.0eabi-as
error 1e//Desktop/sys-qnx-660-all/bin/sys/qnx/host/linux/x86/usr/lib/gcc/arm-unknown-nto-qnx6.6.0eabi/4.7.3/
error 1e/Desktop/sys-qnx-660-all/bin/sys/qnx/host/linux/x86/usr/bin/arm-unknown-nto-qnx6.6.0eabi-as
How to I compile it?

What you can do is you can compile through QNX IDE . Remember Do not change the default template signature .
int main(int argc, char *argv[]) {
return 0;
}
Right click on the project & First Clean project then Build project . If still it do not compile then let me know .
Also, this URL May help you .

Related

How to compile RocksDB for IOS?

I've been trying to compile the rocksdb platform for iOS for a while now.
The simple git clone the repo and run
TARGET_OS="IOS" make static_lib -j8
fails with a spew of errors, and I'm not sure where I can also add the preprocessor directives.
I have then been looking at wrappers, and trying to compile them for a later version:
https://github.com/koraykoska/rocksdb.swift : This uses a rocksdb version of 6.4.7, and uses CocoaPods to compile the rocksdb library and the swift wrapper. I have tried cloning the rocksdb repo into the upstream folder, and then use this 'rocksdb.swift' pod in an Xcode Project.
Here are the changes I made in the pod spec(v6.22.1 being the one I need to compile.)
(librocksdb.podspec)
s.name = 'librocksdb'
s.version = '***6.22.1***'
s.summary = 'rocksdb bindings for Swift. Cocoapods and SPM support. Linux support.'
(rocksdb.swift.podspec)
s.name = 'rocksdb.swift'
s.version = '***6.22.1***'
s.summary = 'rocksdb Wrapper for Swift. Cocoapods and SPM support. Linux support.'
...
s.dependency 'librocksdb', '~> ***6.22.1***'
...
The pod install now fails as it cannot find the 'new' version of librocksdb so I add both librocksdb and rocksdb.swift to my Podfile with the :path => format.
The pod then installs, and the Xcode project has this error
/.../librdb/librocksdb/rocksdb/memtable/write_buffer_manager.cc:10:10: 'rocksdb/write_buffer_manager.h' file not found
https://github.com/hlzhang/rocksdb-build : Along similar lines to the previous wrapper, I tried changing the versions and then compiling. This meant some changes in common.sh and build-rocksdb-ios.sh scripts. Fails with
monitoring/perf_context.cc:23:2: error: "No thread-local support. Disable perf context with -DNPERF_CONTEXT."
#error "No thread-local support. Disable perf context with -DNPERF_CONTEXT."
^
1 error generated.
monitoring/iostats_context.cc:19:2: error: "No thread-local support. Disable iostats context with -DNIOSTATS_CONTEXT."
#error \
^
1 error generated.
$DEBUG_LEVEL is 0
monitoring/iostats_context.cc:19:2: error: "No thread-local support. Disable iostats context with -DNIOSTATS_CONTEXT."
#error \
^
monitoring/perf_context.cc:23:2: error: "No thread-local support. Disable perf context with -DNPERF_CONTEXT."
#error "No thread-local support. Disable perf context with -DNPERF_CONTEXT."
^
1 error generated.
1 error generated.
In file included from cache/sharded_cache.cc:16:
In file included from ./util/hash.h:26:
./util/fastrange.h:60:5: error: unknown type name '__uint128_t'
__uint128_t wide = __uint128_t{range} * hash;
^
./util/fastrange.h:60:24: error: use of undeclared identifier '__uint128_t'
__uint128_t wide = __uint128_t{range} * hash;
^
./util/fastrange.h:60:35: error: expected ';' at end of declaration
__uint128_t wide = __uint128_t{range} * hash;
^
;
./util/fastrange.h:53:35: error: unused parameter 'hash' [-Werror,-Wunused-parameter]
static inline Range Fn(uint64_t hash, Range range) {
^
./util/fastrange.h:53:47: error: unused parameter 'range' [-Werror,-Wunused-parameter]
static inline Range Fn(uint64_t hash, Range range) {
^
5 errors generated.
I try adding the relevant flags to the CFLAGS variable, and also add the -std=c++17 flag to attempt to resolve the uint__128 issue.
This then fails with
./cache/lru_cache.h:269:11: error: aligned deallocation function of type 'void (void *, std::align_val_t) noexcept' is only available on iOS 11 or newer
virtual ~LRUCacheShard() override = default;
^
cache/lru_cache.cc:656:18: note: in defaulted destructor for 'rocksdb::LRUCacheShard' first required here
shards_[i].~LRUCacheShard();
^
./cache/lru_cache.h:269:11: note: if you supply your own aligned allocation functions, use -faligned-allocation to silence this diagnostic
virtual ~LRUCacheShard() override = default;
^
1 error generated.
This is not resolved using by changing the IOS_SDK_VERSION to a newer version in the build-rockdb-ios.sh script.
I was hence looking for someone who has compiled a recent version of rocksdb/a wrapper of rocksdb for iOS and am looking for guidance.
TIA
Try RocksDB 6.x version, from 7.0 RocksDB need C++17。
Dropping some compiler support in 7.0#9388
#Xcode Version 13.2.1 (13C100)
$ brew install git
$ brew install cmake
$ git clone https://github.com/facebook/rocksdb.git
$ git checkout v6.29.5
$ export PORTABLE=1
$ export TARGET_OS=IOS
$ export ROCKSDB_LITE=1
$ export IOS_CROSS_COMPILE=1
#disable int128
$ export TEST_UINT128_COMPAT=1
$ export DISABLE_WARNING_AS_ERROR=1
$ export DEBUG_LEVEL=0
$ export EXTRA_CXXFLAGS="-DNPERF_CONTEXT -DNIOSTATS_CONTEXT"
$ make V=1 VERBOSE=1 -j16 static_lib

OpenCV 3.4.4 make error with mingw32-make "persistence.cpp"

I am currently installing OpenCV3.4.4 in ordre to use it with Code::Blocks. I used CMake GUI to Configure and Generates the binaries.
But when I'm using 'mingw32-make' to finish the installation, an error occurs about strnlen which apparently is not define. I have the following message :
"
C:\opencv\sources\modules\core\src\persistence.cpp: In function 'char* icvGets(CvFileStorage*, char*, int)':
C:\opencv\sources\modules\core\src\persistence.cpp:71:46: error: 'strnlen' was not declared in this scope
size_t sz = strnlen(ptr, maxCount);
^
C:\opencv\sources\modules\core\src\persistence.cpp:82:46: error: 'strnlen' was not declared in this scope
size_t sz = strnlen(ptr, maxCount);
^
modules\core\CMakeFiles\opencv_core.dir\build.make:901: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/src/persistence.cpp.obj' failed
mingw32-make[2]: * [modules/core/CMakeFiles/opencv_core.dir/src/persistence.cpp.obj] Error 1
CMakeFiles\Makefile2:1671: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/all' failed
mingw32-make[1]: * [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
Makefile:161: recipe for target 'all' failed
mingw32-make: *** [all] Error 2"
"
I've read some other forum asking to change some variables in CMake GUI but for other issues and I did not succeed to find the same as me. I hope that someone could help me. thank you
If this is useful for you, I was able to compile OpenCV 3.1.0 with MinGW32.
I have not been able to compile OpenCV3.4.7 with MinGW32 (I think that this backward compatibility has been abandoned), but I succeeded to compile OpenCV3.4.7 with MinGW64.

Can't build OpenCV 3.1 on Windows (using MinGW)

I need to build OpenCV from source, because I want to make modifications to it. So using pre-built binaries is not an option for me. I'm doing this on Windows 8. I do not have MS Visual Studio, and I don't want to use it.
Here is how I reproduce the build error:
I git clone https://github.com/opencv/opencv
I use CMake 3.7.1, press Configure, then press Generate. It seems to work (no errors). I named the output folder opencv/release.
I go to the opencv/release folder, and type mingw32-make.
Eventually, after compiling for a while, it displays the following error message:
Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/parallel.cpp.obj
modules\core\src\parallel.cpp:135:43: error: operator '&&' has no right operand
modules\core\src\parallel.cpp: In function 'void cv::parallel_for_(const cv::Range&, const cv::ParallelLoopBody&, double)':
modules\core\src\parallel.cpp:311:52: error: 'parallel_for_pthreads' was not declared in this scope parallel_for_pthreads(range, body, nstripes);
^
modules\core\src\parallel.cpp: In function 'int cv::getNumThreads()':
modules\core\src\parallel.cpp:370:50: error: 'parallel_pthreads_get_threads_num' was not declared in this scope return parallel_pthreads_get_threads_num();
^
modules\core\src\parallel.cpp: In function 'void cv::setNumThreads(int)':
modules\core\src\parallel.cpp:431:46: error: 'parallel_pthreads_set_threads_num' was not declared in this scope parallel_pthreads_set_threads_num(threads);
^
modules\core\CMakeFiles\opencv_core.dir\build.make:990: recipe for target 'modules/core/CMakeFiles/opencv_core.dir/src/parallel.cpp.obj' failed mingw32-make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/src/parallel.cpp.obj] Error 1
Note: I tried to compile both with and without TPP (in the CMake config), and I get the same error message.
Also, I read the other similar questions on StackOverflow and the answers do not help.

Error building opencv on a raspberry pi 3

I was following this example and received the following error when running make
In file included from /root/src/opencv-3.1.0/modules/videoio/src/cap_ffmpeg.cpp:45:0:
/root/src/opencv-3.1.0/modules/videoio/src/cap_ffmpeg_impl.hpp: In member function ‘bool OutputMediaStream_FFMPEG::open(const char*, int, int, double)’:
/root/src/opencv-3.1.0/modules/videoio/src/cap_ffmpeg_impl.hpp:2207:41: warning: ignoring return value of ‘int avformat_write_header(AVFormatContext*, AVDictionary**)’, declared with attribute warn_unused_result [-Wunused-result]
avformat_write_header(oc_, NULL);
^
Linking CXX shared library ../../lib/libopencv_videoio.so
/usr/bin/ld: /usr/local/lib/libx264.a(common.o): relocation R_ARM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libx264.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
modules/videoio/CMakeFiles/opencv_videoio.dir/build.make:215: recipe for target 'lib/libopencv_videoio.so.3.1.0' failed
make[2]: *** [lib/libopencv_videoio.so.3.1.0] Error 1
CMakeFiles/Makefile2:4058: recipe for target 'modules/videoio/CMakeFiles/opencv_videoio.dir/all' failed
make[1]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2
Makefile:147: recipe for target 'all' failed
make: *** [all] Error 2
I have successfully installed opencv on Raspberry Pi 3 by following the steps in the link http://www.pyimagesearch.com/2015/02/23/install-opencv-and-python-on-your-raspberry-pi-2-and-b/
The changes i made while following the steps are:
Use 'aptitude' instead of 'apt-get' and accept all recommendations given
Before following Step 11, run 'source ~/.profile'. To quit, run 'deactivate'
Hope this helps :)

ImageMagick No such file or directory

I am trying to get a screen shot using the following code;
#include <stdio.h>
#include </wand/MagickWand.h>
int main(int argc, char **argv)
{
MagickWandGenesis();
MagickWand *wand = NULL;
wand = NewMagickWand();
MagickReadImage(wand,"x:root"); // <-- Invoke ImportImageCommand
MagickWriteImage(wand,"screen_shot.png");
if(wand)wand = DestroyMagickWand(wand);
MagickWandTerminus();
return 0;
}
however I am getting the following error message, magick-config.h is in the specified folder 'magick/magick-config.h' , I do not understand what the problem is;
$ make screenshot
cc screenshot.c -o screenshot
In file included from /wand/MagickWand.h:29:0,
from screenshot.c:2:
/magick/magick-config.h:29:3: warning: #warning "you should set MAGICKCORE_QUANTUM_DEPTH to sensible default set it to configure time default"
/magick/magick-config.h:30:3: warning: #warning "this is an obsolete behavior please fix your makefile"
/magick/magick-config.h:52:3: warning: #warning "you should set MAGICKCORE_HDRI_ENABLE to sensible default set it to configure time default"
/magick/magick-config.h:53:3: warning: #warning "this is an obsolete behavior please fix yours makefile"
In file included from /wand/MagickWand.h:70:0,
from screenshot.c:2:
/magick/MagickCore.h:29:36: fatal error: magick/magick-config.h: No such file or directory
compilation terminated.
<builtin>: recipe for target `screenshot' failed
make: *** [screenshot] Error 1
Any help would be much appreciated.
Thanks
Yes, Actually I had a problem like that and it was fixed when I installed the package libmagickcore-dev with following command:
sudo apt-get install libmagickcore-dev
through the Ubuntu Repositories. :-)
Also If it did not work, you try installing the package called "graphicsmagick-libmagick-dev-compat".
AC;
You might have installed too much?
Try to remove Image-magick-"Perl Module"
The Perl Module.
And then again try the process to install ImageMagick with PECL or your other way.
Often this problem is occurring because of installation made with make install on a platform.
Remove all other installations and just do the installation from pure sources if you already started doing that.
.deb and .rpm packages might be installed in different ways than making from source.

Resources