XlC flag qhalt issue - xlc

I'm using xlC 13.1.5 and CMake 3.5. When I try to compile an MPI package using CMake, I get the following error:
/opt/ibm/xlC/13.1.5/bin/.orig/xlc_r: warning: 1501-269 fpic is not supported on this Operating System platform. Option fpic will be ignored.
error: 1540-5203 Unrecognized value "e" specified with option "halt".
1 error generated.
I read it is a bug of this compiler version, that adding qhalt flag with "e" option is not supported. Is there a workaround to solve the problem? At the moment I can't change compiler version.

-qhalt=e is from an older compiler version, only -qhalt=w is supported on 13.1.5
When I try it I get a warning instead of an error
xlC -qhalt=w -c b1.cpp
xlC -qhalt=e -c b1.cpp
warning: 1540-5203 Unrecognized value "e" specified with option "halt".
1 warning generated.``
I'm assuming the option is in the makefile for your project which might be setup for the older xlC releases that accept the option. Can you update it in the makefile?
-qhalt=w just get's transformed to -Werror and sent to clang on 13.1.5

Related

How to fix meson generating an incorrect linker flag (--subsystem console)

I've created a simple project to get myself accustomed to meson, but the build keeps failing.
This is what I did (to set up the environment, and to build):
set CC=clang
set CC_LD=lld
set CFLAGS="--target x86_64-pc-windows-msvc"
meson build
cd build
ninja
My meson.build is as follows:
project('EtaClient', 'c')
src = ['src/main.c', 'src/linkedlist.c']
executable('EtaClient', src)
target = 'x86_64-pc-windows-msvc'
While building, I get the following errors (the obj files are built successfully, but they're not linked and thus the exe isn't built):
LINK : warning LNK4044: unrecognized option '/-subsystem'; ignored
LINK : fatal error LNK1181: cannot open input file 'console.obj'
clang: error: linker command failed with exit code 1181 (use -v to see invocation)
When I look in my build.ninja to see what's going on, I find:
build EtaClient.exe | EtaClient.pdb: c_LINKER EtaClient.exe.p/src_main.c.obj EtaClient.exe.p/src_linkedlist.c.obj
LINK_ARGS = "-Wl,/nologo" "-Wl,/release" "-Wl,/nologo" "-Wl,/DEBUG" "-Wl,/PDB:EtaClient.pdb" "-Wl,--subsystem,console" "-lkernel32" "-luser32" "-lgdi32" "-lwinspool" "-lshell32" "-lole32" "-loleaut32" "-luuid" "-lcomdlg32" "-ladvapi32"
I replace "-Wl,--subsystem,console" with "-Wl,/subsystem:console", and the build compiles successfully, but I have to manually make this edit each time I modify my meson.build.
Could someone tell me why this happens, and how to set up meson to generate the correct flag?
Thanks in advance.
use clang-cl instead of clang and leave out the defintion of the linker when you are on windows
set CC=clang-cl
set CFLAGS="--target x86_64-pc-windows-msvc"
meson build
cd build
ninja
see
https://github.com/mesonbuild/meson/issues/4232

Armadillo compiler error

I am using armadillo C++ library. I see below error when doing the compile. Does it require new version of GCC compiler I am having "gcc version 4.1.2" right now with my system
[ 50%] Building CXX object CMakeFiles/armadillo.dir/src/wrapper.cpp.o
In file included from /home/mukuar01/armadillo/armadillo-7.800.3/src/wrapper.cpp:29:
/home/mukuar01/armadillo/armadillo-7.800.3/tmp/include/armadillo_bits/compiler_setup.hpp:168:6: error: #error "*** Need a newer compiler ***"
make[2]: *** [CMakeFiles/armadillo.dir/src/wrapper.cpp.o] Error 1
make[1]: *** [CMakeFiles/armadillo.dir/all] Error 2
make: *** [all] Error 2
Yes, you do need a newer version of gcc. At least version 4.4.0 is required. You can check in the source code, line 167. Versions 4.7.0 and 4.7.1 are also not supported due to a bug.
You could try to use clang instead of gcc, but not sure which version is needed.
Or you could try with older versions of armadillo, but I am not sure how far you'd need to go back.

Clang - invalid type for value

I tried running clang -S -emit-llvm test.bc and I got this error: Invalid type for value. Does anyone know what does that mean? I get the same error when running llvm-dis.
This happens when the version of opt that was used to produce the bitcode is different from the clang that you are giving bitcode to.
Assert that version of clang >= version of opt.

Error compiling Mosquitto 1.4

