Opened 3 years ago

Closed 3 weeks ago

#64619 closed defect (fixed)

openssl3 fails to build for ppc on 10.6.8 (Rosetta)

Reported by: barracuda156 Owned by: barracuda156
Priority: Normal Milestone:
Component: ports Version: 2.7.1
Keywords: powerpc, snowleopard, rosetta Cc:
Port: openssl3

Description

${LDCMD:-/opt/local/bin/gcc-mp-7} -arch ppc -std=gnu9x -Wa,-force_cpusubtype_ALL -pipe -Os -arch ppc -Wl,-search_paths_first -L/opt/local/lib -Wl,-headerpad_max_install_names -arch ppc -L/opt/local/lib \
		-o test/algorithmid_test \
		test/algorithmid_test-bin-algorithmid_test.o \
		test/libtestutil.a libcrypto.a -lz 
Undefined symbols for architecture ppc:
  "___atomic_is_lock_free", referenced from:
      _CRYPTO_atomic_or in libcrypto.a(libcrypto-lib-threads_pthread.o)
      _CRYPTO_atomic_load in libcrypto.a(libcrypto-lib-threads_pthread.o)
  "___atomic_fetch_or_8", referenced from:
      _CRYPTO_atomic_or in libcrypto.a(libcrypto-lib-threads_pthread.o)
  "___atomic_load_8", referenced from:
      _CRYPTO_atomic_load in libcrypto.a(libcrypto-lib-threads_pthread.o)
ld: symbol(s) not found for architecture ppc
collect2: error: ld returned 1 exit status
make[1]: *** [fuzz/cmp-test] Error 1
make[1]: *** Waiting for unfinished jobs....
Undefined symbols for architecture ppc:
  "___atomic_is_lock_free", referenced from:
      _CRYPTO_atomic_or in libcrypto.a(libcrypto-lib-threads_pthread.o)
      _CRYPTO_atomic_load in libcrypto.a(libcrypto-lib-threads_pthread.o)
  "___atomic_fetch_or_8", referenced from:
      _CRYPTO_atomic_or in libcrypto.a(libcrypto-lib-threads_pthread.o)
  "___atomic_load_8", referenced from:
      _CRYPTO_atomic_load in libcrypto.a(libcrypto-lib-threads_pthread.o)
ld: symbol(s) not found for architecture ppc
collect2: error: ld returned 1 exit status
make[1]: *** [test/algorithmid_test] Error 1
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_openssl3/openssl3/work/openssl-3.0.1'
make: *** [build_sw] Error 2
make: Leaving directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_openssl3/openssl3/work/openssl-3.0.1'
Command failed:  cd "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_openssl3/openssl3/work/openssl-3.0.1" && /usr/bin/make -j4 -w all 
Exit code: 2
Error: Failed to build openssl3: command execution failed

Attachments (1)

main.log (1.6 MB) - added by barracuda156 3 years ago.

Download all attachments as: .zip

Change History (8)

Changed 3 years ago by barracuda156

Attachment: main.log added

comment:1 Changed 3 years ago by kencu (Ken)

The gcc compiler has it's atomic functions contained in a separate library (at least for archs where there are not processor intrinsics). The library is called "libatomic.dylib", no great surprise.

But this library is not ever automatically added to the link by gcc. The build system has to do that.

Short story: add -latomic to the link libraries.

Exactly how you do that depends on the build system, but in many cases, you can do this in MacPorts:

configure.ldflags-append -latomic

To have that accepted into a Portfile as a fix, you'd have to only add it when gcc is the compiler, and you'd have to only add it if it is needed (ie figure out if it is all archs, only some archs, etc).

ALTERNATIVELY, you can figure out how to make the build NOT use atomic operations, if that floats your boat better. It is not really as good, if you ask me, but it is an option.

comment:2 in reply to:  1 Changed 3 years ago by barracuda156

Replying to kencu:

Short story: add -latomic to the link libraries.

Thank you! -append line did not work, but this did:

configure.args-append       CFLAGS_FOR_BUILD="-arch ppc -m32" \
                            CXXFLAGS_FOR_BUILD="-arch ppc -m32" \
                            LDFLAGS_FOR_BUILD="-latomic" \
                            --build=powerpc-apple-darwin10 \
                            --host=powerpc-apple-darwin10 \
                            --target=powerpc-apple-darwin10

I did not see -latomic been actually passed though. Nevertheless,

Sergey-Fedorovs-Mac-mini:~ svacchanda$ port -v installed openssl3
The following ports are currently installed:
  openssl3 @3.0.1_0+legacy (active) requested_variants='' platform='darwin 10' archs='ppc' date='2022-02-08T06:31:58+0800'

To propose a fix, I will need to make sure when exactly the build fails and what is the minimal addition that solves the problem. At least, practical problem for now is solved.

comment:3 Changed 10 months ago by neverpanic (Clemens Lang)

Owner: set to barracuda156
Status: newassigned

comment:4 Changed 6 weeks ago by neverpanic (Clemens Lang)

barracuda156: I've assigned this to you, do you want to keep it open and work on a fix, or should I close it? I don't plan to work on this myself.

comment:5 in reply to:  4 Changed 5 weeks ago by barracuda156

Replying to neverpanic:

barracuda156: I've assigned this to you, do you want to keep it open and work on a fix, or should I close it? I don't plan to work on this myself.

It can be closed as Fixed, since w/e failed 3 years ago, it works fine now, at least with tests disabled. I have built 3.3.x in Rosetta just a few days ago when opened a PR to disable tests by default.

comment:6 Changed 5 weeks ago by barracuda156

  1. S. From log above it follows that I used gcc7 for some reason. That makes little sense in any case, since openssl3 will be needed as a prerequisite to build gcc, and also gcc7 should not be used for anything anyway.

Maybe openssl upstream disabled some extra functionality for ppc or maybe they just fixed the bug, but it builds now with the default system compiler.

comment:7 Changed 3 weeks ago by neverpanic (Clemens Lang)

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