apache / trafficserver

Apache Traffic Serverâ„¢ is a fast, scalable and extensible HTTP/1.1 and HTTP/2 compliant caching proxy server.
https://trafficserver.apache.org/
Apache License 2.0
1.81k stars 799 forks source link

Can't build plugins on Mac #10061

Closed maskit closed 1 year ago

maskit commented 1 year ago

I see this build errors on my Mac. Clean build didn't work.

Making all in plugins
  CXXLD    esi/libesicore.la
  CXXLD    esi/libtest.la

*** Warning: Linking the shared library esi/libtest.la against the loadable module
*** libesicore.so is not portable!
*** Warning: lib libesicore.so is a module, not a shared library

*** And there doesn't seem to be a static archive available
*** The link will probably fail, sorry
ld: can't link with bundle (MH_BUNDLE) only dylibs (MH_DYLIB) file 'esi/.libs/libesicore.so' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [esi/libtest.la] Error 1
*** Warning: Linking the shared library experimental/sslheaders/sslheaders.la against the loadable module
*** libsslhdr.so is not portable!
*** Warning: lib libsslhdr.so is a module, not a shared library

*** And there doesn't seem to be a static archive available
*** The link will probably fail, sorry
bryancall commented 1 year ago

I was able to get ATS to build with autotools on the mac, but it wants to load the wrong libcrypto.dylib on startup:

16:15:20 chaos:(master)~/dev/apache/trafficserver/build-Darwin_gcc_h3$ /opt/ats/bin/traffic_server -T quic
dyld[2790]: Symbol not found: _ASN1_STRING_get0_data
  Referenced from: <A471AA6C-2E17-311B-8A63-BE4F5ECA52A8> /opt/ats/bin/traffic_server
  Expected in:     <B70E508F-94CD-3330-ACD3-23F309B60F8B> /usr/lib/libcrypto.dylib
Abort trap: 6
jpeach commented 1 year ago

Building with this:

$ cat c.sh
#! /usr/bin/env bash

set -o errexit

make distclean || true

autoreconf -fi
./configure \
    --enable-debug \
    --prefix=/opt/ats \
    --with-openssl=$(brew --prefix openssl) \
    --enable-experimental-plugins \
    --enable-example-plugins \
    --enable-test-tools

make clean
make -j$(getconf NPROCESSORS_ONLN) CC="mj clang" CXX="mj clang++"
make -j$(getconf NPROCESSORS_ONLN) check CC="mj clang" CXX="mj clang++"
mj --collate

find . -name *.db.json | xargs rm

Fails in the tests:

Making check in remap
/Applications/Xcode.app/Contents/Developer/usr/bin/make  test_NextHopStrategyFactory test_NextHopRoundRobin test_NextHopConsistentHash
  CXX      test_NextHopStrategyFactory-NextHopSelectionStrategy.o
  CXX      test_NextHopStrategyFactory-NextHopStrategyFactory.o
  CXX      test_NextHopStrategyFactory-NextHopRoundRobin.o
  CXX      test_NextHopStrategyFactory-NextHopConsistentHash.o
  CXX      test_NextHopStrategyFactory-NextHopHealthStatus.o
  CXX      test_NextHopRoundRobin-NextHopSelectionStrategy.o
  CXX      test_NextHopRoundRobin-NextHopStrategyFactory.o
  CXX      test_NextHopRoundRobin-NextHopRoundRobin.o
  CXX      test_NextHopRoundRobin-NextHopConsistentHash.o
  CXX      test_NextHopRoundRobin-NextHopHealthStatus.o
  CXX      test_NextHopConsistentHash-NextHopSelectionStrategy.o
  CXX      test_NextHopConsistentHash-NextHopStrategyFactory.o
  CXX      test_NextHopConsistentHash-NextHopConsistentHash.o
  CXX      test_NextHopConsistentHash-NextHopHealthStatus.o
  CXX      test_NextHopConsistentHash-NextHopRoundRobin.o
  CXX      unit-tests/test_NextHopConsistentHash-test_NextHopConsistentHash.o
  CXX      unit-tests/test_NextHopConsistentHash-nexthop_test_stubs.o
  CXX      unit-tests/test_NextHopStrategyFactory-test_NextHopStrategyFactory.o
  CXX      unit-tests/test_NextHopStrategyFactory-nexthop_test_stubs.o
  CXX      unit-tests/test_NextHopRoundRobin-test_NextHopRoundRobin.o
  CXX      unit-tests/test_NextHopRoundRobin-nexthop_test_stubs.o
  CXXLD    test_NextHopConsistentHash
clang: error: no such file or directory: '/Users/jpeach/src/trafficserver/src/tscore/.libs/libtscore.dylib'
make[4]: *** [test_NextHopConsistentHash] Error 1
randall commented 1 year ago

@jpeach Try removing src/tscore/libtscore.la. I had an old one hanging around causing the same issue.

And FTR, I can build plugins (including esi), run make check (after removing libtscore.la) and run ATS:

./bin/traffic_server 
Traffic Server 10.0.0- Jul 25 2023 09:48:08 XXXX
traffic_server: using root directory '/opt/ats10'
[Jul 25 09:49:59.001]  NOTE: records parsing completed.
[Jul 25 09:49:59.002]  NOTE: Warn:   Warn: Ignoring field 'connect_attempts_max_retries_dead_server' at Line 39. Not registered and Unknown tag type '?'

[Jul 25 09:49:59.002]  NOTE: /opt/ats10/etc/trafficserver/records.yaml finished loading

Here's my configure command line:

"./configure" \
"--prefix=/opt/ats10" \
"--with-openssl=/opt/homebrew/opt/openssl@1.1" \
"--with-group=admin" \
"--with-user=randall" \
"--disable-silent-rules" \
"--disable-dependency-tracking" \
"--enable-test-tools" \
"--enable-experimental-plugins" \
"--with-brotli=/opt/homebrew/Cellar/brotli/1.0.9" \
"--with-pcre=/opt/homebrew" \
"--enable-debug" 
randall commented 1 year ago
otool -L bin/traffic_server
bin/traffic_server:
    /opt/ats10/lib/libtscpputil.10.dylib (compatibility version 11.0.0, current version 11.0.0)
    /opt/homebrew/opt/hwloc/lib/libhwloc.15.dylib (compatibility version 22.0.0, current version 22.3.0)
    /opt/homebrew/opt/pcre/lib/libpcre.1.dylib (compatibility version 4.0.0, current version 4.13.0)
    /usr/lib/libresolv.9.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.12)
    /opt/ats10/lib/libtsswoc-1.5.2.dylib (compatibility version 0.0.0, current version 0.0.0)
    /opt/homebrew/opt/openssl@1.1/lib/libssl.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
    /opt/homebrew/opt/openssl@1.1/lib/libcrypto.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1336.0.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1600.151.0)
maskit commented 1 year ago

The issue I faced is triggered by --with-quiche somehow, and #10087 works for me.

maskit commented 1 year ago

@jpeach Please create another issue if you still the build issue with test_NextHopConsistentHash. #10087 worked for the one I faced (and test_NextHopConsistentHash works for me).