bugLiberty Eiffel - Bugs: bug #44601, install.sh does not run on MacOS...

 
 

bug #44601: install.sh does not run on MacOS X(because of -a option of cp)

Submitter:  KOIZUMI Satoru <koizumistr>
Submitted:  Sun 22 Mar 2015 02:14:06 PM UTC
   
 
Category:  None Severity:  4 - Important
Priority:  * 5 - Normal Status:  Fixed
Assigned to:  mnsanghvi Open/Closed:  Closed
Release:  None Fixed Release:  curtiss
Planned Release:  curtiss
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 26 Jun 2016 11:20:15 PM UTC, comment #11: 

Fix by commit: 720e7a6

OSX support is now available.  This makes use of native gcc that comes with OSX.  It does not make use clang or clang specific options.  clang support has not been added
as part of this bug fix.  Maybe for future enhancement ? :)


Mehul Sanghvi <mnsanghvi>
Group Member
Thu 16 Jun 2016 12:52:47 PM UTC, comment #10: 

I have been able to get install.sh to work on OSX El Capitan using the native gcc that comes with it.  I have attached the patches, which are created against hash 64cad75.

Can someone try them out and conform that it works on their OSX system ?

(file #37498, file #37499)

Mehul Sanghvi <mnsanghvi>
Group Member
Thu 09 Jun 2016 08:15:27 PM UTC, comment #9: 


> What about "sysctl -n hw.ncpu"?
> "sysctl -n machdep.cpu.core_count" does not work on my old Mac


We could use:

sysctl -n hw.physicalcpu


as that gives the same response as

sysctl -n machdep.cpu.core_count


(hopefully this comment comes through this time.)

Mehul Sanghvi <mnsanghvi>
Group Member
Thu 09 Jun 2016 08:12:29 PM UTC, comment #8: 


> What about "sysctl -n hw.ncpu"?
> "sysctl -n machdep.cpu.core_count" does not work on my old Mac


We could use +verbatim+ sysctl -n hw.physicalcpu -verbatim- as that gives the same
output as +verbatim+ sysctl -n machdep.cpu.core_count -verbatim-.


Mehul Sanghvi <mnsanghvi>
Group Member
Fri 25 Mar 2016 01:02:51 AM UTC, comment #7: 


> For OSX the equivalent is to use sysctl -n machdep.cpu.core_count to figure out how many cores we have.


What about "sysctl -n hw.ncpu"?
"sysctl -n machdep.cpu.core_count" does not work on my old Mac.

KOIZUMI Satoru <koizumistr>
Thu 24 Mar 2016 02:38:37 AM UTC, comment #6: 

The latest problem seems to be here in install.sh:


    progress 30 1 $MAXTOOLCOUNT "T1: compile_to_c"
    run ./compile_to_c -verbose -boost -no_gc compile_to_c -o compile_to_c.new || exit 1


compile_to_c.new is not created and the return code is 0 so it does not exit.

This is using the native OS X compiler in /usr/bin/gcc.  The OSX provided gcc does not support the -fno-gcse option.  The OSX linker does not support -no-as-needed option.  Based on my understanding of the option and its use, it does not seem like it is needed on OSX.  Maybe someone can confirm this ?

I have also used gcc5, 5.3.0 from MacPorts, and got the same results.

Mehul Sanghvi <mnsanghvi>
Group Member
Thu 24 Mar 2016 02:29:03 AM UTC, comment #5: 
  • /proc/cpuinfo was being used to set the ${jobs} variable in work/tools.sh.  For OSX the equivalent is to use sysctl -n machdep.cpu.core_count to figure out how many cores we have.
  • /proc/version was being used to set the ${flavor} variable.  This is not portable, and so has been replaced with the use of uname -s as a condition for a case statement.
  • awk related errors:  this was because of awk -vmax=$max  vs awk -v max=$max.  Notice the space after the -v which is the more portable method.


Mehul Sanghvi <mnsanghvi>
Group Member
Sat 20 Feb 2016 10:20:38 PM UTC, comment #4: 

your extract of the man page on MacOSX looks as it would support -a exactly similar as Linux.

I quickly checked about my comment from Dec - "-p" is not even necessary to keep the executable flag... I do not see why we need "-a" at all...

Raphael Mack <ramack>
Group administrator
Fri 19 Feb 2016 04:06:01 AM UTC, comment #3: 

I am documenting what I plan to do, in this bug so there is a trail of steps taken:

  • manually run cp -a on Linux and Mac OS X and compare results to see what it does
  • replace cp -l in install.sh with ln -s ?
  • see if environment variables can be set that will alter behaviour on Linux to make it POSIX compliant.  Can use POSIX-compliant cp command across the platforms.
  • figure out the issue with awk -v not working on Mac OS X
  • replace use of /proc/cpuinfo and /proc/version with something more appropriate and portable
  • check for any other Linux vs Mac OS X (and probably by extension *BSD)  issues.




Relevant section of Mac OS X man page for cp(1):


-a    Same as -pPR options. Preserves structure and attributes of files but not directory structure.

     -P    If the -R option is specified, no symbolic links are followed.  This is the default.

     -p    Cause cp to preserve the following attributes of each source file in the copy: modification time,
           access time, file flags, file mode, user ID, and group ID, as allowed by permissions.  Access
           Control Lists (ACLs) and Extended Attributes (EAs), including resource forks, will also be pre-
           served.

           If the user ID and group ID cannot be preserved, no error message is displayed and the exit value
           is not altered.

           If the source file has its set-user-ID bit on and the user ID cannot be preserved, the set-user-
           ID bit is not preserved in the copy's permissions.  If the source file has its set-group-ID bit
           on and the group ID cannot be preserved, the set-group-ID bit is not preserved in the copy's per-
           missions.  If the source file has both its set-user-ID and set-group-ID bits on, and either the
           user ID or group ID cannot be preserved, neither the set-user-ID nor set-group-ID bits are pre-
           served in the copy's permissions.

     -R    If source_file designates a directory, cp copies the directory and the entire subtree connected
           at that point.  If the source_file ends in a /, the contents of the directory are copied rather
           than the directory itself.  This option also causes symbolic links to be copied, rather than
           indirected through, and for cp to create special files rather than copying them as normal files.
           Created directories have the same mode as the corresponding source directory, unmodified by the
           process' umask.

           In -R mode, cp will continue copying even if errors are detected.

           Note that cp copies hard-linked files as separate files.  If you need to preserve hard links,
           consider using tar(1), cpio(1), or pax(1) instead.



Mehul Sanghvi <mnsanghvi>
Group Member
Wed 17 Feb 2016 01:22:50 AM UTC, comment #2: 

I see the following "Linuxisms" as well:

    grep: /proc/version: No such file or directory
    grep: /proc/cpuinfo: No such file or directory
    awk: invalid -v option

when I do "install.sh -bootstrap".   The awk error shows up a lot.

I will look into the errors I get and take it from there in applying a fix.

Mehul Sanghvi <mnsanghvi>
Group Member
Thu 17 Dec 2015 06:51:15 PM UTC, comment #1: 

Thanks for reporting.
What about options "-dpR"? - I think only th "-p" is really relevant to keep the executable mode flag. On the other side on my linux system this is also preserved if no arguemtn is given, so the question stays whether we could completely remove the "-a" even on non MacosX/BSD systems...

Cyril, what was the reason for "-a"?

Raphael Mack <ramack>
Group administrator
Sun 22 Mar 2015 02:14:06 PM UTC, original submission:  

cp of MaxOS X does not accept -a option.
Maybe this is true on BSD variants.

install.sh on old MacOS X has one more problem, but it might be useful for other BSD variants to solve this cp's option problem.
I attach a patch.

KOIZUMI Satoru <koizumistr>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #37498:  bug-44601-osx-support-in-installer.diff added by mnsanghvi (9KiB - application/octet-stream)
file #37499:  bug-44601-germ-c2c-make.diff added by mnsanghvi (5KiB - application/octet-stream)
file #33419:  cp.patch added by koizumistr (4KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mnsanghvi (Posted a comment)
  • -email is unavailable- added by ramack (Posted a comment)
  • -email is unavailable- added by koizumistr (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 12 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-06-26 mnsanghvi StatusIn Progress Fixed
        Open/ClosedOpen Closed
        Fixed ReleaseNone curtiss
    2016-06-16 mnsanghvi Attached File- Added bug-44601-osx-support-in-installer.diff, #37498
        Attached File- Added bug-44601-germ-c2c-make.diff, #37499
    2016-05-05 ramack Planned Releasebell curtiss
    2016-04-08 ramack Severity3 - Normal 4 - Important
    2016-03-24 mnsanghvi StatusNone In Progress
    2016-02-20 ramack Assigned tocadrian mnsanghvi
    2016-02-18 ramack Planned ReleaseNone bell
    2015-12-17 ramack Assigned toNone cadrian
    2015-03-22 koizumistr Attached File- Added cp.patch, #33419

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code