问:
Building OpenDDS with bitbake
I need to build OpenDDS-3.13.1 with bitbake for my Yocto project. Target is for now only QEMU.

However, I downloaded the sources (they configure, compile and link on the host system quite well) and linked them into my recipe.
Inheriting "autoconf" causes an error in the configuration step, it can somehow not expand the default arguments (which is already odd).

After some searching I found a pretty old discussion about this topic: https://lists.yoctoproject.org/pipermail/yocto/2011-July/002126.html

My recipe currently looks as follows:

```<code>FILESEXTRAPATHS_prepend := "[PATH_TO_SOURCE]:"

PV = "3.13.1"

SRC_URI = "file://${PN}-${PV}.tar.gz"

S = "${WORKDIR}/${PN}-${PV}"
B = "${S}"

do_configure() {
    ./configure
}

do_compile() {
    make
}
</code>```

At the moment the configuration step runs successfully, but compiling fails as it cannot find header files. As mentioned in the mailing list post above, I tried to add the CXXFLAGS to the configuration step. This will step over the first missing include ("features") but stops at the next one ("sting"). Both headers are available in ${S} and ${B} respectivly, therefor are also part of ${STAGING_DIR_HOST}.

What am I missing here? I actually expected all step are implicitly covered by inheriting autotools.

Edit:

as requested here is the log output:

```<code>DEBUG: Executing shell function do_compile
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/ace'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/ace/GNUmakefile.ACE MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/ace'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/ACEXML/common'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/ACEXML/common/GNUmakefile.ACEXML MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/ACEXML/common'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/ACEXML/parser/parser'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/ACEXML/parser/parser/GNUmakefile.ACEXML_Parser MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/ACEXML/parser/parser'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_FE MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_BE MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_BE_VIS_A MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_BE_VIS_C MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_BE_VIS_E MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_BE_VIS_I MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_BE_VIS_O MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_BE_VIS_S MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_BE_VIS_U MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_BE_VIS_V MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/apps/gperf/src'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/apps/gperf/src/GNUmakefile.gperf MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/apps/gperf/src'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_EXE MAKEFLAGS=w

x86_64-poky-linux-g++  -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/recipe-sysroot -fvisibility=hidden -fvisibility-inlines-hidden -Wnon-virtual-dtor -ggdb -pthread -fno-strict-aliasing -Wall -W -Wpointer-arith -pipe  -D_GNU_SOURCE   -I/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers -D__ACE_INLINE__ -I../.. -I../TAO_IDL/fe -I../TAO_IDL/include -I.. -Iinclude -Ibe_include -Ife -I.. -DTAO_IDL_PREPROCESSOR=\"x86_64-poky-linux-g++ -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/recipe-sysroot\"  -c -o .obj/driver/drv_args.o driver/drv_args.cpp
<command-line>:0:22: warning: missing terminating " character
driver/drv_args.cpp:69:10: fatal error: string: No such file or directory
 #include <string>
          ^~~~~~~~
compilation terminated.
/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/include/makeinclude/rules.local.GNU:134: recipe for target '.obj/driver/drv_args.o' failed
make[1]: *** [.obj/driver/drv_args.o] Error 1
make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
GNUmakefile.dist:568: recipe for target 'TAO_IDL_EXE' failed
make: *** [TAO_IDL_EXE] Error 2
WARNING: exit code 2 from a shell command.
ERROR: Function failed: do_compile (log file is located at /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/temp/log.do_compile.15963)
</code>```

答:
For openDDS the usual cross-compiling approach does not work out of the box. Here you need to run the compile process on and within your host machines context and reference your cross compiler which will than be used by the build system of openDDS.

Here is how to get it run:

The configure script from the openDDS sources does not accept additional arguments to the cross-compilers which are needed by bitbake. Therefore I wrapped them into scripts which replace the final calls to the CC, CXX, LD and AR:

Create a new task after do_unpack doing the following

extract the binary names from the variables (CC, CXX and AR) and create a local script with the same name

insert shebang into the just created wrapper script

append the whole value of the variable (here $CC) into the wrapper script

make wrapper executable

```<code>cc_wrapper=`echo ${CC} | cut -f 1 -d\  `
echo '#!/bin/sh' > ${S}/${cc_wrapper}
echo "${CC} \"\$@\"" >> ${S}/${cc_wrapper}
chmod +x ${S}/${cc_wrapper}
</code>```

do the same for CXX and AR

Override the configure step

extract the full path to the target cross compiler

```<code>target_compiler="${S}/`echo ${CXX} | cut -f 1 -d\  `"
</code>```

and replace CC variable which points to the bitbake cross-compiler with the host native ones:

```<code>export CC=$BUILD_CC
</code>```

do the same for CXX and AR too

do the final call to the configure script with the expected cross compile options

```<code>./configure --target=linux-cross --target-compiler=$target_compiler
</code>```

(Note the reference to $target_compiler set above)

Override the compile step

export again CC, CXX, AR and in addition LD to point to the hosts native instances

```<code>export CC=$BUILD_CC
</code>```

finally just call make within the compile step, that should make it happen!

Title: Building OpenDDS with bitbake

Body:
I need to build OpenDDS-3.13.1 with bitbake for my Yocto project. Target is for now only QEMU.

