How do I compile Tomcat mod_jk on a MacBook Pro M1 chip? - apache

I have Homebrew Apache installed and trying to connect Coldfusion Server 2016 with Tomcat mod_jk.
I downloaded the source code from https://tomcat.apache.org/download-connectors.cgi
I followed the directions to compile it, tried few different ways, but when I get to the "make" command, I keep getting the same error:
In file included from jk_ajp12_worker.c:26:
In file included from ./jk_ajp12_worker.h:26:
In file included from ./jk_logger.h:26:
In file included from ./jk_global.h:340:
./jk_types.h:56:2: error: Can not determine the proper size for pid_t
#error Can not determine the proper size for pid_t
^
./jk_types.h:62:2: error: Can not determine the proper size for pthread_t
#error Can not determine the proper size for pthread_t
^
2 errors generated.
make[1]: *** [jk_ajp12_worker.lo] Error 1
make: *** [all-recursive] Error 1
These are the different commands I've tried to compile:
./configure --with-apxs=/opt/homebrew/bin/apxs
./configure CFLAGS='-arch arm64e' APXSLDFLAGS='-arch arm64e' --with-apxs=/opt/homebrew/bin/apxs
./configure CFLAGS='-arch arm64e' APXSLDFLAGS='-arch arm64e' --with-apxs=/opt/homebrew/bin/apxs --host=arm
I recently got this new MacBook Pro 16" and migrated everything over from my 2017 MacBook Pro (Intel chip). I was running stock Apache with Coldfusion Server 2016, but when I tried to start up Apache on the new MacBook, it didn't like my mod_jk.so file and threw an error:
httpd: Syntax error on line 542 of /opt/homebrew/etc/httpd/httpd.conf: Syntax error on line 2 of /opt/homebrew/etc/httpd/mod_jk.conf:
Cannot load /Applications/ColdFusion2016/config/wsconfig/2/mod_jk.so into server: dlopen(/Applications/ColdFusion2016/config/wsconfig/2/mod_jk.so, 0x000A):
tried: '/Applications/ColdFusion2016/config/wsconfig/2/mod_jk.so'
(mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))
I appreciate any help or input. Thank you.

