Opened 12 years ago

Closed 12 years ago

#33672 closed defect (fixed)

mosh: error: ‘posix_memalign’ was not declared in this scope

Reported by: sondy@… Owned by: quentinmit (Quentin Smith)
Priority: Normal Milestone:
Component: ports Version: 2.0.4
Keywords: leopard tiger haspatch Cc: ryandesign (Ryan Carsten Schmidt)
Port: mosh

Description

When building mosh, I received the following error:

--->  Building mosh
Error: Target org.macports.build returned: shell command failed (see log for details)
Log for mosh is at: [...]
Error: Status 1 encountered during processing.

I have attached the MacPorts log as well. Thank you!

Attachments (3)

main.log (35.9 KB) - added by sondy@… 12 years ago.
Portfile.diff (539 bytes) - added by ryandesign (Ryan Carsten Schmidt) 12 years ago.
proposed patch
patch-src-crypto-crypto.cc.diff (316 bytes) - added by ryandesign (Ryan Carsten Schmidt) 12 years ago.

Download all attachments as: .zip

Change History (18)

comment:1 Changed 12 years ago by sondy@…

Cc: sondy@… added

Cc Me!

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

Cc: ryandesign@… added; sondy@… removed
Keywords: mosh status 1 removed
Owner: changed from macports-tickets@… to quentin@…
Summary: Status 1 encountered during install / OS 10.5.8mosh: error: ‘__builtin_bswap64’ was not declared in this scope

You don't need to Cc yourself when you are the reporter.

The log you attached is incomplete. "sudo port clean mosh" and try again.

If in the new log you see the same error:

:info:build ocb.cc:716: error: ‘__builtin_bswap64’ was not declared in this scope

then this could be similar to #29358, in which the user had a rogue /usr/include/byteswap.h file on their system, which should not have been there. Do you have this file on your system? If so remove it, then clean mosh again, then try again. If you can identify where the include file came from, that might be helpful.

Changed 12 years ago by sondy@…

Attachment: main.log added

comment:3 in reply to:  2 Changed 12 years ago by sondy@…

I did "sudo port clean mosh" and tried reinstalling again, and I received the same error as before. I don't have the file /usr/include/byteswap.h on my system. Can you clarify what you mean by identifying where the include file came from? Thank you for your time.

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

Keywords: leopard tiger added
Summary: mosh: error: ‘__builtin_bswap64’ was not declared in this scopemosh: error: ‘posix_memalign’ was not declared in this scope

Hmm, if you don't have /usr/include/byteswap.h then there's no point trying to identify where it came from. :)

The new main.log does not show the same error as before; it shows:

:info:build crypto.cc:52: error: ‘posix_memalign’ was not declared in this scope

As I understand it, posix_memalign is available in Snow Leopard and later, and the log shows you're on Leopard, so this version of this software may simply not work on Leopard anymore. You should report that to the developers and see if they're interested in fixing it. We had a similar problem with libtorrent that's discussed in #27289; that and this stackoverflow question might be good starting points for the mosh developers to fix this, or for us to patch the port, if the developers are unwilling to fix it themselves.

comment:5 Changed 12 years ago by quentinmit (Quentin Smith)

Leopard's getting pretty old there :)

I'm afraid you're the first person to try building mosh on Leopard. I'm talking with upstream right now; it looks like OS X already guarantees 16-byte alignment for malloc, so we should be able to avoid the posix_memalign call.

Before making just that change, though, I'm going to try to track down a Leopard machine to test the build on, to make sure there aren't any other problems.

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

If you need me to test something, I have access to Tiger and Leopard on Intel and PowerPC systems.

comment:7 Changed 12 years ago by quentinmit (Quentin Smith)

As a quick test, try replacing the failing line in crypto.cc:

if( (0 != posix_memalign( (void **)&ptr, 16, len )) || (ptr == NULL) ) {

with

if( ! (ptr = malloc(len)) ) {

I'm worried there will be other build failures due to Leopard's gcc 4.0, even if we fix this missing function.

comment:8 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Although gcc-4.0 is the default in Leopard's Xcode, gcc-4.2 is also installed, and we could switch the port to that if necessary. That's not possible on Tiger however where gcc-4.0 is the newest version provided.

comment:9 in reply to:  7 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to quentin@…:

As a quick test, try replacing the failing line in crypto.cc:

After making that change, to my surprise, I get the error that was originally reported in this ticket:

ocb.cc: In function ‘long long int __vector__ gen_offset_from_nonce(ae_ctx*, const void*)’:
ocb.cc:716: error: ‘__builtin_bswap64’ was not declared in this scope

Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Attachment: Portfile.diff added

proposed patch

Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

comment:10 in reply to:  8 ; Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: haspatch added

Replying to ryandesign@…:

gcc-4.2 is also installed, and we could switch the port to that if necessary.

Additionally switching to gcc-4.2 lets the port build. (I don't know if the software works, however.)

comment:11 in reply to:  10 Changed 12 years ago by quentinmit (Quentin Smith)

Replying to ryandesign@…:

Replying to ryandesign@…:

gcc-4.2 is also installed, and we could switch the port to that if necessary.

Additionally switching to gcc-4.2 lets the port build. (I don't know if the software works, however.)

Unfortunately, it looks like it doesn't - Leopard has a broken poll(3) implementation. mosh just exits immediately, because it gets POLLNVAL.

(BTW, if you want to follow along, I have a branch of mosh at https://github.com/quentinmit/mosh with patches for Leopard.)

I'm working with upstream on a solution, but it doesn't look trivial. Sorry, Sondy!

comment:12 Changed 12 years ago by quentinmit (Quentin Smith)

Leopard support has been merged upstream in mosh 1.1.2; I've filed #33810 to get that into macports.

comment:13 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

The port was updated to 1.1.2 in #33810; the issue remains for PowerPC Macs.

comment:14 Changed 12 years ago by quentinmit (Quentin Smith)

mosh 1.2 fixes this build error. With luck, it will now work on PowerPC Macs as well! I've filed #34223 to get mosh 1.2 into MacPorts.

comment:15 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.