However, I downloaded the sources (they configure, compile and link on the host system quite well) and linked them into my recipe.
Inheriting "autoconf" causes an error in the configuration step, it can somehow not expand the default arguments (which is already odd).

After some searching I found a pretty old discussion about this topic: https://lists.yoctoproject.org/pipermail/yocto/2011-July/002126.html

My recipe currently looks as follows:

FILESEXTRAPATHS_prepend := "[PATH_TO_SOURCE]:"

PV = "3.13.1"

SRC_URI = "file://${PN}-${PV}.tar.gz"

S = "${WORKDIR}/${PN}-${PV}"
B = "${S}"

do_configure() {
    ./configure
}

do_compile() {
    make
}

At the moment the configuration step runs successfully, but compiling fails as it cannot find header files. As mentioned in the mailing list post above, I tried to add the CXXFLAGS to the configuration step. This will step over the first missing include ("features") but stops at the next one ("sting"). Both headers are available in ${S} and ${B} respectivly, therefor are also part of ${STAGING_DIR_HOST}.

What am I missing here? I actually expected all step are implicitly covered by inheriting autotools.

Edit:

as requested here is the log output:

DEBUG: Executing shell function do_compile
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/ace'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/ace/GNUmakefile.ACE MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/ace'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/ACEXML/common'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/ACEXML/common/GNUmakefile.ACEXML MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/ACEXML/common'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/ACEXML/parser/parser'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/ACEXML/parser/parser/GNUmakefile.ACEXML_Parser MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/ACEXML/parser/parser'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_FE MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_BE MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_BE_VIS_A MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_BE_VIS_C MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_BE_VIS_E MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_BE_VIS_I MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_BE_VIS_O MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_BE_VIS_S MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_BE_VIS_U MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_BE_VIS_V MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/apps/gperf/src'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/apps/gperf/src/GNUmakefile.gperf MAKEFLAGS=w

make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/apps/gperf/src'
make[1]: Entering directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'

GNUmakefile: /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL/GNUmakefile.TAO_IDL_EXE MAKEFLAGS=w

x86_64-poky-linux-g++  -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/recipe-sysroot -fvisibility=hidden -fvisibility-inlines-hidden -Wnon-virtual-dtor -ggdb -pthread -fno-strict-aliasing -Wall -W -Wpointer-arith -pipe  -D_GNU_SOURCE   -I/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers -D__ACE_INLINE__ -I../.. -I../TAO_IDL/fe -I../TAO_IDL/include -I.. -Iinclude -Ibe_include -Ife -I.. -DTAO_IDL_PREPROCESSOR=\"x86_64-poky-linux-g++ -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse --sysroot=/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/recipe-sysroot\"  -c -o .obj/driver/drv_args.o driver/drv_args.cpp
<command-line>:0:22: warning: missing terminating " character
driver/drv_args.cpp:69:10: fatal error: string: No such file or directory
 #include <string>
          ^~~~~~~~
compilation terminated.
/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/include/makeinclude/rules.local.GNU:134: recipe for target '.obj/driver/drv_args.o' failed
make[1]: *** [.obj/driver/drv_args.o] Error 1
make[1]: Leaving directory '/media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/OpenDDS-3.13.1/ACE_wrappers/TAO/TAO_IDL'
GNUmakefile.dist:568: recipe for target 'TAO_IDL_EXE' failed
make: *** [TAO_IDL_EXE] Error 2
WARNING: exit code 2 from a shell command.
ERROR: Function failed: do_compile (log file is located at /media/work/10_Projects/Yocto/blub/build/tmp/work/core2-64-poky-linux/OpenDDS/3.13.1-r0/temp/log.do_compile.15963)

Body:
For openDDS the usual cross-compiling approach does not work out of the box. Here you need to run the compile process on and within your host machines context and reference your cross compiler which will than be used by the build system of openDDS.

Here is how to get it run:

The configure script from the openDDS sources does not accept additional arguments to the cross-compilers which are needed by bitbake. Therefore I wrapped them into scripts which replace the final calls to the CC, CXX, LD and AR:

Create a new task after do_unpack doing the following

extract the binary names from the variables (CC, CXX and AR) and create a local script with the same name

insert shebang into the just created wrapper script

append the whole value of the variable (here $CC) into the wrapper script

make wrapper executable

cc_wrapper=`echo ${CC} | cut -f 1 -d\  `
echo '#!/bin/sh' > ${S}/${cc_wrapper}
echo "${CC} \"\$@\"" >> ${S}/${cc_wrapper}
chmod +x ${S}/${cc_wrapper}

do the same for CXX and AR

Override the configure step

extract the full path to the target cross compiler

target_compiler="${S}/`echo ${CXX} | cut -f 1 -d\  `"

and replace CC variable which points to the bitbake cross-compiler with the host native ones:

export CC=$BUILD_CC

do the same for CXX and AR too

do the final call to the configure script with the expected cross compile options

./configure --target=linux-cross --target-compiler=$target_compiler

(Note the reference to $target_compiler set above)

Override the compile step

export again CC, CXX, AR and in addition LD to point to the hosts native instances

export CC=$BUILD_CC

finally just call make within the compile step, that should make it happen!


