Opened 6 years ago

Closed 5 years ago

Last modified 4 years ago

#56463 closed defect (fixed)

htop: compiler on older systems

Reported by: iefdev (Eric F) Owned by: neverpanic (Clemens Lang)
Priority: Normal Milestone:
Component: ports Version: 2.4.4
Keywords: lion legacy-os Cc:
Port: htop

Description

When installing htop on older systems (like my Lion), the bundled compiler creates a version where no processes are shown in the window. The bundled version of gcc is 4.2. If I test to build it manually using a newer version of gcc it works fine (I tested with gcc5 and gcc7), and when using the bundled version to mimic MP - it fails.

To reproduce:

# cd cloned repo or src dir from gh-tarball
autogen.sh
./configure CC=/usr/bin/gcc    # to mimic mp
make
./htop                         # nope

make clean
./configure CC=gcc             # /opt/local/bin/gcc-mp-{5,7}
make
./htop                         # yes

I guess the Portfile needs another compiler version to use instead of ther bundled one, but I don't know what min version it would need. I just tried with the 2 I have installed.

Perhaps more systems are affected?

Change History (10)

comment:1 Changed 6 years ago by raimue (Rainer Müller)

Cc: neverpanic removed
Keywords: lion legacy-os added; Lion removed
Owner: set to neverpanic
Status: newassigned

comment:2 Changed 6 years ago by ryandesign (Ryan Carsten Schmidt)

MacPorts does not use gcc as the default compiler on Lion. /usr/bin/gcc is not gcc on Lion and later. For Xcode 4.0.x–4.2.2 MacPorts uses llvm-gcc, while for Xcode 4.3 and newer we use clang.

We don't generally want to build ports with FSF GCC. If any compiler is unsatisfactory for whatever reason, the port should blacklist it and let MacPorts choose the next best compiler, which, if all Xcode compilers are unsatisfactory, will be a newer version of clang provided by MacPorts.

comment:3 Changed 6 years ago by neverpanic (Clemens Lang)

I don't have a Lion system to test on, so if somebody can figure out what the correct compilers to blacklist are, I'm happy to do that.

comment:4 Changed 6 years ago by pmetzger (Perry E. Metzger)

Perhaps kencu could help?

comment:5 in reply to:  2 Changed 6 years ago by iEFdev

Replying to ryandesign:

MacPorts does not use gcc as the default compiler on Lion. /usr/bin/gcc is not gcc on Lion and later.

Yes, I know, but that was what I had installed. But, now it looks like gcc5+ is the one(s) that works…

 

We don't generally want to build ports with FSF GCC. If any compiler is unsatisfactory for whatever reason, the port should blacklist it and let MacPorts choose the next best compiler, which, if all Xcode compilers are unsatisfactory, will be a newer version of clang provided by MacPorts.

I don't know if this is right/correct or not, but I tried to blacklist some, to find one who would work.

To blacklist I looked a bit at the Wine port, here, and also used these two pages.

As I added more compilers to the blacklist, it eventually wanted me to install {clang,llvm}-5.0 - so I did that, but that one didn't work either. Seems like gcc5 is the lowest working one.

  • Portfile

    old new  
    22
    33PortSystem          1.0
    44PortGroup           github 1.0
     5PortGroup           compiler_blacklist_versions 1.0
    56
    67github.setup        hishamhm htop 2.2.0
    78checksums           rmd160  13d2fc4d5414db6ac5653ef87a6216f4e2090bbf \
     
    3031pre-configure {
    3132    system -W ${worksrcpath} "sh autogen.sh"
    3233}
     34
     35compiler.blacklist-append {clang < 800} \
     36                          {*gcc-[3-4].*} \
     37                          {*clang-3.[0-9]} \
     38                          {*clang-4.[0-2]}
     39compiler.fallback-append  macports-gcc-5

That's what I used in the end.

I haven't got anything newer to try with, so I don't know which version is used on those systems. This is what I have installed (and tried with):

