using homebrew apxs from homebrew apache httpd24 fails with libtool: compile: unable to infer tagged configuration - apache

using homebrew apxs from homebrew apache httpd24 fails with libtool: compile: unable to infer tagged configuration
$ apxs -i -c -Wc,"-arch x86_64" -Wl,"-arch x86_64 " mod_uwsgi.c
/usr/share/apr-1/build-1/libtool --silent --mode=compile cc -prefer-pic -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -I/usr/local/Cellar/httpd24/2.4.3/include/apache2 -I/usr/include/apr-1 -I/usr/include/apr-1 -arch x86_64 -c -o mod_uwsgi.lo mod_uwsgi.c && touch mod_uwsgi.slo
libtool: compile: unable to infer tagged configuration
libtool: compile: specify a tag with `--tag'
apxs:Error: Command failed with rc=65536
.
What environment must I export to have libtool not complain about tag?

after digging through the source I found that if LTFLAGS is set to --tag=cc things work.
$ LTFLAGS=--tag=cc apxs -i -c mod_uwsgi.c

Related

Apache httpd compile (make) error. How to fix it?

I get an error when compiling (configure) Apache httpd. Please tell me how to solve it.
Error message
$ git clone -b 2.2.3 --single-branch https://github.com/apache/httpd.git
$ cd httpd
$ autoconf
$ ./configure
configure: error: cannot find required auxiliary files: config.guess config.sub
My environment
$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
$ autoconf -V
autoconf (GNU Autoconf) 2.71
Update 1
The "configure" problem has probably been solved. (I stopped using github). However, an error occurs during make.
"make" error message
$ wget https://archive.apache.org/dist/httpd/httpd-2.2.3.tar.gz
$ gzip -d httpd-2.2.3.tar.gz
$ tar xvf httpd-2.2.3.tar
$ cd httpd-2.2.3
$ ./configure --prefix /home/ubuntu/local
$ make
/usr/bin/ld: .libs/htpasswd.o: undefined reference to symbol 'crypt##XCRYPT_2.0'
/usr/bin/ld: /lib/x86_64-linux-gnu/libcrypt.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:39: htpasswd] Error 1
make[2]: Leaving directory '/home/ubuntu/httpd-2.2.3/support'
make[1]: *** [/home/ubuntu/httpd-2.2.3/build/rules.mk:72: all-recursive] Error 1
make[1]: Leaving directory '/home/ubuntu/httpd-2.2.3/support'
make: *** [/home/ubuntu/httpd-2.2.3/build/rules.mk:72: all-recursive] Error 1
Installed modules
sudo apt-get install libapr1-dev libaprutil1-dev
sudo apt-get install build-essential
sudo apt-get install libpcre3-dev
Try this:
wget http://archive.apache.org/dist/httpd/httpd-2.2.3.tar.gz
tar -xf httpd-2.2.3.tar.gz
sudo ./configure --prefix=/opt/httpd --with-included-apr --with-ssl=/opt/openssl-1.0.1i --enable-ssl-staticlib-deps --enable-mods-static=ssl
sudo make
sudo make install

How to compile apache2 own module in dockerfile?

I want to compile my own Apache module when building my image, so i wrote the following Dockerfile.
FROM httpd:2.4.25
COPY conf/httpd.conf /usr/local/apache2/conf/httpd.conf
COPY modules/mod_example.c /usr/local/apache2/modules/mod_example.c
RUN apxs -i -a -c modules/mod_example.c
EXPOSE 80
But i get an error :
/usr/share/apr-1.0/build/libtool --silent --mode=compile x86_64-linux-gnu-gcc -std=gnu99 -prefer-pic -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/local/apache2/include -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include -c -o mod_example.lo mod_example.c && touch mod_example.slo
/usr/share/apr-1.0/build/libtool: line 1114: x86_64-linux-gnu-gcc: command not found
apxs:Error: Command failed with rc=65536
I tried apt-get install gcc or libtool it say it's unable to locate the package.
My goal is to compile the ".c" file in a ".so" file.
Installing gcc, or the build-deps of say libapr1, is all that's needed. You probably just have a problem with your unspecified attempt at adding the compiler from your dockerfile.
For referene, here's how the httpd layer adds the compiler:
https://github.com/docker-library/httpd/blob/master/2.4/Dockerfile
I needed to do an apt-get update then :
apt-get install build-essential libtool
Since the docker image is a prod image, it doesn't contain dev tools.

How to setup crosstool-ng with wxwidgets

I want to setup the ct-ng for my gui application and now I want to use wxwidgets.
For setting up the crosstool, I have used:
# Install prerequisites:
apt-get -y install gcc gperf bison flex gawk libtool automake libncurses5-dev texinfo
# Setup toolchain
# instructions from https://github.com/crosstool-ng/crosstool-ng
cd toolchain/crosstool-ng
./bootstrap
./configure --prefix=$HOME/.local
make && make install
echo -ne "\n\nif [ -d \"$HOME/.local/bin\" ]; then\n PATH=\"$HOME/.local/bin:$PATH\"\nfi" >> ~/.profile
source ~/.profile
mkdir ../tc/
cd ../tc/
ct-ng list-samples
ct-ng x86_64-w64-mingw32
ct-ng build # lasts 30 minutes...
##################### WxWidgets ######################
cd ../wxWidgets/
sh autogen.sh
./configure --prefix="$HOME/prefix" --enable-static --disable-shared --build=x86_64-w64-mingw32 --enable-unicode --without-libtiff --without-libjpeg --with-expat=builtin --with-libpng=builtin
make
The only way I have found is to clone wxwidgets from github and compile it as above in the script. Then, I included as path -I
WXWIDGET=../toolchain/wxWidgets/include/
$(CXX) -I$(FLEX) -I$(WXWIDGET) $(WXWIDGETSFLAGS) $(CPPFLAGS) $(header) $(src) $(obj3) -o $(OUTPUT)/$(bin)
Hundreds of errors appearing while compiling:
In file included from ../toolchain/wxWidgets/include/wx/platform.h:485:0,
from ../toolchain/wxWidgets/include/wx/defs.h:20,
from ../toolchain/wxWidgets/include/wx/string.h:24,
from ../toolchain/wxWidgets/include/wx/artprov.h:14,
from parser/include/gui.h:17,
from parser/include/customdialogs.h:17:
../toolchain/wxWidgets/include/wx/chkconf.h:282:9: error: #error "wxUSE_SECRETSTORE must be defined, please read comment near the top of this file."
# error "wxUSE_SECRETSTORE must be defined, please read comment near the top of this file."
What should I do?
You need to try "--host" and "--target" configure options.
Just try "../configure --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --disable-shared --enable-unicode".
BTW, "--enable-unicode" should be turned on by default. So you can drop it.
Also, if you software required C++11, you should compile the library as:
CXXFLAGS="-std=c++11" ../configure --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --disable-shared --enable-unicode

Undefined symbol when loading Apache2 mod_xml2enc

I am so frustrated installing reverse-proxy-related modules to Apache2 HTTP server on a CentOS 5 box. Since it's an old version of Apache2 server, I had to compile the modules from source using Apache tool 'apxs'. I got no warnings or errors installing the module by 'apxs' but got runtime error when trying to restart the Apache server.
Starting httpd: httpd: Syntax error on line 206 of /etc/httpd/conf/httpd.conf: Cannot load /usr/lib64/httpd/modules/mod_xml2enc.so into server: /usr/lib64/httpd/modules/mod_xml2enc.so: undefined symbol: xmlDetectCharEncoding
[FAILED]
The following are more details.
OS: CentOS 5.11; Linux 2.6.18-400.1.1.el5 #1 SMP Thu Dec 18 00:59:53 EST 2014 x86_64 x86_64 x86_64 GNU/Linux
Apache: version 2.2.3
For historical reason, I cannot upgrade either of them to newer version to fix the issue.
The OS was originally lack of libxml2, which I installed by yum successfully with no issue. I downloaded the source files of mod_proxy_html including 1) mod_xml2enc.c, 2) mod_proxy_html.h and 3) mod_proxy_html.c
I used the following commands to at first install mod_xml2enc and then mod_proxy_html.
apxs -i -a -c -I /usr/include/libxml2/ mod_xml2enc.c
apxs -i -a -c -I /usr/include/libxml2/ -I ./ mod_proxy_html.c
Both seemed OK and showed some output like the following:
/usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/httpd -I/usr/include/apr-1 -I/usr/include/apr-1 -I/usr/include/libxml2/ -c -o mod_xml2enc.lo mod_xml2enc.c && touch mod_xml2enc.slo
/usr/lib64/apr-1/build/libtool --silent --mode=link gcc -o mod_xml2enc.la -rpath /usr/lib64/httpd/modules -module -avoid-version mod_xml2enc.lo
/usr/lib64/httpd/build/instdso.sh SH_LIBTOOL='/usr/lib64/apr-1/build/libtool' mod_xml2enc.la /usr/lib64/httpd/modules
/usr/lib64/apr-1/build/libtool --mode=install cp mod_xml2enc.la /usr/lib64/httpd/modules/
cp .libs/mod_xml2enc.so /usr/lib64/httpd/modules/mod_xml2enc.so
cp .libs/mod_xml2enc.lai /usr/lib64/httpd/modules/mod_xml2enc.la
cp .libs/mod_xml2enc.a /usr/lib64/httpd/modules/mod_xml2enc.a
chmod 644 /usr/lib64/httpd/modules/mod_xml2enc.a
ranlib /usr/lib64/httpd/modules/mod_xml2enc.a
PATH="$PATH:/sbin" ldconfig -n /usr/lib64/httpd/modules
----------------------------------------------------------------------
Libraries have been installed in:
/usr/lib64/httpd/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
chmod 755 /usr/lib64/httpd/modules/mod_xml2enc.so
[activating module `xml2enc' in /etc/httpd/conf/httpd.conf]
However, when I tried to restart the server, the error message I put at the top was raised.
I've tried many ways to fix this issue, however, nothing worked. Maybe it's worth noting that I took the exact steps installing the same modules on a CentOS 5.11 32bit machine and got no problem at all. The only difference between these two machines is just one is 32-bit and the other is 64-bit.
Hope someone would know how to fix this issue.
Thanks a lot in advance.
I found the solution to this issue on my own. It is a stupid one. I forgot to load the libxml2 to the Apache server. After I added LoadFile /usr/lib64/libxml2.so, the error was gone.