来源: stackexchange

问:
Strange visual studio 2008 behavior when pressing keys
Every once in a while I'll do something that causes strang behavior when pressing certain keys.

1)The single quote key (') will not type a character unless I press it twice, in which case it will print two backwards single quote characters (``).

2)The ` (backwards single quote?) key types a # character.

3)The angle bracket keys (< and >) type a single quote (') and a period (.).

4)Shift + any A-Z character types the character and brings the code completion window up.

I'm sure there's other symptomps, and they only want I've found to stop it is to restart Visual studio.  This behavior does not appear in any other apps.  Anybody experience this?

答:
I started getting this on my computer (not in Visual Studio, but everywhere else).  I had default input language set to "English(New Zealand) - United States-International", whatever that is supposed to mean.  Changed it to English-US.  Disabled the "Language Bar"

"Control Panel >> Regional Settings >> Languages, click on Advanced, look at Installed Services.  See if you have multiple choices - if you have an "International" option, remove it and I believe the problem will go away.  It did for me.

AFAIK, this happened when I installed XP-SP3.

OwnerDisplayName: Jeremy

ContentLicense: CC BY-SA 2.5

LastEditorDisplayName: John Sheehan

OwnerDisplayName: MikeW


问:
LINQ side effects
is it possible to substitute a foreach loop with a lambda expression in LINQ (.Select))?

```<code>List<int> l = {1, 2, 3, 4, 5};
foreach (int i in l)
    Console.WriteLine(i);
</code>```

To:

```<code>List<int> l = {1, 2, 3, 4, 5};
l.Select(/* print to console */);
</code>```

答: List.ForEach uses action delegate. Henceforth that will the right choice.</p>

ContentLicense: CC BY-SA 3.0

Title: LINQ side effects

Body:
is it possible to substitute a foreach loop with a lambda expression in LINQ (.Select))?

List<int> l = {1, 2, 3, 4, 5};
foreach (int i in l)
    Console.WriteLine(i);

To:

List<int> l = {1, 2, 3, 4, 5};
l.Select(/* print to console */);


问:
I need help to modify a very basic loop to use indexes instead of variable names
new to programming. I have an issue where I need to modify a loop that searches a list in order to use indexes and start at index 1.

```<code># find the coldest day in a range of daily temps
## input: 7 days worth of temps
temps = [7, 4, 1, -9, 18, 32, 10]

## output: lowest temp among the list
coolest = temps[0]

for temperature in temps:
    if temperature < coolest:
        coolest = temperature
print (coolest)
</code>```

I want to change this so that we start at index 1, since using the current implementation causes a redundant step on the first iteration.

Many thanks, Michael

答:
Instead of manual iterating through the list, you can use built-in function min and string slicing:

```<code>temps = [7, 4, 1, -9, 18, 32, 10]
print(min(temps[1:]))
</code>```

-9

ContentLicense: CC BY-SA 4.0

Body:
new to programming. I have an issue where I need to modify a loop that searches a list in order to use indexes and start at index 1.

# find the coldest day in a range of daily temps
## input: 7 days worth of temps
temps = [7, 4, 1, -9, 18, 32, 10]

## output: lowest temp among the list
coolest = temps[0]

for temperature in temps:
    if temperature < coolest:
        coolest = temperature
print (coolest)

I want to change this so that we start at index 1, since using the current implementation causes a redundant step on the first iteration.

Many thanks, Michael

Body:
Instead of manual iterating through the list, you can use built-in function min and string slicing:

temps = [7, 4, 1, -9, 18, 32, 10]
print(min(temps[1:]))

-9


问:
Styling browser-native video controls
Is it possible to cross-browser style the controls of a browser-native video such as video from HTML5's video tag?

I do not understand if it is possible or not, I can't find anything other than this article but it seem uses Javascript.

I would like to make the controls bar fit the video width; as you can see from the image attached, the controls bar excedes the video width.

HTML for the above image

```<code> <div class="video centered-content">
    <a class="circle-canvas close-video" href="javascript:void(0)" id="video-close" rel="tooltipTOP" data-original-title="close">X</a>
        <video width="63%" height="60%" id="video" class="video" controls>
            <source src="<?php echo base_static_url();?>media/video.mp4">
            <source src="<?php echo base_static_url();?>media/video.ogv">
            <source src="<?php echo base_static_url();?>media/video.webm">
        </video>
    </a>