I have tried to compile Mosquitto on both Arch and CentOS 7, but everytime I get the same error. I want to test the Websocket feature.
This is the procedure I am using for CentOS:
yum group install "Development Tools"
yum install cmake openssl-devel cmake
yum install uuid-devel libxslt docbook5-style-xsl.noarch docbook-style-xsl.noarch
git clone https://github.com/warmcat/libwebsockets.git
cd libwebsockets/
mkdir build;cd build
cmake ..
make
make install
git clone https://git.eclipse.org/r/mosquitto/org.eclipse.mosquitto
cd org.eclipse.mosquitto/
git checkout origin/1.4
vi config.mk
Change "WITH_WEBSOCKETS:=yes"
make
And this is where it dies on Arch and CentOS:
make[1]: Entering directory '/home/install/org.eclipse.mosquitto/src'
cc -Wall -ggdb -O2 -I. -I.. -I../lib -DVERSION="\"1.4\"" -DTIMESTAMP="\"2015-05-04 17:17:55+0200\"" -DWITH_BROKER -DWITH_TLS -DWITH_TLS_PSK -DWITH_UUID -DWITH_BRIDGE -DWITH_PERSISTENCE -DWITH_MEMORY_TRACKING -DWITH_SYS_TREE -DWITH_WEBSOCKETS -DWITH_EC -c mosquitto.c -o mosquitto.o
In file included from /usr/include/unistd.h:25:0,
from mosquitto.c:22:
/usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
# warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
mosquitto.c: In function ‘main’:
mosquitto.c:275:101: error: expected expression before ‘,’ token
_mosquitto_log_printf(NULL, MOSQ_LOG_INFO, "mosquitto version %s (build date %s) starting", VERSION, TIMESTAMP);
mosquitto.c:290:54: error: expected expression before ‘)’ token
snprintf(buf, 1024, "mosquitto version %s", VERSION);
mosquitto.c:368:88: error: expected expression before ‘)’ token
_mosquitto_log_printf(NULL, MOSQ_LOG_INFO, "mosquitto version %s terminating", VERSION);
Makefile:15: recipe for target 'mosquitto.o' failed
make[1]: *** [mosquitto.o] Error 1
make[1]: Leaving directory '/home/install/org.eclipse.mosquitto/src'
Makefile:21: recipe for target 'mosquitto' failed
make: *** [mosquitto] Error 2
If someone can please point out what I am doing wrong or missing ?
As #hardillb says, the VERSION defines are the problem. If I add the line
#define VERSION
to mosquitto.c, then I can reproduce the error that you see, but also get a warning about redefining VERSION.
If I remove the definition of VERSION from config.mk, then I get an error about VERSION not being defined.
These both make sense.
What seems to be happening for you is that the compiler is ignoring the command line definition -DVERSION="\"1.4.1\"" and replacing it with -DVERSION=, or isn't parsing the string properly. This doesn't make sense.
Other people have managed to compile on Arch, and the CentOS7 repository has a binary version - but without websockets.
After some investigation, it appears as though there is a bug in recent libwebsockets code. This changeset introduces some changes that mean that libwebsockets is claiming the macro VERSION all for itself, which isn't very polite for a library. If you use a released version of libwebsockets you should not have any problem compiling.
Just out of interest have you tried building from the TGZ src bundle for Mosquitto 1.4.1 available here:
http://mosquitto.org/download/
The errors look to be something to do with expanding the passed in VERSION and TIMESTAMP values. It builds fine [with the exception of the docs] on Fedora 20 which shouldn't be that far from RHEL 7.0 (and from there to Centos 7).

Error Cross Compiling: hidden symbol ... final link failed

I am getting the following error when compiling opencv with ffmpeg.
..../arm-none-linux-gnueabi/bin/ld: ../../bin/opencv_test_core: hidden symbol `__sync_val_compare_and_swap_4' in ..../arm-none-linux-gnueabi/bin/ld: final link failed: Nonrepresentable section on output
collect2: ld returned 1 exit status
I have no idea what this means. How do I fix this?
Edit:
I am cross compiling for ARM using codesourcery's arm-2009q3 compiler.
I using cmake and make to compile.
Please check all the libraries that you use and go through this stackoverflow thread as well.
To me, I got the below error when I migrated my product to new GCC version (3.3.3 to 4.5.4)
hidden symbol `__clz_tab' in /../lib/gcc/mipsel-unknown-linux-uclibc/4.5.4/libgcc.a(_clz.o) is referenced by DSO
Later I found that one of the library that I tried to link was built using GCC 3.3.3. After building the other library under GCC 4.5.4, the 'hidden symbol' error disappeared.

Resources