[okl4-developer] adding a new library in okl4 fails, build script ignores it

Gabi Voiculescu boy3dfx2 at yahoo.com
Thu Nov 6 03:47:17 EST 2008


Hello.

I'm trying to add libm support in okl4-2.1.0. The libm source was the newlib package.

My problem is that even if I have:
* libs/m's SConscript pointing correctly to sources and includes, 
* "m" added in  the iguana app's list of libraries, 
the libm.a is not to be found in the build folder and I don't see any error mesages in the build output regarding problems in creating libm.a. 

I have stated below the steps I took to add libm in okl4-2.1.0, so far.

Can you tell me why is my lib/m ignored by the build system?

Thank you,
Gabi Voiculescu

Following your suggestions I started with newlib's libm.

I have rearanged the files in the downloaded newlib/libm to have the following in OKL4 root directory:
newlib/libm/src/common/*.c   -> libs/m/src/common/*.c
newlib/libm/src/math/*.c        -> libs/m/src/math/*.c
newlib/libm/src/mathfp/*.c     -> libs/m/src/mathfp/*.c

newlib/libm/common/fdlibm.h -> libs/m/include/fdlibm.h

newlib/libm/mathfp/fdlibm.h   -> libs/m/include/zmath.h


I also added a libs/m/include/configure.h to define some of the macros I'm interested in having defined in libm (like __IEEE_LITTLE_ENDIAN, __STDC__, and others).


Then I created: 
libs/m/SConscript 
with the following output:

Import("env", "args", "conf")
import os


# Get SRC directory
src_root = Dir('#').srcnode().abspath

# Check architecture exists
arch = env.machine.arch
arch_path = os.path.join('arch', arch, args['package'])

# Use customer forked version of the arch package, if it exists
possible_arch_path = os.path.join("cust", args["cust"], "arch", arch, args["package"]) 
if os.path.exists(os.path.join(src_root, possible_arch_path)):
    arch_path = possible_arch_path

# I don't see why there is a need for arch specific since the goal is to use soft-float aka C sources -gabi
#
#if not os.path.exists(os.path.join(src_root, arch_path)):
#    print "architecture %s is not yet supported by libm." % (arch)

arch_path = "#" + arch_path

# Setup library

if args["system"] == "l4_rootserver" or args["system"] == "iguana_server":
    filesystem = args.get("filesystem", "null")
else:
    filesystem = args.get("filesystem", "static")


#arch paths first so architecture specific optimized functions can be provided
source = [
          "src/common/*.c" ,
          "src/math/*.c" ,
          "src/mathfp/*.c" ,
          "src/*.c"
         ]
public_headers = [
                  ("include/", "include/%(name)s/"),
                  ("include/",   "include/")                  
                 ]
#if env.test_libs:
#    if "m" in env.test_libs:
#        source.append("test/*.c")
#        public_headers.append(("test/", "include/%(name)s/"))

#if args["system"] == "l4_rootserver":
#    libs=["c", "l4", "iguana"]
#else:
    libs=["c", "l4", "iguana"]
lib = env.KengeLibrary("m", source=source, LIBS=libs,
                 public_headers=public_headers)
Return("lib")


and added in my example "m" in the libs line:

Import("*")
obj = env.KengeProgram("floatex2_example",
                       weaver = env.WeaverIguanaProgram(),
                       LIBS=["atomic_ops", "c", "range_fl", "circular_buffer", "iguana", "l4", "ll", "l4e", "mutex", "m"])


env.expect_test_data = [("Float Example with <fdlibm.h> extension works!", None)]

Return("obj")



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.okl4.org/pipermail/developer/attachments/20081105/f9f919ac/attachment.htm 


More information about the Developer mailing list