</div>
</code>```

答:
You could style the shadow DOM, but you need to look at every browser individually and a browser update could destroy your styling.

I recommend taking a look at MediaElement.js which gives you cross-browser controls that can be styled using CSS and are already accessibility-optimized.

Or if you only need a few controls anyway, build your own: https://developer.mozilla.org/en-US/docs/Web/Guide/Audio_and_video_delivery/Video_player_styling_basics

Title: Styling browser-native video controls

Body:
Is it possible to cross-browser style the controls of a browser-native video such as video from HTML5's video tag?

I do not understand if it is possible or not, I can't find anything other than this article but it seem uses Javascript.

I would like to make the controls bar fit the video width; as you can see from the image attached, the controls bar excedes the video width.

HTML for the above image

    X
        <video width="63%" height="60%" id="video" class="video" controls>
            <source src="<?php echo base_static_url();?>media/video.mp4">
            <source src="<?php echo base_static_url();?>media/video.ogv">
            <source src="<?php echo base_static_url();?>media/video.webm">
        </video>


问:
Python Jupyter notebook how to display matrix in vertical
When I try to index array, I use this code for printing column part with Numpy or Pytorch.

```<code>import numpy as np
a = np.random.randn(5,3)
a[:,1]
</code>```

or

```<code>import torch
a = torch.Tensor(5,3)
a[:,1]
</code>```

The output is displayed like this.

```<code>array([-0.07478094, -1.87787326,  0.50407517,  1.13335836,  0.23140931])
</code>```

But I want to display output as column.(because i indexed column)

```<code>array([-0.07478094,
       -1.87787326,
        0.50407517,
        1.13335836,
        0.23140931])
</code>```

Furthermore, When I make tensor with torch.ones(5), the result is

```<code>tensor([1., 1., 1., 1., 1.])
</code>```

but I want to see the type of output on the buttom like this

tensor([1., 1., 1., 1., 1.])
[torch.FloatTensor of size 5]

The reason why i want to display this is that i can't distinguish tensor and numpy

Can anyone tell me how to do this? Thanks.

答:
try this:

```<code>np.vstack(a)
</code>```

Hope this helps..

Body:
When I try to index array, I use this code for printing column part with Numpy or Pytorch.

import numpy as np
a = np.random.randn(5,3)
a[:,1]

or

import torch
a = torch.Tensor(5,3)
a[:,1]

The output is displayed like this.

array([-0.07478094, -1.87787326,  0.50407517,  1.13335836,  0.23140931])

But I want to display output as column.(because i indexed column)

array([-0.07478094,
       -1.87787326,
        0.50407517,
        1.13335836,
        0.23140931])

Furthermore, When I make tensor with torch.ones(5), the result is

tensor([1., 1., 1., 1., 1.])

but I want to see the type of output on the buttom like this

tensor([1., 1., 1., 1., 1.])
[torch.FloatTensor of size 5]

The reason why i want to display this is that i can't distinguish tensor and numpy

Can anyone tell me how to do this? Thanks.

Body:
try this:

np.vstack(a)

Hope this helps..


答:
You can use slicing here.</p>

```<code>for temperature in temps[1:]:
    if temperature < coolest:
        coolest = temperature
</code>```

Title: I need help to modify a very basic loop to use indexes instead of variable names

Body:
You can use slicing here.

for temperature in temps[1:]:
    if temperature < coolest:
        coolest = temperature


问:
Can i change the text "view project" on button with javascript or jquery?
I would like to change the text "view project" of button at this page:
https://new.emanuelemarazzi.com/pacchetti-creativi/

If you see the code there is a span under a class.

I tried to use jQuery with this code:

```<code>$('.button-style5 span').text('Text changed');
</code>```

答:
This is working  :

$('.button-style5 span').text('Text changed1');```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<style>
.button-style5 {
    text-decoration: none;
    color: inherit;
    font-size: 12px;
    background: 0 0;
    padding: 7px 15px;
    line-height: 19px;
    border: 0;
    display: inline-block;
    position: relative;
    vertical-align: middle;
    cursor: pointer;
    text-align: center;
    text-transform: lowercase;
    font-weight: 300;
    border: 1px solid;
    border-radius: 15px;
    opacity: .8;
}
</style>

<div style="color:blue;" class="button-style5"><span >abc view project</span><i class="material-design-icon-keyboard-right-arrow-button"></i></div></code>```

Body:
I would like to change the text "view project" of button at this page:
https://new.emanuelemarazzi.com/pacchetti-creativi/

If you see the code there is a span under a class.

I tried to use jQuery with this code:

$('.button-style5 span').text('Text changed');

Body:
This is working  :

$('.button-style5 span').text('Text changed1');

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<style>
.button-style5 {
    text-decoration: none;
    color: inherit;
    font-size: 12px;
    background: 0 0;
    padding: 7px 15px;
    line-height: 19px;
    border: 0;
    display: inline-block;
    position: relative;
    vertical-align: middle;
    cursor: pointer;
    text-align: center;
    text-transform: lowercase;
    font-weight: 300;
    border: 1px solid;
    border-radius: 15px;
    opacity: .8;
}
</style>

<div style="color:blue;" class="button-style5"><span >abc view project</span><i class="material-design-icon-keyboard-right-arrow-button"></i></div>


问:
How to make MacOS recognize previously installed packages because `/usr/local/lib` and `/usr/local/include` are deleted?
I was trying to uninstall my node.js due to some issues while I was very tired.  The next thing I knew...I accidentally deleted 2 folders, /usr/local/lib and /usr/local/include, in my Mac Mojave!

I reinstalled the OS.  To my surprise, all my personal files stayed and so do the files installed by homebrew and npm.  What I noticed is that the npm packages installed previously are available, but I need to re-link them following the commands suggested by the intermianl.  So far so good.

However, it might not be the case for mongodb.  When I ran mongo I got the error: -bash: mongod: command not found. My Question: How do I make my system recognize mongo?

Here is the reproduction of the steps:

```<code>$ brew install mongodb-community@4.0
Warning: mongodb/brew/mongodb-community 4.0.9 is already installed and up-to-date
To reinstall 4.0.9, run `brew reinstall mongodb-community`

