0

TARGET_LINKFLAGS values not being used when linking liballjoyn.so

asked 2015-01-14 08:57:49 -0700

LHayes gravatar image

updated 2015-01-14 09:19:17 -0700

Using alljoyn-14.12.00-src. Cross compiling for mips.

Can someone look at my scons command to see if I am using the TARGET parameters correctly. LINKFLAGS appears to be not getting used and I question what the STAGING_DIR is used for.

When I run the scons, it makes it to the linking of liballjoyn.so and fails because it cannot find the crytpo library. In the output of the link command I do not see the link flags that I specified in TARGET_LINKFLAGS parameter. I added prints to the SConstruct file and see the LIBPATH getting setup. BUT it does not get used.

If I run the link command by hand and add the link paths it works.

SCONS command:

export T_PATH=/opt/loadbuild/broadcom/latest/toolchain/bin/:/opt/loadbuild/broadcom/sde/bin:$PATH

scons V=1 BINDINGS=cpp WS=off BR=off ICE=off SERVICES="about,notification,controlpanel,config,onboarding"  OS=openwrt CPU=openwrt TARGET_PATH=$T_PATH TARGET_CC=mipsel-linux-uclibc-gcc TARGET_CFLAGS="-fPIC -g -Os" TARGET_CPPFLAGS="-I/opt/loadbuild/broadcom/latest/toolchain//mipsel-linux-uclibc/include -I/opt/loadbuild/lnks/continuous/RHC-MIPSR/local/mipsr/usr/include -I/opt/loadbuild/lnks/continuous/RHC-MIPSR/local/mipsr/usr/local/include" TARGET_CXX=mipsel-linux-uclibc-g++ TARGET_LINK=mipsel-linux-uclibc-g++ TARGET_LINKFLAGS="-L/opt/loadbuild/lnks/continuous/RHC-MIPSR/local/mipsr/usr/lib -L/opt/loadbuild/lnks/continuous/RHC-MIPSR/local/mipsr/usr/local/lib" TARGET_AR=mipsel-linux-ar TARGET_RANLIB=mipsel-linux-ranlib STAGING_DIR=/opt/loadbuild/lnks/continuous/RHC-MIPSR/local/mipsr

Added Prints to SConstruct under build_core/conf/openwrt

[TARGET_LINKFLAGS] = -L/opt/loadbuild/lnks/continuous/RHC-MIPSR/local/mipsr/usr/lib -L/opt/loadbuild/lnks/continuous/RHC-MIPSR/local/mipsr/usr/local/lib

flags has been set to
{'CPPFLAGS': [], 'FRAMEWORKPATH': [], 'LIBPATH': ['/opt/loadbuild/lnks/continuous/RHC-MIPSR/local/mipsr/usr/lib', '/opt/loadbuild/lnks/continuous/RHC-MIPSR/local/mipsr/usr/local/lib'], 'LIBS': [], 'ASFLAGS': [], 'LINKFLAGS': [], 'RPATH': [], 'CPPDEFINES': [], 'FRAMEWORKS': [], 'CCFLAGS': ['-fPIC', '-g', '-Os'], 'CFLAGS': [], 'CPPPATH': ['/opt/loadbuild/broadcom/latest/toolchain//mipsel-linux-uclibc/include', '/opt/loadbuild/lnks/continuous/RHC-MIPSR/local/mipsr/usr/include', '/opt/loadbuild/lnks/continuous/RHC-MIPSR/local/mipsr/usr/local/include']}

[ENV][LIBRARY_PATH] = /opt/loadbuild/lnks/continuous/RHC-MIPSR/local/mipsr/usr/lib:/opt/loadbuild/lnks/continuous/RHC-MIPSR/local/mipsr/usr/local/lib

LINK COMMAND that fails:

mipsel-linux-uclibc-g++ -o build/openwrt/openwrt/debug/obj/alljoyn_core/liballjoyn.so -shared build/openwrt/openwrt/debug/obj/common/ASN1.os build/openwrt/openwrt/debug/obj/common/BigNum.os build/openwrt/openwrt/debug/obj/common/BufferedSink.os build/openwrt/openwrt/debug/obj/common/BufferedSource.os build/openwrt/openwrt/debug/obj/common/CertificateECC.os build/openwrt/openwrt/debug/obj/common/CommonGlobals.os build/openwrt/openwrt/debug/obj/common/Config.os build/openwrt/openwrt/debug/obj/common/Crypto.os build/openwrt/openwrt/debug/obj/common/CryptoECC.os build/openwrt/openwrt/debug/obj/common/CryptoSRP.os build/openwrt/openwrt/debug/obj/common/Debug.os build/openwrt/openwrt/debug/obj/common/GUID.os build/openwrt/openwrt/debug/obj/common/IODispatch.os build/openwrt/openwrt/debug/obj/common/IPAddress.os build/openwrt/openwrt/debug/obj/common/KeyBlob.os build/openwrt/openwrt/debug/obj/common/Logger.os build/openwrt/openwrt/debug/obj/common/Pipe.os build/openwrt ...
(more)
edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2015-01-14 12:50:03 -0700

stevek gravatar image

LIBRARY_PATH is used by GCC to list the paths to search for libraries. The paths listed in this environment variable get searched before the paths built-in to GCC but after those listed on the command line with the "-L" option. This is quite handy for cross-compiling with GCC to specify where the "standard" libraries live and not have to worry about the order of "-L" options as would be the case if "standard" library paths were to be added to the command line.

I suspect the version of GCC you are using is old and does not support the LIBRARY_PATH environment variable. I recommend using GCC 4.6 or newer.

edit flag offensive delete publish link more

Comments

you might have a point, as we are using gcc version 4.5.3 (gcc version 4.5.3 (Broadcom stbgcc-4.5.3-2.4))

LHayes ( 2015-01-14 12:58:36 -0700 )edit
0

answered 2015-01-14 11:50:29 -0700

LHayes gravatar image

This is my solution as to why the TARGET_LINKFLAGS and the TARGET_CPPFLAGS are not getting used during a cross crompile using.

Source Tarball: alljoyn-14.12.00-src.tar.gz

File: build_core/conf/openwrt/SConscript

At line 47 the flags variable is setup to include TARGET CFLAGS, CPPFLAGS, and LINKFLAGS It then uses them to assign to the env[ENV][LIBRARY_PATH], but not sure what this does. Then is clears the at line 56 and 57. Then merges at line 60. But line 56, 57 just wiped out what you passed in.

Comment out or remove lines 56 and 57.

# Clear out the CPPPATH and LIBPATH values so that we can merge the rest of
# the flags with the SCons build environment.
#flags['CPPPATH'] = []
#flags['LIBPATH'] = []

Here is a patch.

--- alljoyn-14.12.00-src.orig/build_core/conf/openwrt/SConscript        2014-12-17 04:34:14.000000000 -0600
+++ alljoyn-14.12.00-src/build_core/conf/openwrt/SConscript     2015-01-14 13:38:05.370950000 -0600
@@ -53,8 +53,8 @@ env['ENV']['LIBRARY_PATH']=':'.join(flag

# Clear out the CPPPATH and LIBPATH values so that we can merge the rest of
# the flags with the SCons build environment.
-flags['CPPPATH'] = []
-flags['LIBPATH'] = []
+#flags['CPPPATH'] = []
+#flags['LIBPATH'] = []

 # Merge the rest of the compiler flags
 env.MergeFlags(flags)
edit flag offensive delete publish link more
Login/Signup to Answer

Question Tools

Follow
1 follower

Stats

Asked: 2015-01-14 08:57:49 -0700

Seen: 262 times

Last updated: Jan 14 '15