Opened 7 years ago

Closed 6 years ago

Last modified 6 years ago

#54903 closed defect (fixed)

AtomicParsley @0.9.0: error: cannot initialize a variable of type 'char *' with an rvalue of type 'const char *'

Reported by: jpmelko Owned by: ken-cunningham-webuse
Priority: Normal Milestone:
Component: ports Version:
Keywords: highsierra Cc: fracai
Port: AtomicParsley

Description (last modified by ryandesign (Ryan Carsten Schmidt))

Bacchus:~ root# /opt/local/bin/port upgrade AtomicParsley
--->  Computing dependencies for AtomicParsley
--->  Building AtomicParsley
Error: Failed to build AtomicParsley: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_multimedia_AtomicParsley/AtomicParsley/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets to report a bug.

Attachments (1)

main.log (402.9 KB) - added by jpmelko 7 years ago.

Download all attachments as: .zip

Change History (8)

Changed 7 years ago by jpmelko

Attachment: main.log added

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

Description: modified (diff)
Keywords: highsierra added
Port: AtomicParsley added
Summary: Atomic Parsley won't bud on High SierraAtomicParsley @0.9.0: error: cannot initialize a variable of type 'char *' with an rvalue of type 'const char *'

We also have an AtomicParsley-devel port, which is a newer development version. You could check whether it has the same problem.

comment:2 Changed 7 years ago by jpmelko

AtomicParsley-devel port has the same problem

comment:3 Changed 7 years ago by fracai

Cc: fracai added

comment:4 Changed 7 years ago by wildyman

Please add the following lines to the end of the post-patch section of the Portfile to fix these build issues on High Sierra.

    # fix initializing a variable of type 'char *' with an rvalue of type 'const char *' b0rked in High Sierra
    reinplace -locale en_US.ISO8859-1 -W ${worksrcpath} "s|= strrchr|= (char*)strrchr|g" AP_NSFile_utils.mm AP_NSImage.mm AtomicParsley.cpp

It appears that clang's Objective C and C++ now use the safe C++ version of 'strrchr' which returns a 'const char*' for the overloaded function version that accepts a string literal ('const char*'). This version is presumably intended to prevent unsafe or unintentional modification of immutable string literals through a non constant reference (pointer) to a substring. The C version returns 'char*' which silently drops the const. The explicit cast added in the reinplace above allows the potentially unsafe operation. A better solution might be to change the return variable type to 'const char*' for these variables to ensure that AtomicParsley isn't actually performing unsafe string operations. It would be better to fix this in the AtomicParsley source.

Last edited 7 years ago by wildyman (previous) (diff)

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

atomicparsley-devel has the same issue.

comment:6 Changed 6 years ago by ken-cunningham-webuse

Owner: set to ken-cunningham-webuse
Resolution: fixed
Status: newclosed

In 848c4afda27d3f6fc085d431f5a54603363afe87/macports-ports:

atomicparsley: fix build on Xcode9

closes: #54903

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

also fixed atomicparsley-devel with separate commit

Note: See TracTickets for help on using tickets.