$ brew services start mongodb-community@4.0
Service `mongodb-community` already started, use `brew services restart mongodb-community` to restart.

$ brew services restart mongodb-community@4.0
Stopping `mongodb-community`... (might take a while)
==> Successfully stopped `mongodb-community` (label: homebrew.mxcl.mongodb-community)
==> Successfully started `mongodb-community` (label: homebrew.mxcl.mongodb-community)

$ mongo
-bash: mongo: command not found
</code>```

答:
I've accidentally deleted /usr/local things in the past.  To get the brew stuff back in I used brew reinstall $(brew list)

Note: python@3: I had to brew remove --force --ignore-dependencies python@3 before issuing the reinstallation command due to a permissions clash.

Body:
I was trying to uninstall my node.js due to some issues while I was very tired.  The next thing I knew...I accidentally deleted 2 folders, /usr/local/lib and /usr/local/include, in my Mac Mojave!

I reinstalled the OS.  To my surprise, all my personal files stayed and so do the files installed by homebrew and npm.  What I noticed is that the npm packages installed previously are available, but I need to re-link them following the commands suggested by the intermianl.  So far so good.

However, it might not be the case for mongodb.  When I ran mongo I got the error: -bash: mongod: command not found. My Question: How do I make my system recognize mongo?

Here is the reproduction of the steps:

$ brew install mongodb-community@4.0
Warning: mongodb/brew/mongodb-community 4.0.9 is already installed and up-to-date
To reinstall 4.0.9, run `brew reinstall mongodb-community`

$ brew services start mongodb-community@4.0
Service `mongodb-community` already started, use `brew services restart mongodb-community` to restart.

$ brew services restart mongodb-community@4.0
Stopping `mongodb-community`... (might take a while)
==> Successfully stopped `mongodb-community` (label: homebrew.mxcl.mongodb-community)
==> Successfully started `mongodb-community` (label: homebrew.mxcl.mongodb-community)

$ mongo
-bash: mongo: command not found


问:
Casting string to uint16
I'm new at go and I've been trying to cast the string "0x0000" into a hexadecimal with no luck so far. Here's what I tried:

```<code>import "strconv"

c, err := strconv.ParseUint("0x0000", 16, 32)
if err != nil {
    return err, nil
}
</code>```

which throws the error: strconv.ParseUint: parsing "0x0000": invalid syntax.

I've also tried uint16("0x0000") but apparently I also can't convert a string directly to uint16. I'm sure it's very trivial, so any help would be appreciated. Thanks.

答:
The behavior of strconv.ParseUint() is detailed at strconv.ParseInt():

If base == 0, the base is implied by the string's prefix: base 16 for "0x", base 8 for "0", and base 10 otherwise. For bases 1, below 0 or above 36 an error is returned.

So simply use base = 0, and then the 0x prefix will be interpreted properly.

For example:

```<code>c, err := strconv.ParseUint("0x0000", 0, 16)
fmt.Println(c, err)

c, err = strconv.ParseUint("0x0100", 0, 16)
fmt.Println(c, err)
</code>```

Output (try it on the Go Playground):

```<code>0 <nil>
256 <nil>
</code>```

Another option is to use fmt.Sscanf():

```<code>var c uint16
_, err := fmt.Sscanf("0x0000", "0x%04x", &c)
fmt.Println(c, err)

