devel/p4 fails to build with the following error when selecting libressl-devel as default ssl provider (at least for libressl 2.9.0, unsure about libressl of the non-devel port): /usr/bin/ld: error: undefined symbol: X509_get_X509_PUBKEY This is due to the fact that /usr/include/openssl/x509.h is included instead of /usr/local/include/openssl/x509.h, the former declaring X509_get_X509_PUBKEY as a symbol whereas the latter implements it as a macro. Changing the include order and assuring that the build looks at the libressl headers, works, e.g.: cd /usr/ports/devel/p4 sudo make CPATH=/usr/local/include:/usr/include I think that this could also lead to problems with openssl from ports, instead of the one from base, as the base includes from /usr/include will be used instead of the ones from ports? I am not sure what the best way would be to fix this, but I guess the Makefile should be changed to make sure this includes the matching headers for all possible combinations, openssl (from base or ports) or libressl.
Created attachment 202894 [details] Fix build with alternate OpenSSL implementations Thanks for reporting this bug. Can you please try building with this patch? It works for me in Poudriere.
This works and fixes the issue I reported, however it seems to create another problem. With this patch the port fails to build if archivers/libzip is installed. With -I${OPENSSLINC}, the following error is produced when compiling crc32.c (shipped with the distfile perforce/p4/2016-1.zip): ----------- log ---------------> clang -c -o p4-bin/objects/zlib/crc32.o -O2 -pipe -I/usr/local/include -fstack-protector -fno-strict-aliasing -pipe -O2 -Wno-parentheses -Wno-switch -fwrapv -DOS_FREEBSD -DOS_FREEBSD120 -DOS_FREEBSDX86_64 -DOS_FREEBSD120X86_64 -DUSE_SSL -Izlib -Imsgs -Isupport -Isys zlib/crc32.c sys/zipfile.cc:52:25: error: use of undeclared identifier 'APPEND_STATUS_CREATE' zf = zipOpen64( fName, APPEND_STATUS_CREATE ); ^ sys/zipfile.cc:58:2: error: use of undeclared identifier 'zipClose' zipClose( zf, 0 ); ^ sys/zipfile.cc:74:2: error: unknown type name 'zip_fileinfo' zip_fileinfo zi; ^ sys/zipfile.cc:94:15: error: use of undeclared identifier 'zipCloseFileInZip' int result = zipCloseFileInZip( zf ); ^ sys/zipfile.cc:106:15: error: use of undeclared identifier 'zipWriteInFileInZip' int result = zipWriteInFileInZip( zf, buf, len ); ^ 5 errors generated. <----------- log --------------- The reason is that it includes libzip's installed /usr/local/include/zip.h whereas the build wants to include its own /usr/ports/devel/p4/work/2016-1/zlib/zip.h. Looking at the clang command invocation above that now has the new -I/usr/local/include in it, I think it should be after the -Izlib one (which I guess refers to p4's own shipped zlib folder). I am not sure how you would place it accordingly, maybe as pragmatically as: CFLAGS+= -Izlib -I${OPENSSLINC} Does feel a bit hacky though...
Tiny (not really important) correction: it fails when sys/zipfile.cc is compiled, not crc32. I copy & pasted the wrong line. The analysis stays the same, though. Thanks for the quick reply and fix btw, you rock!
Created attachment 202914 [details] Fix build with alternate OpenSSL implementations Try this patch instead. I think this should fix the libzip problem.
Sorry for the delay, I didn't see the notification. Anyways, thanks for the patch, seems to work fine!
A commit references this bug: Author: asomers Date: Fri Mar 22 14:43:11 UTC 2019 New revision: 496572 URL: https://svnweb.freebsd.org/changeset/ports/496572 Log: devel/p4: fix the build with alternate OpenSSL implementations When setting DEFAULT_VERSIONS+=ssl=anything, p4 needs to use OPENSSLINC. PR: 236548 Reported by: Tassilo Philipp <tphilipp@potion-studios.com> MFH: 2019Q1 Changes: head/devel/p4/Makefile