UlricE / pen

Pen
Other
250 stars 41 forks source link

"make" failed #54

Closed luckypoem closed 4 years ago

luckypoem commented 4 years ago

hi.

git clone https://github.com/UlricE/pen pen-by-UlricE cd pen-by-UlricE ./bootstrap.sh ./configure make

it shows: ... Undefined symbols for architecture x86_64: "_OPENSSL_init_ssl", referenced from: _ssl_init in ssl.o "_SSL_CTX_set_options", referenced from: _ssl_create_context in ssl.o "_TLS_method", referenced from: _ssl_create_context in ssl.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: [pen] Error 1 make: [all] Error 2

how to fix it?

luckypoem commented 4 years ago

my os is mac

daviddpd commented 4 years ago

Try installing OpenSSL via home-brew.
See: https://brew.sh

Then: brew install openssl

It worked for me, but I have a lot of additional libraries installed via as well.

luckypoem commented 4 years ago

hi.

yudeMacBook-Air:~ brite$ brew install openssl Updating Homebrew... ^CWarning: openssl@1.1 1.1.1d is already installed and up-to-date To reinstall 1.1.1d, run brew reinstall openssl@1.1 yudeMacBook-Air:~ brite$ cd pen-by-UlricE yudeMacBook-Air:pen-by-UlricE brite$ make /Applications/Xcode.app/Contents/Developer/usr/bin/make all-am gcc -Wall -g -O2 -DDEBUGGING -o pen pen.o select.o poll.o kqueue.o epoll.o dlist.o ssl.o dsr.o memory.o diag.o settings.o acl.o event.o netconv.o server.o client.o conn.o idlers.o -lGeoIP -lssl -lcrypto -lresolv Undefined symbols for architecture x86_64: "_OPENSSL_init_ssl", referenced from: _ssl_init in ssl.o "_SSL_CTX_set_options", referenced from: _ssl_create_context in ssl.o "_TLS_method", referenced from: _ssl_create_context in ssl.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: [pen] Error 1 make: [all] Error 2 yudeMacBook-Air:pen-by-UlricE brite$

it doesn't work.so,how to fix the issue?

daviddpd commented 4 years ago
make clean
./configure
make

if still fails,

cd ..
rm -rf pen-by-UlricE
git clone https://github.com/UlricE/pen pen-by-UlricE
cd pen-by-UlricE
./bootstrap.sh
./configure
make

If it still fails, then you need to do a deeper dive into fiddling with some of the options listed in : ./configure --help ... likely having to do with --libdir=DIR and --includedir=DIR. Google around for "OpenSSL macOS open source compiling errors" - this is a pretty typical and generic macOS / unix porting problem. I do a lot of this, so likely have adjusted my environment.

This specially is a linking error - likely the header files for OpenSSL compiled into multiple of those *.o object files, but when linking them all together, the OpenSSL library with these symbols failed to be founded/linked into the final binary.

luckypoem commented 4 years ago

hi.

brew link --overwrite openssl Warning: Refusing to link macOS-provided software: openssl If you need to have openssl@1.1 first in your PATH run: echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.bash_profile

For compilers to find openssl@1.1 you may need to set: export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib" export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

For pkg-config to find openssl@1.1 you may need to set: export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig" yudeMacBook-Air:pen-by-UlricE brite$ echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.bash_profile yudeMacBook-Air:pen-by-UlricE brite$ echo 'export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"' >> ~/.bash_profile yudeMacBook-Air:pen-by-UlricE brite$ echo 'export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"' >> ~/.bash_profile yudeMacBook-Air:pen-by-UlricE brite$ echo 'export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"' >> ~/.bash_profile yudeMacBook-Air:pen-by-UlricE brite$ make /Applications/Xcode.app/Contents/Developer/usr/bin/make all-am gcc -Wall -g -O2 -DDEBUGGING -o pen pen.o select.o poll.o kqueue.o epoll.o dlist.o ssl.o dsr.o memory.o diag.o settings.o acl.o event.o netconv.o server.o client.o conn.o idlers.o -lGeoIP -lssl -lcrypto -lresolv Undefined symbols for architecture x86_64: "_OPENSSL_init_ssl", referenced from: _ssl_init in ssl.o "_SSL_CTX_set_options", referenced from: _ssl_create_context in ssl.o "_TLS_method", referenced from: _ssl_create_context in ssl.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: [pen] Error 1 make: [all] Error 2 yudeMacBook-Air:pen-by-UlricE brite$

still not ok. i ran "man ld".i think the key is ld,but i don't know how to use ld.

ifduyue commented 4 years ago

If you update ~/.bash_profile, you need to either open a new bash terminal or source ~/.bash_profile to let your changes take effect.