_, err = fmt.Sscanf("0x0100", "0x%04x", &c)
fmt.Println(c, err)
</code>```

Output is the same. Try it on the Go Playground.

Also see related question: Convert string to integer type in Go?

Title: Casting string to uint16

Body:
I'm new at go and I've been trying to cast the string "0x0000" into a hexadecimal with no luck so far. Here's what I tried:

import "strconv"

c, err := strconv.ParseUint("0x0000", 16, 32)
if err != nil {
    return err, nil
}

which throws the error: strconv.ParseUint: parsing "0x0000": invalid syntax.

I've also tried uint16("0x0000") but apparently I also can't convert a string directly to uint16. I'm sure it's very trivial, so any help would be appreciated. Thanks.

Body:
The behavior of strconv.ParseUint() is detailed at strconv.ParseInt():

If base == 0, the base is implied by the string's prefix: base 16 for "0x", base 8 for "0", and base 10 otherwise. For bases 1, below 0 or above 36 an error is returned.

So simply use base = 0, and then the 0x prefix will be interpreted properly.

For example:

c, err := strconv.ParseUint("0x0000", 0, 16)
fmt.Println(c, err)

c, err = strconv.ParseUint("0x0100", 0, 16)
fmt.Println(c, err)

Output (try it on the Go Playground):

0 <nil>
256 <nil>

Another option is to use fmt.Sscanf():

var c uint16
_, err := fmt.Sscanf("0x0000", "0x%04x", &c)
fmt.Println(c, err)

_, err = fmt.Sscanf("0x0100", "0x%04x", &c)
fmt.Println(c, err)

Output is the same. Try it on the Go Playground.

Also see related question: Convert string to integer type in Go?


问:
How to fix "Could not initialize class org.apache.ignite.IgniteJdbcThinDriver" error in Apache Ignite?

The Problem

I'm trying to connect to a Apache Ignite server with Apache Ignite built-in tool, SQLLine. I get the error: java.lang.NoClassDefFoundError: Could not initialize class org.apache.ignite.IgniteJdbcThinDriver

Background

I have Apache Ignite running in a container and CentOS7 running in another container. Both containers running in the same network (pinging works both ways). The tried connection is happening from CentOS7 to Apache Ignite.

Apache Ignite seems to be running fine with just the default configuration. In the CentOS7 container, I have installed Oracle JDK 12.0.1 and I have Apache Ignite 2.7.0 binary files in a folder. I have also set the IGNITE_HOME environmental variable.

Here, (https://apacheignite-sql.readme.io/docs/sqlline), it says I can connect to my cluster with just: ./sqlline.sh --verbose=true -u jdbc:ignite:thin://127.0.0.1/. However, this throws the previously mentioned error.

SQLLine should come with Ignite JDBC drivers. I have tried downloading them manually (https://apacheignite-sql.readme.io/docs/jdbc-driver#section-multiple-endpoints). When I downloaded the driver, which is said to be the ignite-core-{version}.jar, I put it in the same folder as sqlline.jar files.

Output

```<code>[root@bc72c4fbf47e bin]# ./sqlline.sh
sqlline version 1.3.0
sqlline> !connect jdbc:ignite:thin://172.19.0.2/
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.ignite.internal.util.GridUnsafe$2 (file:/var/tmp/apache-ignite/libs/ignite-core-2.7.0.jar) to field java.nio.Buffer.address
WARNING: Please consider reporting this to the maintainers of org.apache.ignite.internal.util.GridUnsafe$2
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
java.lang.NoClassDefFoundError: Could not initialize class org.apache.ignite.IgniteJdbcThinDriver
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:415)
    at java.sql/java.sql.DriverManager.isDriverAllowed(DriverManager.java:555)
    at java.sql/java.sql.DriverManager.isDriverAllowed(DriverManager.java:547)
    at java.sql/java.sql.DriverManager.getDrivers(DriverManager.java:449)
    at java.sql/java.sql.DriverManager.getDrivers(DriverManager.java:426)
    at sqlline.SqlLine.findRegisteredDriver(SqlLine.java:1568)
    at sqlline.SqlLine.scanForDriver(SqlLine.java:1542)
    at sqlline.Commands.connect(Commands.java:1074)
    at sqlline.Commands.connect(Commands.java:1001)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:567)
    at sqlline.ReflectiveCommandHandler.execute(ReflectiveCommandHandler.java:38)
    at sqlline.SqlLine.dispatch(SqlLine.java:791)
    at sqlline.SqlLine.begin(SqlLine.java:668)
    at sqlline.SqlLine.start(SqlLine.java:373)
    at sqlline.SqlLine.main(SqlLine.java:265)
</code>```

Conclusion

I should be able to connect to my Ignite server with !connect jdbc:ignite:thin://172.19.0.2/ command in sqlline.
This does not work, and throws Could not initialize class org.apache.ignite.IgniteJdbcThinDriver
IgniteJDBCThinDriver is installed/available.

答: It is recommended to Java 8, as Apache Ignite 2.7.0 does not have full Java 12 support. Otherwise you can try tinkering with JVM options.</p>

Body:
The Problem

I'm trying to connect to a Apache Ignite server with Apache Ignite built-in tool, SQLLine. I get the error: java.lang.NoClassDefFoundError: Could not initialize class org.apache.ignite.IgniteJdbcThinDriver

Background

I have Apache Ignite running in a container and CentOS7 running in another container. Both containers running in the same network (pinging works both ways). The tried connection is happening from CentOS7 to Apache Ignite.

Apache Ignite seems to be running fine with just the default configuration. In the CentOS7 container, I have installed Oracle JDK 12.0.1 and I have Apache Ignite 2.7.0 binary files in a folder. I have also set the IGNITE_HOME environmental variable.

Here, (https://apacheignite-sql.readme.io/docs/sqlline), it says I can connect to my cluster with just: ./sqlline.sh --verbose=true -u jdbc:ignite:thin://127.0.0.1/. However, this throws the previously mentioned error.

SQLLine should come with Ignite JDBC drivers. I have tried downloading them manually (https://apacheignite-sql.readme.io/docs/jdbc-driver#section-multiple-endpoints). When I downloaded the driver, which is said to be the ignite-core-{version}.jar, I put it in the same folder as sqlline.jar files.

Output

[root@bc72c4fbf47e bin]# ./sqlline.sh
sqlline version 1.3.0
sqlline> !connect jdbc:ignite:thin://172.19.0.2/
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.ignite.internal.util.GridUnsafe$2 (file:/var/tmp/apache-ignite/libs/ignite-core-2.7.0.jar) to field java.nio.Buffer.address
WARNING: Please consider reporting this to the maintainers of org.apache.ignite.internal.util.GridUnsafe$2
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
java.lang.NoClassDefFoundError: Could not initialize class org.apache.ignite.IgniteJdbcThinDriver
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:415)
    at java.sql/java.sql.DriverManager.isDriverAllowed(DriverManager.java:555)
    at java.sql/java.sql.DriverManager.isDriverAllowed(DriverManager.java:547)
    at java.sql/java.sql.DriverManager.getDrivers(DriverManager.java:449)
    at java.sql/java.sql.DriverManager.getDrivers(DriverManager.java:426)
    at sqlline.SqlLine.findRegisteredDriver(SqlLine.java:1568)
    at sqlline.SqlLine.scanForDriver(SqlLine.java:1542)
    at sqlline.Commands.connect(Commands.java:1074)
    at sqlline.Commands.connect(Commands.java:1001)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:567)
    at sqlline.ReflectiveCommandHandler.execute(ReflectiveCommandHandler.java:38)
    at sqlline.SqlLine.dispatch(SqlLine.java:791)
    at sqlline.SqlLine.begin(SqlLine.java:668)
    at sqlline.SqlLine.start(SqlLine.java:373)
    at sqlline.SqlLine.main(SqlLine.java:265)

Conclusion

I should be able to connect to my Ignite server with !connect jdbc:ignite:thin://172.19.0.2/ command in sqlline.
This does not work, and throws Could not initialize class org.apache.ignite.IgniteJdbcThinDriver
IgniteJDBCThinDriver is installed/available.


问:
How do I multiply a (2,4)-matrix with a (4,1)-matrix?
I'm trying to multiply two matrices, but the (4,1) matrix is read by python as a (4,1,1). How do I ensure that python reads my matrices correctly and are able to multiply them? I want to be able to get numbers from a list, put them in a matrix and multiply it with another one.

This if for a part of an assignment. I've tried numpys .dot and .matmul functions, but neither work. And I don't think I'm missing any brackets. Even if I replace list-indexes with the actual number, it won't work.

def Md(a,b,c,d,e,f):
    Md = np.array([[a,b,0,0],[c,d,e,f]])
    return Md

pl = [np.array([[2],[3]])]
u = np.array([[pl[0][0]],[pl[0][1]],[pl[0][0]**2],[pl[0][1]**2]])
print(np.matmul(Md(1,-1,1,0,0.5,0.5),u))
```

