brainpicture / hashlib

lib for node which makes hashes
nodejs.ru
165 stars 35 forks source link

Build issue with Node.js v0.1.27 #1

Closed theladyjaye closed 14 years ago

theladyjaye commented 14 years ago

Traceback (most recent call last): File "/usr/local/bin/node-waf", line 16, in Scripting.prepare(t, os.getcwd(), VERSION, wafdir) File "/usr/local/bin/../lib/node/wafadmin/Scripting.py", line 145, in prepare prepare_impl(t, cwd, ver, wafdir) File "/usr/local/bin/../lib/node/wafadmin/Scripting.py", line 135, in prepare_impl main() File "/usr/local/bin/../lib/node/wafadmin/Scripting.py", line 188, in main fun(ctx) File "/usr/local/bin/../lib/node/wafadmin/Scripting.py", line 385, in build return build_impl(bld) File "/usr/local/bin/../lib/node/wafadmin/Scripting.py", line 404, in build_impl bld.compile() File "/usr/local/bin/../lib/node/wafadmin/Build.py", line 251, in compile self.flush() File "/usr/local/bin/../lib/node/wafadmin/Build.py", line 688, in flush tg.post() File "/usr/local/bin/../lib/node/wafadmin/TaskGen.py", line 219, in post self.apply() File "/usr/local/bin/../lib/node/wafadmin/TaskGen.py", line 206, in apply v() File "/usr/local/bin/../lib/node/wafadmin/Tools/osx.py", line 140, in apply_link_osx path = os.path.join(Utils.subst_vars(self.install_path, self.env), name) File "/usr/local/bin/../lib/node/wafadmin/Utils.py", line 457, in subst_vars return reg_subst.sub(repl_var, expr) TypeError: expected string or buffer

brainpicture commented 14 years ago

It's very strange error, probably I haven't get one.. It works fine with 0.1.27, may be you have broken waf version, what OS do you have

theladyjaye commented 14 years ago

OS X 10.6.2 Tried with python 2.6.4 and 2.6.1

Configure is successful, build just fails

None is passed in as the arg to the function, which is why it fails, just trying to figure out what def subst_vars() (line 445 of wafadmin/Utils.py) is trying to do and why it gets None passed to it.

brainpicture commented 14 years ago

Please try to put this in ./wscript, configure and build: srcdir = "." blddir = "build" VERSION = "0.0.1"

def set_options(opt):
  opt.tool_options("compiler_cxx")
    opt.tool_options("compiler_cc")

def configure(conf):
  conf.check_tool("compiler_cxx")
  opt.tool_options("compiler_cc")
  conf.check_tool("node_addon")

def build(bld):
  libhash = bld.new_task_gen("cc", "shlib")
  libhash.source = """
    libhash/md4c.c
    libhash/md5c.c
    libhash/sha0c.c"""
  libhash.includes = "libhash/"
  libhash.name = "libhash"
  libhash.target = "libhash"

  obj = bld.new_task_gen("cxx", "shlib", "node_addon")
  obj.target = "hashlib"
  obj.source = "hashlib.cc"
  obj.includes = "libhash"
  obj.add_objects = "libhash"
theladyjaye commented 14 years ago

That did the trick.

Based on the original wscript, and the diff with what you suggested, I commented out the following:

In def configure(conf): (Line 14) conf.env.append_value('CCFLAGS', ['-fstack-protector', '-O', '-g', '-march=native'])

In def build(bld): (Line 25) libhash.install_path = None

brainpicture commented 14 years ago

hmm.. libhash.install_path = None is unnesussary in my opinion, but (Line 14) conf.env.append_value('CCFLAGS', ['-fstack-protector', '-O', '-g', '-march=native']) makes some optimisation, which makes library faster, I'll try to find out..

Try please build only with out: (Line 14) conf.env.append_value('CCFLAGS', ['-fstack-protector', '-O', '-g', '-march=native']) makes some optimisation, which makes library faster, I'll try to find out..

theladyjaye commented 14 years ago

if I leave this enabled: conf.env.append_value('CCFLAGS', ['-fstack-protector', '-O', '-g', '-march=native'])

I get this error: Waf: Entering directory /Users/dev/hashlib/build' [1/6] cc: libhash/md4c.c -> build/default/libhash/md4c_1.o ../libhash/md4c.c:1: error: bad value (native) for -march= switch ../libhash/md4c.c:1: error: bad value (native) for -mtune= switch [2/6] cc: libhash/md5c.c -> build/default/libhash/md5c_1.o ../libhash/md5c.c:1: error: bad value (native) for -march= switch ../libhash/md5c.c:1: error: bad value (native) for -mtune= switch Waf: Leaving directory/Users/dev/hashlib/build' Build failed -> task failed (err #1): {task: cc md5c.c -> md5c_1.o} -> task failed (err #1): {task: cc md4c.c -> md4c_1.o}

brainpicture commented 14 years ago

Dont find any decision in the internet, please try conf.env.append_value('CCFLAGS', ['-O3']) instead of conf.env.append_value('CCFLAGS', ['-fstack-protector', '-O', '-g', '-march=native']) It should optimize good too..

brainpicture commented 14 years ago

Please, write if this solve the issue

theladyjaye commented 14 years ago

Adding your suggestion gives me a successful build: conf.env.append_value('CCFLAGS', ['-O3'])

brainpicture commented 14 years ago

Thats fine, closing issue..