I've finally installed Apache2 with Tomcat on my M1 and it all works.
The one thing you must do is to install a fresh Apache from Macports or HomeBrew. This is because most old installations copied from your old mac to your new one will now be in the read-only part of your file system and SIP won't let you near them. You will find weird and wonderful workarounds (apachectl told me I had to codesign mod_jk.so for example and I wasted a lot of time doing it and in the end it was pointless) and you will attempt to get the old installation to work, but trust me it's not worth it.
You will need to compile a fresh jk_module (mod_jk.so). This is what I did:
Download latest connector https://dlcdn.apache.org/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.48-src.tar.gz, save the .gz and unzip it.
Change directory to the native folder.
run which apxs to tell you the path to apxs for the ./configure command
The path mine gave was: /opt/local/bin/apxs. Use it as the path in the ./configure command below.
The commands are as follows (actually don't bother running them yet because they will fail):
./configure --with-apxs=/opt/local/bin/apxs
make
However make will fail with:
./jk_types.h:56:2: error: Can not determine the proper size for pid_t
#error Can not determine the proper size for pid_t
^
./jk_types.h:62:2: error: Can not determine the proper size for pthread_t
#error Can not determine the proper size for pthread_t
^
2 errors generated.
make[1]: *** [jk_ajp12_worker.lo] Error 1
make: *** [all-recursive] Error 1
This is a problem for M1 macs that has been fixed. So for the moment we will abandon the 1.2.48 source and download the source with the fix.
But don't delete the 1.2.48 source because the fix source is missing a few files which you will copy straight over from the 1.2.48 source.
The page to download the fix for Mac OS is here: https://github.com/apache/tomcat-connectors, which is commit e719874 on Jun 30, 2021.
Click on the green 'Code' button and then on 'Download ZIP'.
Unzip the new source and cd to 'native'
Run the commands:
./configure --with-apxs=/opt/local/bin/apxs
make
And whenever it stops and complains that something is missing, find it in the 1.2.48 source and copy it over to the same position in the new source and try again. It will happen two or three times.
I got this error at one point:
/home/myuser/source/mod_auth_cas/mod_auth_cas/missing: line 81: aclocal-1.15: command not found
WARNING: 'aclocal-1.15' is missing on your system.
You should only need it if you modified 'acinclude.m4' or
'configure.ac' or m4 files included by 'configure.ac'.
The 'aclocal' program is part of the GNU Automake package:
<http://www.gnu.org/software/automake>
It also requires GNU Autoconf, GNU m4 and Perl in order to run:
<http://www.gnu.org/software/autoconf>
<http://www.gnu.org/software/m4/>
<http://www.perl.org/>
make: *** [aclocal.m4] Error 127
Then I read somewhere to run autoreconf -f -i (which fixed it).
When make finishes, find your nice new mod_jk.so file in the native/apache-2.0 folder and copy it to where all your other modules are. I have a Macports installation so Homebrew is probably different, but my modules are in /opt/local/lib/apache2/modules.
Don't forget to add the LoadModule line in httpd.conf if it isn't already there:
LoadModule jk_module /opt/local/lib/apache2/modules/mod_jk.so
You might have some trouble working out which apache2 folders contain the new install, and not an old installation - I found two other installations knocking about trying to confuse me.
My config is here: /opt/local/etc/apache2/httpd.conf
apachectl is very useful for configuration.
apachectl -t -D DUMP_INCLUDES will find all the configuration files it is using. This totally saved me because it showed me that my httpd.conf file, which I had copied from elsewhere, was still pointing via 'Include' commands at other old config files in the wrong place.
apachectl configtest will test your config for you and print out any mistakes it finds. It pointed at 4 modules that it didn't like so I just excluded them. Though obviously read the messages carefully and google if you are not sure why apachectl doesn't like something. If it replies 'Syntax OK' you are ready to go.
This is a mysterious message I got a lot until I worked out that it was because httpd.conf was pointing at the wrong modules folder (an old install of apache2) for each module, so it was loading stuff that presumably was not compiled for 64bit
httpd: Syntax error on line 76 of /opt/local/etc/apache2/httpd.conf:
Cannot load libexec/apache2/mod_authz_owner.so into server:
dlopen(/usr/libexec/apache2/mod_authz_owner.so, 0x000A): symbol not
found in flat namespace '_apr_stat$INODE64'
This is my launch command using the plist which Macports automatically created:
sudo launchctl load -w /opt/local/etc/LaunchDaemons/org.macports.apache2/org.macports.apache2.plist
And to unload:
sudo launchctl unload /opt/local/etc/LaunchDaemons/org.macports.apache2/org.macports.apache2.plist
run ps ax|grep httpd to see if it's running.
Logging: Don't forget to sudo to create the jk folder in /var/log/apache2 if it doesn't already exist, otherwise apache or tomcat will have mysterious problems or won't start or something (the /var/log/apache2/jk folder is needed for jk.log).
Another problem cropped up just as I thought I had it made: apache
was unable to write its pid file on startup. Again this was because the position set in my config for the pid file was from the configuration on my old mac, and the position chosen was in a read-only location.
To change this you need to set the PidFile parameter, which I found in the following file:
/opt/local/etc/apache2/extra/httpd-mpm.conf
and it looks like this:
# PidFile: The file in which the server should record its process
# identification number when it starts.
#
# Note that this is the default PidFile for most MPMs.
#
<IfModule !mpm_netware_module>
PidFile "local/run/apache2/httpd.pid"
</IfModule>
Don't worry about what the IfModule thing is doing, just set the PidFile to a writeable location, which as you can see is a relative path. You may be wondering what goes in front of the local folder.
What goes in front is the ServerRoot parameter set in httpd.conf:
ServerRoot "/usr"
So my pid will be written at /usr/local/run/apache2/httpd.pid. I had to create the run and apache2 folders.
That's about it. There are various logs that might indicate errors if you are stuck:
/var/log/apache2/error_log
And the jk.log for the apache/tomcat connector:
/var/log/apache2/jk/jk.log
And there's always the system log which just might tell you something:
/var/log/system.log
I hope very much that this helps someone. However it was very long and complicated and I have surely missed something that I did along the way, so if you come across some new problem I will see if I can help.

Running ColdFusion on a Mac is consistently a PITA. Doesn't matter if it's CF 9, 10, 11, all the way to current. Especially when you're dealing with a non-Intel based chipset. You are also trying to get an older and custom build of Toncat running on a chipset that likely isn't supported. You're also not the only one having this issue with CF 2016 on the M1 chip (they didn't find a solution either).
Try using CommandBox to run CF. It will download the server as a JAR file and run it on the Glassfish servlet container (IIRC). You won't need Apache either. It's really quite simple to get up and running.
https://commandbox.ortusbooks.com/embedded-server/multi-engine-support
Once you have it installed, go to your application's root folder in the CLI:
start cfengine=adobe#2016
It will download & install the server, then start the application.
Check the docs for more info.