I expect the output of this multiplication to be [[-1],[8.5]], but instead i get this error message:

ValueError: shapes (2,4) and (4,1,1) not aligned: 4 (dim 1) != 1 (dim 1)

Body:
I'm trying to multiply two matrices, but the (4,1) matrix is read by python as a (4,1,1). How do I ensure that python reads my matrices correctly and are able to multiply them? I want to be able to get numbers from a list, put them in a matrix and multiply it with another one.

This if for a part of an assignment. I've tried numpys .dot and .matmul functions, but neither work. And I don't think I'm missing any brackets. Even if I replace list-indexes with the actual number, it won't work.

def Md(a,b,c,d,e,f):
    Md = np.array([[a,b,0,0],[c,d,e,f]])
    return Md

pl = [np.array([[2],[3]])]
u = np.array([[pl[0][0]],[pl[0][1]],[pl[0][0]**2],[pl[0][1]**2]])
print(np.matmul(Md(1,-1,1,0,0.5,0.5),u))

I expect the output of this multiplication to be [[-1],[8.5]], but instead i get this error message:

ValueError: shapes (2,4) and (4,1,1) not aligned: 4 (dim 1) != 1 (dim 1)

Body: u = np.array([[pl[0][0]],[pl[0][1]],[pl[0][0]**2],[pl[0][1]**2]]).reshape(4,1)


问:
MATLAB - AppDesigner: Interrupt a loop with GUI
I have created a GUI which computes a trajectory based on an external .m file.

When the user press the 'Calculate' button, the external .m function file gets called via the callback function of the button:

```<code>% calculateBtn button pushed function
function calculate(app)
    numSteps = app.stepSlider.Value;

    app.omega = app.omegaSpin.Value;
    app.phid = app.phi.Value;

    app.x0 = app.x0Spin.Value;
    app.y0 = app.y0Spin.Value;

    app.u0 = app.u0Spin.Value;
    app.v0 = app.v0Spin.Value;

    set(app.calculateBtn, 'Enable', 'off')
    set(app.showBtn, 'Enable', 'off')

    [app.Xc, app.Xi, app.C, T, f]=coriolis_traj(app.x0, app.y0, app.u0, app.v0, app.phid, numSteps);

    app.fEdit.Value = num2str(f);
    app.tEdit.Value = num2str(T);

    set(app.calculateBtn, 'Enable', 'on')

    if length(app.Xc)>1
        set(app.showBtn, 'Enable', 'on')
    else
        set(app.showBtn, 'Enable', 'off')
    end
end
</code>```

The external file consists of the main loop of the computations.

```<code>    while 1
    % Counters
    i = i + 1;
    t = t + Dt;
    theta = theta + Omega * Dt;

    % Parcel's position
    % on the inertial frame
    x1 = x0 + Dt*u0;
    y1 = y0 + Dt*v0;

    % Parcel's position translated to the
    % rotating frame
    xc1 = x1*cos(theta)+y1*sin(theta);
    yc1 = x1*sin(theta)+y1*cos(theta);

    x(i) = x1 ; y(i) = y1;
    xc(i) = xc1 ; yc(i) = yc1;

    x0 = x1 ; y0 = y1;

    [in] = inpolygon(xc,yc,xv,yv);
    if ~in(i) > 0
        break;
    end
end
</code>```

