Opened 3 years ago

Closed 22 months ago

#61463 closed defect (worksforme)

mongodb @4.4.1_0 mongod: cannot execute binary file on macOS 10.15

Reported by: ValeryKV Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.6.3
Keywords: catalina Cc:
Port: mongodb

Description

I have upgraded macOS to 10.15 and installed Xcode 12.2, then I followed "Migration procedure" and reinstalled all ports. After that mongod failed to start. I uninstalled mongodb and reinstalled it again, but it did not help. Most possible it was built as 32 bit. Here are some outputs:

api:~ valery$ mongo
-bash: /opt/local/bin/mongo: cannot execute binary file
api:~ valery$ file /opt/local/bin/mongo
/opt/local/bin/mongo: data
api:~ valery$ ls -al /opt/local/bin/mongo*
-rwxr-xr-x  1 macports  admin  51098720 Nov 14 22:45 /opt/local/bin/mongo
-rwxr-xr-x  1 macports  admin  85955312 Nov 14 22:45 /opt/local/bin/mongod

Attachments (1)

main.log (4.7 MB) - added by ValeryKV 3 years ago.
logfile

Change History (13)

comment:1 Changed 3 years ago by jmroot (Joshua Root)

Keywords: mongodb macOS removed
Owner: set to ryandesign
Port: mongodb added
Status: newassigned

comment:2 in reply to:  description Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to ValeryKV:

Most possible it was built as 32 bit.

That should be impossible, since the port was built on Catalina and it is not possible to build 32-bit software on Catalina.

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

And if it were 32-bit, running file on it would have said that it was a 32-bit Mach-O file, but it said it was "data", which means file couldn't identify what it was, which is strange.

Make sure that you have installed both Xcode 12.2 and the Xcode 12.2 version of the command line tools.

Try rebuilding mongodb one more time, this time using the -k flag to tell MacPorts to keep the work directory and log:

sudo port clean mongodb
sudo port -nsk upgrade --force mongodb

Assuming the mongo program still doesn't work after that rebuild, please show us the build log.

The log file will be at the location printed by the command:

port logfile mongodb

Compress this file and attach it to the ticket so that we can see what happened.

Also, maybe show us the first few bytes of the mongo file by running:

$ hexdump -n 128 /opt/local/bin/mongo

Here is what that looks like on the file that was built by our Catalina buildbot worker:

0000000 cf fa ed fe 07 00 00 01 03 00 00 00 02 00 00 00
0000010 1f 00 00 00 50 0c 00 00 85 80 a1 00 00 00 00 00
0000020 19 00 00 00 48 00 00 00 5f 5f 50 41 47 45 5a 45
0000030 52 4f 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0000040 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00
0000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0000060 00 00 00 00 00 00 00 00 19 00 00 00 c8 02 00 00
0000070 5f 5f 54 45 58 54 00 00 00 00 00 00 00 00 00 00
0000080

comment:4 Changed 3 years ago by ValeryKV

I installed Command Line Tools for Xcode 12, not 12.2, because they tell the version 12.2 is pre-release software.

$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 12.0.0.0.1.1599194153
volume: /
location: /
install-time: 1605347145
groups: com.apple.FindSystemFiles.pkg-group 

Here the output for hexdump

$ hexdump -n 128 /opt/local/bin/mongo
0000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0000080
$ hexdump -C /opt/local/bin/mongo | head
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00800000  90 4c 89 85 78 ff ff ff  89 55 c4 48 8b 48 08 48  |.L..x....U.H.H.H|
00800010  89 fe 48 c1 e6 04 4c 63  3c 31 4c 8b 74 31 08 49  |..H...Lc<1L.t1.I|
00800020  63 00 4a 8d 1c 38 48 89  5d 98 83 7c 31 04 00 48  |c.J..8H.]..|1..H|
00800030  89 bd 70 ff ff ff 74 67  48 85 ff 0f 94 c0 83 fa  |..p...tgH.......|
00800040  04 0f 85 ac 04 00 00 44  20 c8 0f 85 a3 04 00 00  |.......D .......|
00800050  45 39 78 30 7e 10 4b 8d  04 7f 41 80 7c 40 38 00  |E9x0~.K...A.|@8.|
00800060  0f 85 8d 04 00 00 48 8b  85 60 ff ff ff 48 8b 70  |......H..`...H.p|
00800070  30 48 8b 45 10 8b 00 89  45 b8 49 8d 7e 08 48 89  |0H.E....E.I.~.H.|

Must I use the Xcode 12.2 version of the command line tools?

If version 12.0 is OK, I will try to rebuild with -k flag.

comment:5 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

You should always use a matched set of Xcode and the Xcode command line tools. Xcode 12.2 is not prerelease software anymore. The final version of both Xcode 12.2 and the Xcode 12.2 version of the command line tools were released on November 12. Doesn't matter what versions you use, as long as they're compatible with your OS and are a matched set.

Don't know why your files start with zeroes like that, but that's definitely unusable, so get a matched set of Xcode and CLT and then rebuild mongodb per my previous instructions and show us the log if it builds wrong again.

Changed 3 years ago by ValeryKV

Attachment: main.log added

logfile

comment:6 Changed 3 years ago by ValeryKV

I installed the command line tools for Xcode 12.2.

$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
version: 12.2.0.0.1.1604628099

Then I rebuilt mongodb

$ sudo port clean mongodb
$ sudo port -nsk upgrade --force mongodb
$ /opt/local/bin/mongo
-bash: /opt/local/bin/mongo: cannot execute binary file
$ file /opt/local/bin/mongo
/opt/local/bin/mongo: data

The log file is attached to the ticket.

Version 1, edited 3 years ago by ValeryKV (previous) (next) (diff)

comment:7 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

So far I don't see anything unusual in your log to explain this.

Do you see this problem only with mongodb or also with files installed by other ports?

Is your disk ok? Try running First Aid in Disk Utility.

comment:8 Changed 3 years ago by ValeryKV

Php, python, perl, nginx and other ports work great. I will try First Aid later. After that I installed mongo via brew to /usr/local/opt/mongodb-community@4.0/bin/mongod . It works. I may try to reinstall mongodb v4.0. What command to run?

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

We only offer one version of mongodb in MacPorts—the one in the mongodb port.

If you're adventurous you can try installing an older version of the port.

comment:10 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Note that having software installed with Homebrew can interfere with MacPorts being able to build software properly, and vice versa. If you had software installed with Homebrew when you built mongodb, that could have caused the problem, and you might try building again after removing Homebrew. See wiki:FAQ#usrlocal.

comment:11 Changed 3 years ago by ValeryKV

I never used Homebrew before. I needed working version of mongodb. After MacPort version failed for me, I installed mongodb 4.0 with Homebrew. The last try I rebuilt mongodb with command line tools v 12.2 after I installed mongodb v 4.0 with Homebrew. Because I the only one person who faced with the issue, you probably may close the ticket until someone reproduce it.

comment:12 Changed 22 months ago by ryandesign (Ryan Carsten Schmidt)

Resolution: worksforme
Status: assignedclosed
Note: See TracTickets for help on using tickets.