So I installed openssl in one of the 3 aix servers but it just wouldn't work in the other 2 servers.
I'm trying to install openssl-1.0.1h on AIX.
Step 1: I ran the config file -
./config -–prefix=/appl/peoplesoft/apache/openssl
Output: a Makefile is generated.
Step 2: run the make command.
Output of command make:
$ make
making all in crypto...
( echo "#ifndef MK1MF_BUILD"; echo ' /* auto-generated by crypto/Makefile for crypto/cversion.c */'; echo ' #define CFLAGS "cc -DOPENSSL_THREADS -qthreaded -D_THREAD_SAFE -DDSO_DLFCN -DHAVE_DLFCN_H -q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DAES_ASM"'; echo ' #define PLATFORM "aix-cc"'; echo " #define DATE \"`LC_ALL=C LC_TIME=C date`\""; echo '#endif' ) >buildinf.h
cc -I. -I.. -I../include -DOPENSSL_THREADS -qthreaded -D_THREAD_SAFE -DDSO_DLFCN -DHAVE_DLFCN_H -q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DAES_ASM -c cryptlib.c
cc: unrecognized option '-qthreaded'
cc: unrecognized option '-q32'
cc: unrecognized option '-qmaxmem=16384'
cc: unrecognized option '-qro'
cc: unrecognized option '-qroconst'
I don't know what's wrong.
I'm using gcc version 4.2.0 and cc has a softlink to gcc.
Should I try copying the Makefile file from the server where it works?
I'll try the previous comments: gcc doesn't really understands xlc's options, use either this:
./Configure -–prefix=/appl/peoplesoft/apache/openssl -maix32 \
... aix-gcc
or
./Configure -–prefix=/appl/peoplesoft/apache/openssl -maix64 \
... aix64-gcc
Where ... is the set of compiler/linker options you can think of, eg:
-mtune=native -pthread -lpthreads -Wl,-brtl
Open config file , for AIX and locate the "favor vendor cc over gcc"
Change this: (replace cc with gcc for AIX)
if [ "${SYSTEM}" = "AIX" ]; then # favor vendor cc over gcc
(cc) 2>&1 | grep -iv "not found" > /dev/null && CC=cc
fi
to this :
if [ "${SYSTEM}" = "AIX" ]; then # favor vendor cc over gcc
(cc) 2>&1 | grep -iv "not found" > /dev/null && CC=gcc
fi
And rerun your configuration ...
Related
OS - RedHat 8.5, kernel 4.18.0-348.20.1.el8_5.x86_64, gcc-8.5.0
I have installed kernel-devel and kernel-headers, and tried to build a very simple kernel module (just a pair of printk()).
Makefile:
obj-m += test_mod.o
MSRC ?= $(PWD)
KDIR ?= /lib/modules/`uname -r`/build/
all:
make -C $(KDIR) M=$(MSRC) modules
clean:
make -C $(KDIR) M=$(MSRC) clean
However I'm getting error:
% make V=1
make -C /lib/modules/`uname -r`/build M= modules
make[1]: Entering directory '/usr/src/kernels/4.18.0-348.20.1.el8_5.x86_64'
arch/x86/Makefile:249: *** You are building kernel with non-retpoline compiler, please update your compiler.. Stop.
make[1]: Leaving directory '/usr/src/kernels/4.18.0-348.20.1.el8_5.x86_64'
make: *** [Makefile:4: all] Error 2
%
Do I have to upgrade to a new compiler, if so which compiler version is needed? man gcc on my machine (RHEL8.5) says that -mindirect-branch= option is supported, and I believe this is the one enabling retpoline.
Should it be possible to disable retpoline support in the kernel? (however I would not like to rebuild the kernel if possible).
Thanks!
EDIT
I disabled retpoline as suggested by 0andriy via grub configuration file, (cat /proc/cmdline shows spectre_v2=off):
% grub2-editenv - set kernelopts=root=/dev/mapper/rhel_ps3cat5505k1-root ro crashkernel=auto resume=/dev/mapper/rhel_ps3cat5505k1-swap rd.lvm.lv=rhel_ps3cat5505k1/root rd.lvm.lv=rhel_ps3cat5505k1/swap rhgb quiet spectre_v2=off
% reboot
However the build still fails:
% make V=1
make -C /lib/modules/`uname -r`/build/ M=/home/mrv/tmp modules
make[1]: Entering directory '/usr/src/kernels/4.18.0-348.20.1.el8_5.x86_64'
test -e include/generated/autoconf.h -a -e include/config/auto.conf || ( \
echo >&2; \
echo >&2 " ERROR: Kernel configuration is invalid."; \
echo >&2 " include/generated/autoconf.h or include/config/auto.conf are missing.";\
echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \
echo >&2 ; \
/bin/false)
mkdir -p /home/mrv/tmp/.tmp_versions ; rm -f /home/mrv/tmp/.tmp_versions/*
make -f ./scripts/Makefile.build obj=/home/mrv/tmp
(cat /dev/null; echo kernel//home/mrv/tmp/test_mod.ko;) > /home/mrv/tmp/modules.order
gcc -Wp,-MD,/home/mrv/tmp/.test_mod.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/8/include -I./arch/x86/include -I./arch/x86/include/generated -I./include/drm-backport -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -fno-PIE -DCC_HAVE_ASM_GOTO -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_CRC32=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -DCONFIG_TPAUSE=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-int-in-bool-context -O2 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector-strong -Wno-unused-but-set-variable -Wno-unused-const-variable -g -gdwarf-4 -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -fno-inline-functions-called-once -Wdeclaration-after-statement -Wno-pointer-sign -Wno-stringop-truncation -fno-strict-overflow -fno-merge-all-constants -fmerge-constants -fno-stack-check -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -fmacro-prefix-map=./= -Wno-packed-not-aligned -DMODULE -DKBUILD_BASENAME='"test_mod"' -DKBUILD_MODNAME='"test_mod"' -c -o /home/mrv/tmp/.tmp_test_mod.o /home/mrv/tmp/test_mod.c
In file included from ./include/linux/module.h:18,
from /home/mrv/tmp/test_mod.c:1:
./include/linux/moduleparam.h:22:1: error: expected ‘,’ or ‘;’ before ‘static’
static const char __UNIQUE_ID(name)[] \
^~~~~~
./include/linux/module.h:158:32: note: in expansion of macro ‘__MODULE_INFO’
#define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info)
^~~~~~~~~~~~~
./include/linux/module.h:196:34: note: in expansion of macro ‘MODULE_INFO’
#define MODULE_LICENSE(_license) MODULE_INFO(license, _license)
^~~~~~~~~~~
/home/mrv/tmp/test_mod.c:19:1: note: in expansion of macro ‘MODULE_LICENSE’
MODULE_LICENSE("GPL")
^~~~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:322: /home/mrv/tmp/test_mod.o] Error 1
make[1]: *** [Makefile:1571: _module_/home/mrv/tmp] Error 2
make[1]: Leaving directory '/usr/src/kernels/4.18.0-348.20.1.el8_5.x86_64'
make: *** [Makefile:6: all] Error 2
%
So, running 'make oldconfig && make prepare' in kernel sources directory /usr/src/kernels/4.18.0-348.20.1.el8_5.x86_64 results in failure to locate tools/build/Build.include.
Not sure if RedHat allows to build kernel modules in RHEL8 at all.
EDIT2
Simple kernel module:
#include <linux/module.h>
#include <linux/kernel.h>
static __init int test_init(void)
{
printk("Init module\n");
return 0;
}
static __exit void test_exit(void)
{
printk("Cleanup module\n");
}
module_init(test_init)
module_exit(test_exit)
MODULE_DESCRIPTION("Test module");
MODULE_LICENSE("GPL");
I'm trying to write a script that rebuild current installed version of nginx on my Ubuntu 18.04.
I don't understand why it fails when I add the configure command options :
#!/bin/bash
NGINX_VERSION=$(nginx -v 2>&1 | grep -o '[0-9.]*')
NGINX_BUILD_ARGS=$(nginx -V 2>&1 | grep -Po '(?<=configure arguments: )--.*$')
echo ${NGINX_BUILD_ARGS[#]}
# output:
# --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-FIJPpj/nginx-1.14.0=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_xslt_module=dynamic --with-stream=dynamic --with-stream_ssl_module --with-mail=dynamic --with-mail_ssl_module
wget https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz
tar -xvzf nginx-${NGINX_VERSION}.tar.gz
rm nginx-${NGINX_VERSION}.tar.gz
cd nginx-${NGINX_VERSION}
./configure ${NGINX_BUILD_ARGS}
# it fails with "invalid option -O2"
If I try to launch the command by myself in the folder :
./configure --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-FIJPpj/nginx-1.14.0=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_xslt_module=dynamic --with-stream=dynamic --with-stream_ssl_module --with-mail=dynamic --with-mail_ssl_module
I got a success...
Is there a way to use ${NGINX_BUILD_ARGS} as a list of arguments ?
Thanks !
EDIT
Tried with quotes :
./configure "${NGINX_BUILD_ARGS}"
But arguments seems to be bad parsed...
EDIT 2
It works with an eval :
eval "./configure ${NGINX_BUILD_ARGS}"
Isn't it unsafe ? No way to create an array from build args variable ?
I'm writing a kernel module that lists the network namespaces using the for_each_net and have written the following snippet which compiles fine:
rtnl_lock();
for_each_net(net)
printk("network ns: %p\n", net);
rtnl_unlock();
However when I try to insert the kernel module i get the following error:
insmod: ERROR: could not insert module kerNotification.ko: Unknown symbol in module
The dmesg gives the additional error information:
[3561461.418499] kerNotification: Unknown symbol net_namespace_list (err 0)
The kallsyms shows that it has the symbol of this kernel function:
[josh#dev kernel_prog(keystone_admin)]# cat /proc/kallsyms | grep net_namespace_list
ffffffff81a203e0 R __ksymtab_net_namespace_list
ffffffff81a32bc0 r __kcrctab_net_namespace_list
ffffffff81a55452 r __kstrtab_net_namespace_list
ffffffff81b6b000 D net_namespace_lis
The Module.symvers is included in the makefile as KBUILD_EXTRA_SYMBOLS. Here is the Makefile:
obj-m += kerNotification.o
SYMBOLA=/usr/src/kernels/4.4.57-1.el7.elrepo.x86_64/Module.symvers
KBUILD_EXTRA_SYMBOLS= $(SYMBOLA)
all:
make -C /lib/modules/$(shell uname -r)/build $(KBUILD_EXTRA_SYMBOLS) M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
Here is the complete logs when the make file is built with V=1:
make -C /lib/modules/4.4.57-1.el7.elrepo.x86_64/build /usr/src/kernels/4.4.57-1.el7.elrepo.x86_64/Module.symvers M=/home/cmmdocker/kernel_prog modules
make[1]: Entering directory `/usr/src/kernels/4.4.57-1.el7.elrepo.x86_64'
test -e include/generated/autoconf.h -a -e include/config/auto.conf || ( \
echo >&2; \
echo >&2 " ERROR: Kernel configuration is invalid."; \
echo >&2 " include/generated/autoconf.h or include/config/auto.conf are missing.";\
echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \
echo >&2 ; \
/bin/false)
make[1]: Nothing to be done for `/usr/src/kernels/4.4.57-1.el7.elrepo.x86_64/Module.symvers'.
mkdir -p /home/cmmdocker/kernel_prog/.tmp_versions ; rm -f /home/cmmdocker/kernel_prog/.tmp_versions/*
make -f ./scripts/Makefile.build obj=/home/cmmdocker/kernel_prog
rm -f /home/cmmdocker/kernel_prog/built-in.o; ar rcsD /home/cmmdocker/kernel_prog/built-in.o
gcc -Wp,-MD,/home/cmmdocker/kernel_prog/.kerNotification.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.8.5/include -I./arch/x86/include -Iarch/x86/include/generated/uapi -Iarch/x86/include/generated -Iinclude -I./arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I./include/uapi -Iinclude/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -fno-PIE -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_CRC32=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -Wno-maybe-uninitialized -O2 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector-strong -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-var-tracking-assignments -g -pg -mfentry -DCC_USING_FENTRY -fno-inline-functions-called-once -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -DCC_HAVE_ASM_GOTO -DMODULE -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(kerNotification)" -D"KBUILD_MODNAME=KBUILD_STR(kerNotification)" -c -o /home/cmmdocker/kernel_prog/.tmp_kerNotification.o /home/cmmdocker/kernel_prog/kerNotification.c
/home/cmmdocker/kernel_prog/kerNotification.c: In function ‘kerNotification_init’:
/home/cmmdocker/kernel_prog/kerNotification.c:37:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
struct net *net;
^
if [ "-pg" = "-pg" ]; then if [ /home/cmmdocker/kernel_prog/kerNotification.o != "scripts/mod/empty.o" ]; then ./scripts/recordmcount "/home/cmmdocker/kernel_prog/kerNotification.o"; fi; fi;
(cat /dev/null; echo kernel//home/cmmdocker/kernel_prog/kerNotification.ko;) > /home/cmmdocker/kernel_prog/modules.order
make -f ./scripts/Makefile.modpost
find /home/cmmdocker/kernel_prog/.tmp_versions -name '*.mod' | xargs -r grep -h '\.ko$' | sort -u | sed 's/\.ko$/.o/' | scripts/mod/modpost -m -a -i ./Module.symvers -I /home/cmmdocker/kernel_prog/Module.symvers -e /usr/src/kernels/4.4.57-1.el7.elrepo.x86_64/Module.symvers -o /home/cmmdocker/kernel_prog/Module.symvers -w -s -T -
gcc -Wp,-MD,/home/cmmdocker/kernel_prog/.kerNotification.mod.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.8.5/include -I./arch/x86/include -Iarch/x86/include/generated/uapi -Iarch/x86/include/generated -Iinclude -I./arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I./include/uapi -Iinclude/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -fno-PIE -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_CRC32=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -Wno-maybe-uninitialized -O2 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector-strong -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-var-tracking-assignments -g -pg -mfentry -DCC_USING_FENTRY -fno-inline-functions-called-once -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -DCC_HAVE_ASM_GOTO -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(kerNotification.mod)" -D"KBUILD_MODNAME=KBUILD_STR(kerNotification)" -DMODULE -c -o /home/cmmdocker/kernel_prog/kerNotification.mod.o /home/cmmdocker/kernel_prog/kerNotification.mod.c
ld -r -m elf_x86_64 -T ./scripts/module-common.lds --build-id -o /home/cmmdocker/kernel_prog/kerNotification.ko /home/cmmdocker/kernel_prog/kerNotification.o /home/cmmdocker/kernel_prog/kerNotification.mod.o
make[1]: Leaving directory `/usr/src/kernels/4.4.57-1.el7.elrepo.x86_64'
Any idea how to fix this?
Issue was missing license. Below was added to get the expected result:
MODULE_LICENSE("GPL");
Referred the following answer from another query on stackoverflow for this: unknown-symbol-class-create-err-0
insmod: ERROR: could not insert module kerNotification.ko: Unknown
symbol in module
You get the above error because the net_namespace_list is missing in the kernel. So you need to make sure to insert the module which it is defined. looking at the source code its declared in net_namespace.c and looking at the Makefile it will when CONFIG_NET is enabled. Also when you have built your kernel image the System.map file should tell you if its declared in the kernel image which you have built, something like below:
cat System.map | grep net_namespace_list
8041a888 r __ksymtab_net_namespace_list
8042b80c r __kstrtab_net_namespace_list
80464c08 D net_namespace_list
I have taken the code from the following source on Github and am trying to run it from Qt on RHEL Red Hat 4.4.7-17:
https://github.com/neveraway/oclJPEGDecoder
I extracted the project folder and ran qmake -projectin it. I opened the files in Qt creator and further modified my .pro file to link OpenCL sources and add the CXX and CFLAGS.
My .pro file looks like this:
######################################################################
# Automatically generated by qmake (1.07a) Tue Mar 28 14:51:49 2017
######################################################################
TEMPLATE = app
DEPENDPATH += src \
/usr/local/cuda-7.0/lib64/
INCLUDEPATH += . src \
/usr/local/cuda-7.0/lib64/\
/usr/local/cuda-7.0/include/
# Input
HEADERS += src/bitstream.h \
src/bmp.h \
src/decoder.h \
src/huffman.h \
src/idct.h \
src/jpeg.h \
src/macro.h \
src/stdafx.h \
src/targetver.h \
src/zigzag.h
SOURCES += src/bitstream.cpp \
src/cpuIDCT8x8.cpp \
src/decoder.cpp \
src/huffman.cpp \
src/main.cpp \
src/oclDCT8x8.cpp \
src/parser.cpp \
src/stdafx.cpp \
src/main.cpp
LIBS += -L/usr/local/cuda-7.0/lib64/ -lOpenCL
QMAKE_CXXFLAGS += -std=c++11
QMAKE_CFLAGS += -std=c99
DISTFILES += \
src/idct8x8.cl \
oclJPEGDecoder.sln \
oclJPEGDecoder.vcxproj \
oclJPEGDecoder.vcxproj.filters \
README.md \
test/JPEG_example_JPG_RIP_050.jpg
When I clicked on Run qmake and then Build All, this is what I saw under "Compile Output":
18:08:23: Configuration unchanged, skipping qmake step.
18:08:23: Starting: "/usr/bin/make"
Makefile:634: warning: overriding commands for target `main.o'
Makefile:603: warning: ignoring old commands for target `main.o'
g++ -c -pipe -std=c++11 -g -std=gnu++0x -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I../oclJPEGDecoder-master -I. -I../oclJPEGDecoder-master -I../oclJPEGDecoder-master/src -I/usr/local/cuda-7.0/lib64 -I/usr/local/cuda-7.0/include -I/opt/Qt5.6.2/5.6/gcc_64/include -I/opt/Qt5.6.2/5.6/gcc_64/include/QtGui -I/opt/Qt5.6.2/5.6/gcc_64/include/QtCore -I. -I/opt/Qt5.6.2/5.6/gcc_64/mkspecs/linux-g++ -o bitstream.o ../oclJPEGDecoder-master/src/bitstream.cpp
cc1plus: error: unrecognized command line option "-std=c++11"
make: *** [bitstream.o] Error 1
18:08:23: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project oclJPEGDecoder-master (kit: Desktop Qt 5.6.2 GCC 64bit)
When executing step "Make"
18:08:23: Elapsed time: 00:00.
My Makefile has the following contents:
#############################################################################
# Makefile for building: oclJPEGDecoder-master
# Generated by qmake (3.0) (Qt 5.6.2)
# Project: ../oclJPEGDecoder-master/oclJPEGDecoder-master.pro
# Template: app
# Command: /opt/Qt5.6.2/5.6/gcc_64/bin/qmake -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug -o Makefile ../oclJPEGDecoder-master/oclJPEGDecoder-master.pro
#############################################################################
MAKEFILE = Makefile
####### Compiler, tools and options
CC = gcc
CXX = g++
DEFINES = -DQT_QML_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB
CFLAGS = -pipe -g -Wall -W -D_REENTRANT -fPIC $(DEFINES)
CXXFLAGS = -pipe -std=c++11 -g -std=gnu++0x -Wall -W -D_REENTRANT -fPIC $(DEFINES)
INCPATH = -I../oclJPEGDecoder-master -I. -I../oclJPEGDecoder-master -I../oclJPEGDecoder-master/src -I/usr/local/cuda-7.0/lib64 -I/usr/local/cuda-7.0/include -I/opt/Qt5.6.2/5.6/gcc_64/include -I/opt/Qt5.6.2/5.6/gcc_64/include/QtGui -I/opt/Qt5.6.2/5.6/gcc_64/include/QtCore -I. -I/opt/Qt5.6.2/5.6/gcc_64/mkspecs/linux-g++
QMAKE = /opt/Qt5.6.2/5.6/gcc_64/bin/qmake
DEL_FILE = rm -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
COPY = cp -f
COPY_FILE = cp -f
COPY_DIR = cp -f -R
INSTALL_FILE = install -m 644 -p
INSTALL_PROGRAM = install -m 755 -p
INSTALL_DIR = cp -f -R
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
TAR = tar -cf
COMPRESS = gzip -9f
DISTNAME = oclJPEGDecoder-master1.0.0
DISTDIR = /root/Downloads/build-oclJPEGDecoder-master-Desktop_Qt_5_6_2_GCC_64bit-Debug/.tmp/oclJPEGDecoder-master1.0.0
LINK = g++
LFLAGS = -Wl,-rpath,/opt/Qt5.6.2/5.6/gcc_64/lib
LIBS = $(SUBLIBS) -L/usr/local/cuda-7.0/lib64/ -lOpenCL -L/opt/Qt5.6.2/5.6/gcc_64/lib -lQt5Gui -L/usr/lib64 -lQt5Core -lGL -lpthread
AR = ar cqs
RANLIB =
SED = sed
STRIP = strip
My .o files look like this:
####### Compile
bitstream.o: ../oclJPEGDecoder-master/src/bitstream.cpp ../oclJPEGDecoder-master/src/stdafx.h \
../oclJPEGDecoder-master/src/targetver.h \
../oclJPEGDecoder-master/src/macro.h \
../oclJPEGDecoder-master/src/bitstream.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o bitstream.o ../oclJPEGDecoder-master/src/bitstream.cpp
cpuIDCT8x8.o: ../oclJPEGDecoder-master/src/cpuIDCT8x8.cpp ../oclJPEGDecoder-master/src/stdafx.h \
../oclJPEGDecoder-master/src/targetver.h \
../oclJPEGDecoder-master/src/macro.h \
../oclJPEGDecoder-master/src/idct.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o cpuIDCT8x8.o ../oclJPEGDecoder-master/src/cpuIDCT8x8.cpp
decoder.o: ../oclJPEGDecoder-master/src/decoder.cpp ../oclJPEGDecoder-master/src/stdafx.h \
../oclJPEGDecoder-master/src/targetver.h \
../oclJPEGDecoder-master/src/macro.h \
../oclJPEGDecoder-master/src/jpeg.h \
../oclJPEGDecoder-master/src/bmp.h \
../oclJPEGDecoder-master/src/bitstream.h \
../oclJPEGDecoder-master/src/huffman.h \
../oclJPEGDecoder-master/src/zigzag.h \
../oclJPEGDecoder-master/src/idct.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o decoder.o ../oclJPEGDecoder-master/src/decoder.cpp
huffman.o: ../oclJPEGDecoder-master/src/huffman.cpp ../oclJPEGDecoder-master/src/stdafx.h \
../oclJPEGDecoder-master/src/targetver.h \
../oclJPEGDecoder-master/src/macro.h \
../oclJPEGDecoder-master/src/huffman.h \
../oclJPEGDecoder-master/src/bitstream.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o huffman.o ../oclJPEGDecoder-master/src/huffman.cpp
main.o: ../oclJPEGDecoder-master/src/main.cpp ../oclJPEGDecoder-master/src/stdafx.h \
../oclJPEGDecoder-master/src/targetver.h \
../oclJPEGDecoder-master/src/macro.h \
../oclJPEGDecoder-master/src/bitstream.h \
../oclJPEGDecoder-master/src/huffman.h \
../oclJPEGDecoder-master/src/idct.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o ../oclJPEGDecoder-master/src/main.cpp
oclDCT8x8.o: ../oclJPEGDecoder-master/src/oclDCT8x8.cpp ../oclJPEGDecoder-master/src/stdafx.h \
../oclJPEGDecoder-master/src/targetver.h \
/usr/local/cuda-7.0/include/CL/opencl.h \
/usr/local/cuda-7.0/include/CL/cl.h \
/usr/local/cuda-7.0/include/CL/cl_platform.h \
/usr/local/cuda-7.0/include/CL/cl_gl.h \
/usr/local/cuda-7.0/include/CL/cl_gl_ext.h \
/usr/local/cuda-7.0/include/CL/cl_ext.h \
../oclJPEGDecoder-master/src/macro.h \
../oclJPEGDecoder-master/src/idct.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o oclDCT8x8.o ../oclJPEGDecoder-master/src/oclDCT8x8.cpp
parser.o: ../oclJPEGDecoder-master/src/parser.cpp ../oclJPEGDecoder-master/src/stdafx.h \
../oclJPEGDecoder-master/src/targetver.h \
../oclJPEGDecoder-master/src/macro.h \
../oclJPEGDecoder-master/src/jpeg.h \
../oclJPEGDecoder-master/src/decoder.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o parser.o ../oclJPEGDecoder-master/src/parser.cpp
stdafx.o: ../oclJPEGDecoder-master/src/stdafx.cpp ../oclJPEGDecoder-master/src/stdafx.h \
../oclJPEGDecoder-master/src/targetver.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o stdafx.o ../oclJPEGDecoder-master/src/stdafx.cpp
main.o: ../oclJPEGDecoder-master/src/main.cpp ../oclJPEGDecoder-master/src/stdafx.h \
../oclJPEGDecoder-master/src/targetver.h \
../oclJPEGDecoder-master/src/macro.h \
../oclJPEGDecoder-master/src/bitstream.h \
../oclJPEGDecoder-master/src/huffman.h \
../oclJPEGDecoder-master/src/idct.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o ../oclJPEGDecoder-master/src/main.cpp
####### Install
install: FORCE
uninstall: FORCE
FORCE:
2nd ATTEMPT WITH -std=c++0x:
I changed the CXX_FLAGS command to QMAKE_CXXFLAGS += -std=c++0x and kept everything else unchanged in my .pro file.
When I clicked on Build All after making the change, this is the output I got under "Compile Output":
18:38:06: Running steps for project oclJPEGDecoder-master...
18:38:06: Configuration unchanged, skipping qmake step.
18:38:06: Starting: "/usr/bin/make"
Makefile:634: warning: overriding commands for target `main.o'
Makefile:603: warning: ignoring old commands for target `main.o'
g++ -c -pipe -std=c++0x -g -std=gnu++0x -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I../oclJPEGDecoder-master -I. -I../oclJPEGDecoder-master -I../oclJPEGDecoder-master/src -I/usr/local/cuda-7.0/lib64 -I/usr/local/cuda-7.0/include -I/opt/Qt5.6.2/5.6/gcc_64/include -I/opt/Qt5.6.2/5.6/gcc_64/include/QtGui -I/opt/Qt5.6.2/5.6/gcc_64/include/QtCore -I. -I/opt/Qt5.6.2/5.6/gcc_64/mkspecs/linux-g++ -o bitstream.o ../oclJPEGDecoder-master/src/bitstream.cpp
In file included from ../oclJPEGDecoder-master/src/bitstream.cpp:4:
../oclJPEGDecoder-master/src/bitstream.h:368: error: 'nullptr' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h:368: error: ISO C++ forbids initialization of member 'mBitReservoir'
../oclJPEGDecoder-master/src/bitstream.h:368: error: making 'mBitReservoir' static
../oclJPEGDecoder-master/src/bitstream.h:368: error: invalid in-class initialization of static data member of non-integral type 'uint8_t*'
../oclJPEGDecoder-master/src/bitstream.h:369: error: ISO C++ forbids initialization of member 'mCapacity'
../oclJPEGDecoder-master/src/bitstream.h:369: error: making 'mCapacity' static
../oclJPEGDecoder-master/src/bitstream.h:369: error: ISO C++ forbids in-class initialization of non-const static member 'mCapacity'
../oclJPEGDecoder-master/src/bitstream.h: In member function 'void BitStream::free()':
../oclJPEGDecoder-master/src/bitstream.h:96: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h:96: error: 'nullptr' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h:98: error: type '<type error>' argument given to 'delete', expected pointer
../oclJPEGDecoder-master/src/bitstream.h: In member function 'void BitStream::trim()':
../oclJPEGDecoder-master/src/bitstream.h:110: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h: In member function 'bool BitStream::reserve(size_t)':
../oclJPEGDecoder-master/src/bitstream.h:137: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h: In member function 'bool BitStream::frontBit() const':
../oclJPEGDecoder-master/src/bitstream.h:209: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h: In member function 'uint8_t BitStream::frontFullByte() const':
../oclJPEGDecoder-master/src/bitstream.h:214: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h: In member function 'uint32_t BitStream::front9b(uint8_t) const':
../oclJPEGDecoder-master/src/bitstream.h:219: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h: In member function 'uint32_t BitStream::front17b(uint8_t) const':
../oclJPEGDecoder-master/src/bitstream.h:227: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h: In member function 'uint32_t BitStream::front25b(uint8_t) const':
../oclJPEGDecoder-master/src/bitstream.h:235: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h: In member function 'void BitStream::writeBit(bool)':
../oclJPEGDecoder-master/src/bitstream.h:246: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h:248: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h: In member function 'const uint8_t* BitStream::frontData() const':
../oclJPEGDecoder-master/src/bitstream.h:307: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h: In member function 'uint32_t BitStream::cachedFrontBits(int)':
../oclJPEGDecoder-master/src/bitstream.h:340: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h: In member function 'void BitStream::moveDataTo(uint8_t*)':
../oclJPEGDecoder-master/src/bitstream.h:398: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.cpp: In member function 'size_t BitStream::append(const uint8_t*, size_t)':
../oclJPEGDecoder-master/src/bitstream.cpp:22: error: 'mBitReservoir' was not declared in this scope
make: *** [bitstream.o] Error 1
18:38:06: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project oclJPEGDecoder-master (kit: Desktop Qt 5.6.2 GCC 64bit)
When executing step "Make"
18:38:06: Elapsed time: 00:00.
I got errors in bitstream.c due to incompatibility with the compiler.
How can I get around this issue? Do I absolutely need to install a new version of g++ to get this code to work? Do I need to include anything in my Makefile?
Please guide me in this matter.
EDIT:
My output for g++ --version:
g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-17)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I typed yum install rpmdevtools rpm-build and it gave me the following response:
Loaded plugins: product-id, refresh-packagekit, search-disabled-repos, security,
: subscription-manager
Setting up Install Process
Package rpmdevtools-7.5-2.el6.noarch already installed and latest version
Package rpm-build-4.8.0-55.el6.x86_64 already installed and latest version
Nothing to do
I wanted to obtain more information about gcc on my system so I typed this command:
yum list available |grep gcc
It gave me this response:
compat-gcc-34.x86_64 3.4.6-19.el6 rhel-6-workstation-rpms
compat-gcc-34-c++.x86_64 3.4.6-19.el6 rhel-6-workstation-rpms
compat-gcc-34-g77.x86_64 3.4.6-19.el6 rhel-6-workstation-rpms
gcc-gnat.x86_64 4.4.7-18.el6 rhel-6-workstation-rpms
gcc-java.x86_64 4.4.7-18.el6 rhel-6-workstation-rpms
gcc-objc.x86_64 4.4.7-18.el6 rhel-6-workstation-rpms
gcc-objc++.x86_64 4.4.7-18.el6 rhel-6-workstation-rpms
Your 4.4.7 version of gcc is too old to fully enable C++11 features.
You need to upgrade the compiler to a version superior to 4.6 ( at least ) or if it's possible for you, upgrade your distro (let's say RHEL 7) which includes a more recent compiler.
I have just installed Qt Creator 3.2.2 on OSX 10.9.5, put line QMAKE_MAC_SDK = macosx10.9 into .pro file and changed the line QMAKE_MAC_SDK = macosx10.8 into QMAKE_MAC_SDK = macosx10.9 inside device.pri file. Now I'm trying to compile a very simple project. And it doesn't compile. It gives me the following output:
23:11:21: Starting: "/usr/bin/make" clean
rm -f main.o
rm -f *~ core *.core
23:11:21: The process "/usr/bin/make" exited normally.
23:11:21: Configuration unchanged, skipping qmake step.
23:11:21: Starting: "/usr/bin/make"
/Applications/Xcode 6.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -g -isysroot /Applications/Xcode 6.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mFile Doesn't Exist, Will Create: /Applications/Xcode Invalid Arguments -version-min=10.6 -Wall -W -fPIE -DQT_CORE_LIB -I/Applications/QT/5.3/clang_64/mkspecs/macx-clang -I../Test -I/Applications/QT/5.3/clang_64/lib/QtCore.framework/Versions/5/Headers -I. -I. -F/Applications/QT/5.3/clang_64/lib -o main.o ../Test/main.cpp
/bin/sh: -c: line 0: unexpected EOF while looking for matching `''
/bin/sh: -c: line 1: syntax error: unexpected end of file
make: *** [main.o] Error 2
23:11:22: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project Test (kit: Desktop Qt 5.3 clang 64bit)
When executing step "Make"
23:11:22: Elapsed time: 00:00.
What's wrong here? How do I fix it?
EDIT. A part of Makefile:
MAKEFILE = Makefile
####### Compiler, tools and options
CC = /Applications/Xcode 6.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
CXX = /Applications/Xcode 6.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
DEFINES = -DQT_CORE_LIB
CFLAGS = -pipe -g -isysroot /Applications/Xcode 6.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mFile Doesn't Exist, Will Create: /Applications/Xcode Invalid Arguments -version-min=10.6 -Wall -W -fPIE $(DEFINES)
CXXFLAGS = -pipe -g -isysroot /Applications/Xcode 6.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mFile Doesn't Exist, Will Create: /Applications/Xcode Invalid Arguments -version-min=10.6 -Wall -W -fPIE $(DEFINES)
INCPATH = -I/Applications/QT/5.3/clang_64/mkspecs/macx-clang -I../Test -I/Applications/QT/5.3/clang_64/lib/QtCore.framework/Versions/5/Headers -I. -I. -F/Applications/QT/5.3/clang_64/lib
LINK = /Applications/Xcode 6.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
LFLAGS = -headerpad_max_install_names -Wl,-syslibroot,/Applications/Xcode 6.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mFile Doesn't Exist, Will Create: /Applications/Xcode Invalid Arguments -version-min=10.6
LIBS = $(SUBLIBS) -F/Applications/QT/5.3/clang_64/lib -framework QtCore
AR = /Applications/Xcode 6.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar cq
RANLIB = /Applications/Xcode 6.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib -s
QMAKE = /Applications/QT/5.3/clang_64/bin/qmake
TAR = tar -cf
COMPRESS = gzip -9f
COPY = cp -f
SED = sed
COPY_FILE = cp -f
COPY_DIR = cp -f -R
STRIP =
INSTALL_FILE = $(COPY_FILE)
INSTALL_DIR = $(COPY_DIR)
INSTALL_PROGRAM = $(COPY_FILE)
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p