$ port installed {gcc,clang,llvm}*
The following ports are currently installed:
  clang-3.4 @3.4.2_12+analyzer+arm_runtime (active)
  clang-3.7 @3.7.1_5+analyzer (active)
  clang-3.8 @3.8.1_9+analyzer (active)
  clang-3.9 @3.9.1_8+analyzer+libstdcxx (active)
  clang-4.0 @4.0.1_5+analyzer+libstdcxx (active)
  clang-5.0 @5.0.1_1+analyzer+libstdcxx (active)
  clang_select @2_0 (active)
  gcc5 @5.5.0_0 (active)
  gcc7 @7.3.0_0 (active)
  gcc_select @0.1_8 (active)
  llvm-3.4 @3.4.2_12 (active)
  llvm-3.7 @3.7.1_4 (active)
  llvm-3.8 @3.8.1_3 (active)
  llvm-3.9 @3.9.1_5 (active)
  llvm-4.0 @4.0.1_2 (active)
  llvm-5.0 @5.0.1_0 (active)
  llvm_select @2_0 (active)

But again, I don't know if this is right/correct or not… Feels like there should be a simplier way to do it, & that I'm prob doing something wrong here. But hopefully it is helpful in some way. :)

Anyway, the error… It's been like this since htop became 2.0 -> So it's not just the last update.

comment:6 Changed 6 years ago by kencu (Ken)

I use htop on 10.6.8. My system is configured with LibcxxOnOlderSystems, and the default compiler is set to macports-clang-3.9, so it ignores everything that is set regarding compiler choices in the Portfile.

On this setup, htop builds and runs correctly.

comment:7 Changed 5 years ago by kencu (Ken)

Resolution: fixed
Status: assignedclosed

htop builds on Lion now:

http://packages.macports.org/htop/htop-2.2.0_0.darwin_11.x86_64.tbz2

comment:8 Changed 4 years ago by iEFdev

Can we reopen this?


Ok, I think I've found what's causing this.

I notice today when the new 3.01 updated arrived that I got the binary version (ie not built from source) and it worked fine. But, when building from source it always fails (not just htop – any port that uses ncurses).

Started to look around a bit, and noticed some of the paths set in the different *_autoconf.tcl files were programs in /usr/local (even if /usr/local wasn't in PATH during install). So I rebuilt my MacPorts installation (bootstrap-mp + mp), with a minimal PATH and I also renamed /usr/local{,.bak} during install, so it wouldn't pick up anything.

It still failed, but when renaming /usr/local or /usr/local/include it will build successfully.

So, I guess something in MP is looking for headers in /usr/local, even though the port is setup to use /opt/local for headers and libs - and everything in the logs, etc looks fine.


Building with -t works!

$ sudo port -t build htop
--->  Computing dependencies for htop
--->  Fetching distfiles for htop
--->  Verifying checksums for htop
--->  Extracting htop
--->  Configuring htop
Warning: The following existing files were hidden from the build system by trace mode:
  /opt
  /opt/local/bin/gawk
  /opt/local/bin/gdiff
  /opt/local/bin/ggrep
  /opt/local/bin/ghostname
  /opt/local/bin/gmkdir
  /opt/local/bin/gsed
  /opt/local/bin/python3.8
  /usr/local/include/ncursesw/curses.h
Warning: The following files inside the MacPorts prefix not installed by a port were accessed:
  /opt/local/bin/diff
  /opt/local/bin/grep
  /opt/local/bin/hostname
  /opt/local/bin/python
  /opt/local/bin/sed
--->  Building htop
Warning: The following existing file was hidden from the build system by trace mode:
  /opt/local/bin/gsed
Warning: The following file inside the MacPorts prefix not installed by a port was accessed:
  /opt/local/bin/sed

It's hiding the file from the build system.

So:

sudo port -vst install htop         # Works √
sudo port install htop              # Doesn't work 


Is there any way to make port not look around for more headers?

Or where is this done in base?

comment:9 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

It's not supported to have things in /usr/local when using MacPorts, because of the likelihood of running into problems. See wiki:FAQ#usrlocal.

comment:10 Changed 4 years ago by iEFdev

So it's the auto* tools, of course. Thanks.

Note: See TracTickets for help on using tickets.