I want to stop the computation and clear the computed arrays when the user changes any of the values in 'Controls' panel, or when the button 'Break' is pushed.

How could I code this?

答:
There is no way in MATLAB to interrupt a function by another function, e.g. say programmatically injecting a CTRL-C into another running function, without modifying the to-be-interrupted function.

The closest you can get is by modifying the simulator code to regularly perform a callback. This is how I integrated by simulation code into a GUI. IMO it is a clean solution and also works with MEX files.

Think of it as a progress callback for your simulator code.

It could be regularly (e.g. every second, or at completion of the i-th step) called by the simulator with some percentage parameter to indicate the degree of completion.

If you modify the simulator code to stop simulating in case the callback returns false, you achieve what you want. At the same time this is minimum invasive in your simulator code. Supply a dummy callback and it will run stand alone.

GUI pseudocode:

```<code>function button_cancel_Callback(hObject, eventdata, handles)
global cancel_pressed;
cancel_pressed = true;

function dostop = callback( progress, handles )
<show progress>( handles.<XXX>, progress );
global cancel_pressed;
if cancel_pressed
   dostop = true;
else
   dostop = false;
end

function button_run_simulation_Callback(hObject, eventdata, handles)
global cancel_pressed;
cancel_pressed = false;

<simulator function>( ..., @callback, handles )
</code>```

SIMULATOR pseudocode:

```<code>function <simulator function>( ..., callback, callback_param )
while ...  % main loop
  if ~isempty(callback) && ~callback( progress, callback_param )
      error("canceled-by-user") % could also be something more elaborate
end
return "simulation completed"
</code>```

Body:
I have created a GUI which computes a trajectory based on an external .m file.

When the user press the 'Calculate' button, the external .m function file gets called via the callback function of the button:

% calculateBtn button pushed function
function calculate(app)
    numSteps = app.stepSlider.Value;

    app.omega = app.omegaSpin.Value;
    app.phid = app.phi.Value;

    app.x0 = app.x0Spin.Value;
    app.y0 = app.y0Spin.Value;

    app.u0 = app.u0Spin.Value;
    app.v0 = app.v0Spin.Value;

    set(app.calculateBtn, 'Enable', 'off')
    set(app.showBtn, 'Enable', 'off')

    [app.Xc, app.Xi, app.C, T, f]=coriolis_traj(app.x0, app.y0, app.u0, app.v0, app.phid, numSteps);

    app.fEdit.Value = num2str(f);
    app.tEdit.Value = num2str(T);

    set(app.calculateBtn, 'Enable', 'on')

    if length(app.Xc)>1
        set(app.showBtn, 'Enable', 'on')
    else
        set(app.showBtn, 'Enable', 'off')
    end
end

The external file consists of the main loop of the computations.

    while 1
    % Counters
    i = i + 1;
    t = t + Dt;
    theta = theta + Omega * Dt;

    % Parcel's position
    % on the inertial frame
    x1 = x0 + Dt*u0;
    y1 = y0 + Dt*v0;

    % Parcel's position translated to the
    % rotating frame
    xc1 = x1*cos(theta)+y1*sin(theta);
    yc1 = x1*sin(theta)+y1*cos(theta);

    x(i) = x1 ; y(i) = y1;
    xc(i) = xc1 ; yc(i) = yc1;

    x0 = x1 ; y0 = y1;

    [in] = inpolygon(xc,yc,xv,yv);
    if ~in(i) > 0
        break;
    end
end

I want to stop the computation and clear the computed arrays when the user changes any of the values in 'Controls' panel, or when the button 'Break' is pushed.

How could I code this?

Body:
There is no way in MATLAB to interrupt a function by another function, e.g. say programmatically injecting a CTRL-C into another running function, without modifying the to-be-interrupted function.

The closest you can get is by modifying the simulator code to regularly perform a callback. This is how I integrated by simulation code into a GUI. IMO it is a clean solution and also works with MEX files.

Think of it as a progress callback for your simulator code.

It could be regularly (e.g. every second, or at completion of the i-th step) called by the simulator with some percentage parameter to indicate the degree of completion.

If you modify the simulator code to stop simulating in case the callback returns false, you achieve what you want. At the same time this is minimum invasive in your simulator code. Supply a dummy callback and it will run stand alone.

GUI pseudocode:

function button_cancel_Callback(hObject, eventdata, handles)
global cancel_pressed;
cancel_pressed = true;

function dostop = callback( progress, handles )
<show progress>( handles.<XXX>, progress );
global cancel_pressed;
if cancel_pressed
   dostop = true;
else
   dostop = false;
end

function button_run_simulation_Callback(hObject, eventdata, handles)
global cancel_pressed;
cancel_pressed = false;

<simulator function>( ..., @callback, handles )

SIMULATOR pseudocode:

function <simulator function>( ..., callback, callback_param )
while ...  % main loop
  if ~isempty(callback) && ~callback( progress, callback_param )
      error("canceled-by-user") % could also be something more elaborate
end
return "simulation completed"