Related

Redhat with httpd24 connecting to Informix using DBI

I'm at my wits' end on this. I have 2 RH7 boxes that I just installed httpd24 (v2.4.34) on. They were running httpd (v2.4.6) without any connection problems. Now when I try and run Perl scripts from the browser, they fail with...
install_driver(Informix) failed: Can't load '/usr/local/lib64/perl5/auto/DBD/Informix/Informix.so' for module DBD::Informix: libifsql.so: cannot open shared object file: No such file or directory at /usr/lib64/perl5/DynaLoader.pm line 190.
at (eval 5) line 3.
Compilation failed in require at (eval 5) line 3.
Perhaps a required shared library or dll isn't installed where expected
at /var/www/html/app/cgi-bin/test_informix_odbc.cgi line 35.
But when I run the same script from the command line, as 'apache', it runs just fine. All the ENV vars are set correctly.
Anyone run into anything similar before?
It would no longer use the LD_LIBRARY_PATH environment variable I was setting in httpd.conf.
Services are started in a fresh environment without any influence of user's environment (like environment variable values). As a consequence, information of all enabled collections will be lost during service start up.
Newer versions of httpd have stopped bringing the user environment in when the service is started. I found this little blurb in /opt/rh/httpd24/service-environment.
grep -r "LD_LIBRARY_PATH" /opt/rh/httpd24/
/opt/rh/httpd24/enable:export LD_LIBRARY_PATH=/opt/rh/httpd24/root/usr/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
I prepended the standard informix paths in /opt/rh/httpd24/enable.
export LD_LIBRARY_PATH=/opt/IBM/informix/lib:/opt/IBM/informix/lib/esql:/opt/rh/httpd24/root/usr/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
And everything is back to normal. Woohoo!

Unable to activate Curl on Easyphp Devserver 16.1.1

I am trying to activate curl on my Easyphp Devserver 16.1.1, but I keep getting the error:
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-binaries\php\php5619vc11x86x160615094909\ext\php_curl.dll' - Impossibile trovare il modulo specificato [cannot open shared object file: No such file or directory].\r\n in Unknown on line 0
I did the following:
un-commented "extension=php_curl.dll" in both php.ini files
verified that the file php_curl.dll actually exists in extension_dir
copied libeay32.dll, libsasl.dll, ssleay32.dll to c:\Windows\System\, c:\Windows\System32\, c:\Windows\SysWOW64\
Downloaded cacert.pem from http://curl.haxx.se/ca/cacert.pem and added the full path to it on curl.cainfo in php.ini
Downloading various versions of curl from https://curl.haxx.se
Set paths to php directories in My Computer > Properties > Advanced > Environment Variables (eg: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-binaries\php\php5619vc11x86x160615094909\)
I rebooted after doing all these steps (specially for the step #6)
There are at least 5 similar questions, I followed every suggestion but nothing worked. Apache continues not to see my dll. Can anybody help on this issue?
Old topic but for people who land here and want skip all of the useless steps of Lucian.
Just use the answer from Anar Haziyev on this link:
Activation Curl on EasyPHP
work on easyphp devserver.
I faced the same issue with EasyPHP and what it fixed is that I had to install PHP as a different instance, not in the EasyPHP build and started the PHP service from the command line.

Apache httpd server on windows won't start

I installed Apache on Windows7 through a bitnami install package for trac. As a final installation step the installer tried to start the Apache httpd service and threw up an error that starting the https service failed.
I found out why when I tried to start httpd from command prompt and got this error:
AH00526: Syntax error on line 564 of F:/Bitnami/trac-1.0.9-0/apache2/conf/httpd.conf:
SetEnv takes 1-2 arguments, an environment variable name and optional value to pass to CGI.
Here is the offending line:
SetEnv PATH "${PATH};F:/Bitnami/trac-1.0.9-0/apache2/bin;"
I changed it to this:
SetEnv PATH "F:/Bitnami/trac-1.0.9-0/apache2/bin;"
and the service started.
My questions are:
1) What is the syntax/language used in the httpd.conf file?
2) How would one have to change that line to make it compile and preserve the original intent of appending F:/Bitnami/trac-1.0.9-0/apache2/bin to the environment variable PATH?
3) Assuming this works on some platforms why would it not work on Windows?
Thanks.
Update
Like the responses say the issue was with PATH. However the fact that there are spaces in the paths doesn't appear to be the issue. Not only that I isolated the path in PATH that was causing the problem. It was this "C:\tools\mkstools", exactly like that. I got rid of the quotes and that enabled httpd to start. So I'm still scratching my head. Why would the quotes cause the problem?
For me, it worked by replacing ${PATH} with %PATH%.

