twelve17/openalpr-ios

build_frameworks fails

markjwill opened this issue · 8 comments

Marks-iMac:openalpr-ios markjwill$ bundle exec ./bin/build_frameworks.rb
options: {}
Downloading opencv2 library.
/Users/markjwill/Xcode Projects/openALPR/openalpr-ios/lib/alpr/utils.rb:44:in execute': Child returned: pid 5838 exit 6 (RuntimeError) from /Users/markjwill/Xcode Projects/openALPR/openalpr-ios/lib/alpr/utils.rb:74:in log_execute'
from /Users/markjwill/Xcode Projects/openALPR/openalpr-ios/lib/alpr/package/opencv.rb:89:in download' from /Users/markjwill/Xcode Projects/openALPR/openalpr-ios/lib/alpr/package/opencv.rb:46:in install'
from ./bin/build_frameworks.rb:67:in `

'

I didn't have ruby, gems or bundler when I started, so it feels like I've come a long way in the install instructions in the readme, but I'm not sure where to go here. I'm not familiar with ruby, but it seems easy enough to read, however best I can tell it's failing to write the log file? Not sure where that would be or how to proceed...

contents of work/build.log

Logfile created on 2016-02-16 18:41:10 -0600 by logger.rb/1.2.8# Logfile created on 2016-02-16 18:41:10 -0600 by logger.rb/1.2.8

Are there other log files somewhere I'm not seeing?

Marks-iMac:openalpr-ios markjwill$ bundle show
Gems included by the bundle:

  • bundler (1.11.2)
  • logger (1.2.8)
  • osx-plist (1.0.3)

Do you have curl installed?

Yes!

Marks-iMac:openalpr-ios markjwill$ curl --version
curl 7.43.0 (x86_64-apple-darwin15.0) libcurl/7.43.0 SecureTransport zlib/1.2.5
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz UnixSockets

TLDR - there was a space in the path to my xcode project, caused curl to think there were new arguments instead of the desired paths... Not sure if this is something you want to fix or warn about? Feel free to just close issue.

----- post as written before I solved it below

I've now added a version confirmation to my build_frame the correct ruby version is running the script ( there are multiple on my iMac at this point )

Marks-iMac:openalpr-ios markjwill$ ruby -v
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin15.0]
Marks-iMac:openalpr-ios markjwill$ /usr/bin/ruby -v
ruby 2.0.0p645 (2015-04-13 revision 50299) [universal.x86_64-darwin15]
Marks-iMac:openalpr-ios markjwill$ ./bin/build_frameworks.rb
ruby version: 2.1.2p95
options: {}
Downloading opencv2 library.
/Users/markjwill/Xcode Projects/openalpr/openalpr-ios/lib/alpr/utils.rb:44:in execute': Child returned: pid 70331 exit 6 (RuntimeError) from /Users/markjwill/Xcode Projects/openalpr/openalpr-ios/lib/alpr/utils.rb:74:in log_execute'
from /Users/markjwill/Xcode Projects/openalpr/openalpr-ios/lib/alpr/package/opencv.rb:89:in download' from /Users/markjwill/Xcode Projects/openalpr/openalpr-ios/lib/alpr/package/opencv.rb:46:in install'
from ./bin/build_frameworks.rb:47:in `

'

I've tried deleting and starting over, and tried switching to branch 2_0, with the same result.

Back on master branch... I've also followed pid's while executing and looks like you were correct in that curl is the pid that is referenced in the fail message.

Marks-iMac:openalpr-ios markjwill$ bundle exec ./bin/build_frameworks.rb
options: {}
Downloading opencv2 library.
/Users/markjwill/Xcode Projects/openalpr-ios/lib/alpr/utils.rb:44:in execute': Child returned: pid 70855 exit 6 (RuntimeError) from /Users/markjwill/Xcode Projects/openalpr-ios/lib/alpr/utils.rb:74:in log_execute'
from /Users/markjwill/Xcode Projects/openalpr-ios/lib/alpr/package/opencv.rb:89:in download' from /Users/markjwill/Xcode Projects/openalpr-ios/lib/alpr/package/opencv.rb:46:in install'
from ./bin/build_frameworks.rb:67:in `

'

from top:

markjwill 70855 0.0 0.0 2435436 1072 s002 S+ 7:45AM 0:00.00 sh -c curl -L -o 70855 s002 S+ 0:00.00 sh -c curl -L -o /Users/markjwill/Xcode Projects/openalpr-ios/work/opencv2.framework.zip http://sourceforge.net/projects/opencvlibrary/files/opencv-ios/3.0.0/opencv2.framework.zip/download# 2>&1 >> /Users/markjwill/Xcode Projects/openalpr-ios/work/build.log

If I try running the referenced command by itself I get:

Marks-iMac:Volumes markjwill$ sh -c curl -L -o /Users/markjwill/Xcode Projects/openalpr-ios/work/opencv2.framework.zip http://sourceforge.net/projects/opencvlibrary/files/opencv-ios/3.0.0/opencv2.framework.zip/download# 2>&1 >> /Users/markjwill/Xcode Projects/openalpr-ios/work/build.log
curl: try 'curl --help' or 'curl --manual' for more information

Tired the curl command without the sh -c and got an error message about argument "Projects" ... then I realized my folly.

Hey @markjwill -- thanks for the bug report, and sorry for the delay. I am going to change how the script executes system commands (using IO.popen) so I'm not building shell commands on my own. I've got one hurdle still, which is that the CFLAGS that the script pass on to tesseract are making the build fail. Did you run into this?

Unfortunately I don't really remember, though that sounds familiar... Looking through my terminal history I see that I ran brew install libtool just before successfully running bundle exec ./bin/build_frameworks.rb ... I remember a lot of fails, I don't remember details of why it failed or how I overcame them, but if you have other questions I'm happy to search histories or check statuses of my system if it helps.

Thanks @markjwill -- I too saw that I had to install libtool, so I'll update the README.

Aside from that, I can't figure out how you got tesseract to compile. The tesseract configure file (which seems to have been generated from configure.ac via autogen.sh) seems to fail in several places where it splits paths on space characters.

(I'm using a path with a space-- a directory called space dir to test this.)

For example, I see this when I run the configure script:

Checking whether to enable debugging... no
./configure: line 3592: test: /Users/foo/space: binary operator expected
./configure: line 3595: test: /Users/foo/space: binary operator expected
checking whether the C++ compiler works... no

That error originates from this part of Tesseract's configure.ac script:

if test -d $curwd/gnu/include ; then
   CPPFLAGS="$CPPFLAGS -I$curwd/gnu/include"
fi

Since the $curwd variable value (the current working directory) has a space in it, the test evaluation seeing more than one argument because the shell is splitting the directory with the space into two arguments. (This happens because the default "internal field separator) (IFS) value which is <space><tab><newline>.

Anyway, I'm hoping you can figure out what you did so I can implement it here. Thanks!

Did not hear back from OP. Closing.

In case anyone else runs into this, removing spaces in the path fixed this error for me.