Simple Hello World in Objective-C with clang and gnustep does not compile

System:
64bit Ubuntu Lucid
GNUStep
clang/LLVM
test.m
#import <Foundation/Foundation.h>
int main(int argc, char * argv[]){
NSLog(#"Hello world!\n");
return 0;
}
compile command line:
clang -fobjc-gc -I /usr/lib/gcc/x86_64-linux-gnu/4.4.3/include -I /usr/include/GNUstep/ -I /usr/lib/gcc/x86_64-linux-gnu/4.4.3/include-fixed/ -L /usr/lib/GNUstep/ -L /usr/lib64/ -fconstant-string-class=NSConstantString -rpath /usr/lib64 -Xlinker -lgnustep-base test.m -o Test
error:
/usr/bin/ld: /usr/lib64//libgnustep-base.so: undefined reference to symbol '__objc_exec_class'
/usr/bin/ld: note: '__objc_exec_class' is defined in DSO /usr/lib64/libobjc.so.2 so try adding it to the linker command line
/usr/lib64/libobjc.so.2: could not read symbols: Invalid operation
clang: error: linker command failed with exit code 1 (use -v to see invocation)
While using GCC, it compiles fine, but clang does not.
On a fresh install of Ubuntu 12.10 I installed the following packages:
$ sudo apt-get install build-essential
$ sudo apt-get install clang
$ sudo apt-get install gnustep
$ sudo apt-get install gnustep-make
$ sudo apt-get install gnustep-devel
$ sudo ln -s /usr/lib/gcc/i686-linux-gnu/4.7/include/objc /usr/local/include/objc
(the final symlink is required to properly locate the objc.h header)
Then I compiled the test.m file as follows:
$ clang -o test test.m -I `gnustep-config --variable=GNUSTEP_SYSTEM_HEADERS` \
-L `gnustep-config --variable=GNUSTEP_SYSTEM_LIBRARIES` \
-lgnustep-base -fconstant-string-class=NSConstantString \
-D_NATIVE_OBJC_EXCEPTIONS \
-lobjc
tux#ubuntu:~/Desktop$ ./test
2012-11-20 11:02:08.184 test[11856] Hello world!
* EDIT
On a fresh 10.04-64bit this allows to compile just fine:
$ sudo apt-get install build-essential
$ sudo apt-get install clang
$ sudo apt-get install gnustep-devel
$ sudo ln -s /usr/lib/gcc/x86_64-linux-gnu/4.4.3/include/objc/ /usr/local/include/objc