httpd.config error when insntalling mod_wsgi+django

its been more than 2 weeks. i try to instal but still getting error.
firstly, indeed I have searched similar error but i didn't find solution at all. if you find it. please let me know.
second, this is my state :
1. i have installed python 2.7 and django 1.5.1 (it works).
2. i also install MAMP.
3. i try to configure mod_wsgi and want it integrated with my MAMP apache server.
4. using mac mountain lion 10.8.4
my configuration file :
/etc/apache2/original/extra/httpd-userdir.conf inside my apache2/original/extra/
/etc/apache2/users/akhyar.conf pastebin.com/zcY58WTV (sorry about this Iam new on stack overflow)
/etc/apache2/httpd.conf pastebin.com/je2D8zMz
third, this is my error :
when i run apachectl configtest this error appears my error
so, what is going on actually? can someone tell me why and show me the mistakes?
if its been solved, what is the next step for configuring mod_wsgi on my MAMP?
thanks before, any help are highly appreciated.
In this file, line 15, you're including the per-user conf files:
http://pastebin.com/7y7ibuqP
On line 473 of this one, one of those per-user conf files, you're including the above file again:
http://pastebin.com/zcY58WTV
This causes infinite recursion while trying to parse the conf files.
I think there are some other errors too, and to be honest the files are pretty messy, but the best way forward is to remove all Include directives from akhyar.conf. For the most part they're already duplicates, where they're not, inline the contents of those files instead of using Include. If there are other errors, you'll at least see useful line numbers to start tracking them down.
Also note that the [warn] lines are just warnings - which you should probably fix, but the server will still run without them, that's not what's causing the error.

Get Error while building libav on windows using minGW and MSYS

I have a trouble with libav.
I used MinGW and MSYS to build libav on windows. However, When I use "make", after some file(.o file) were build i get error,
It is
$ make
AR libavcodec/libavcodec.a C:\msys\mingw\bin\ar.exe: libavcodec/: Permission denied
make: *** [libavcodec/libavcodec.a] Error 1
After that, I view the permission of libavcodec folder, I have all permission. :|
Please help me solve this trouble or give me a full instruction to build libav on windows (I use win7 x64 and have msys, mingw)
Thanks!!!
I'm not sure if this is relevant, but I had the same error when trying to make ffmpeg. Initially I was getting a missing separator error (in one of the makefiles) when I used configure. I found a page that suggested checking that git was using unix line endings rather than windows (CR LF). So I used
git config --global core.autocrlf false
to set git to use unix line endings and then thought I'd updated my source (being new to git, it turned out I hadn't). I still got the missing separator error, so I added a tab to the start of the line and configure completed. I then used make and would get the same error you're getting. I saw in some of the other makefiles that they still had windows line endings, so I deleted the entire directory apart from the .git folder as mentioned here, and then used
git reset --hard
to get the files again. After this configure and make worked without error, so my guess would be that you're using windows line endings or there's something wrong with the makefiles.