luckypoem commented 4 years ago

i ran "source ~/.bash_profile" and "make", still not ok

daviddpd commented 4 years ago

This is absolutely a local developer environment error, not a bug in the code. brew link --overwrite - never do that ... you've probably messed up your macOS install beyond repair. I'd recommend a complete macOS re-install.

Before that, grab VirtualBox, and install something like ubuntu or CentOS in a VM (or on a linux/FreeBSD system other than your Mac) and attempt to compile pen. If an out-of-the-box compile on Linux one of these default installs stills fails, it's a PEBKAC issue.

In either case, debugging a macOS developer issue - this is likely the wrong forum for this.

jasonjoo2010 commented 4 years ago

I can provide a tip from my building how to specify alternative openssl library:

./bootstrap.sh
CFLAGS=-I/usr/local/Cellar/openssl@1.1/1.1.1d/include ./configure --prefix=$(pwd)/t --with-ssl=/usr/local/Cellar/openssl@1.1/1.1.1d
make
luckypoem commented 4 years ago

@jasonjoo2010 hi. as per your tip,i do succeeded in the configure step. but what does "$(pwd)/t" mean? what does t mean?

luckypoem commented 4 years ago

@daviddpd

yudeMacBook-Air:pen-by-UlricE brite$ make yudeMacBook-Air:pen-by-UlricE brite$ make install /usr/local/bin/gmkdir -p '/Users/brite/pen-by-UlricE/t/bin' /usr/local/bin/ginstall -c pen mergelogs penctl penlog penlogd '/Users/brite/pen-by-UlricE/t/bin' /usr/local/bin/gmkdir -p '/Users/brite/pen-by-UlricE/t/doc/pen' /usr/local/bin/ginstall -c -m 644 penstats HOWTO AUTHORS README ChangeLog COPYING '/Users/brite/pen-by-UlricE/t/doc/pen' /usr/local/bin/gmkdir -p '/Users/brite/pen-by-UlricE/t/share/man/man1' /usr/local/bin/ginstall -c -m 644 pen.1 mergelogs.1 penctl.1 penlog.1 penlogd.1 '/Users/brite/pen-by-UlricE/t/share/man/man1' yudeMacBook-Air:pen-by-UlricE brite$ which pen yudeMacBook-Air:pen-by-UlricE brite$

where is the executable file pen?

jasonjoo2010 commented 4 years ago

@jasonjoo2010 hi. as per your tip,i do succeeded in the configure step. but what does "$(pwd)/t" mean? what does t mean?

Oh i just use the --prefix to specify a temporary directory to make a test. You can just ignore it.

jasonjoo2010 commented 4 years ago

@daviddpd

yudeMacBook-Air:pen-by-UlricE brite$ make yudeMacBook-Air:pen-by-UlricE brite$ make install /usr/local/bin/gmkdir -p '/Users/brite/pen-by-UlricE/t/bin' /usr/local/bin/ginstall -c pen mergelogs penctl penlog penlogd '/Users/brite/pen-by-UlricE/t/bin' /usr/local/bin/gmkdir -p '/Users/brite/pen-by-UlricE/t/doc/pen' /usr/local/bin/ginstall -c -m 644 penstats HOWTO AUTHORS README ChangeLog COPYING '/Users/brite/pen-by-UlricE/t/doc/pen' /usr/local/bin/gmkdir -p '/Users/brite/pen-by-UlricE/t/share/man/man1' /usr/local/bin/ginstall -c -m 644 pen.1 mergelogs.1 penctl.1 penlog.1 penlogd.1 '/Users/brite/pen-by-UlricE/t/share/man/man1' yudeMacBook-Air:pen-by-UlricE brite$ which pen yudeMacBook-Air:pen-by-UlricE brite$

where is the executable file pen?

If you are building a formal distribution and install it into /usr/local/ for example then you can use --prefix=/usr/local/.

luckypoem commented 4 years ago

@jasonjoo2010 pen是安装在环境变量里的啊,所以运行which pen应该能找到pen啊。难道可执行文件名不是pen?

jasonjoo2010 commented 4 years ago

@jasonjoo2010 pen是安装在环境变量里的啊,所以运行which pen应该能找到pen啊。难道可执行文件名不是pen?

Please pay attention to this line in your previous log:

/usr/local/bin/ginstall -c pen mergelogs penctl penlog penlogd '/Users/brite/pen-by-UlricE/t/bin'

You have --prefix=$(pwd)/t in your arguments of configure so they are placed in to that directory.

To solve it and install them into system directly you can just rerun the configure / make / make install using the correct arguments (maybe just remove --prefix)

luckypoem commented 4 years ago

@jasonjoo2010 i see,tks