apache2nginx icon indicating copy to clipboard operation
apache2nginx copied to clipboard

Segmentation fault (core dumped)

Open cfranks opened this issue 10 years ago • 17 comments

Segmentation fault (core dumped) when running apache2nginx -f /var/apache2/conf/httpd.conf

cfranks avatar May 02 '14 15:05 cfranks

+1 Running Mac OS X Mavericks. From what I have been reading. It would appear that the program has a bug in it. I had to compile and run it the my local hardware. I am unsure if my machine's hardware is the root of the issue or the source code itself.

avelis avatar May 11 '14 06:05 avelis

Ok. Upon further investigation I was able to get this tool to work. The caveat is that it has to run on a Ubuntu server or unix server. Even then I still have to compile from source and install it in /usr/local/apache2nginx as per the project page documentation. As a Mac OS X user, without a Ubuntu server ready, I had to leverage a local virtual Ubuntu server via Vagrant to convert my apache configurations. I know this isn't a solution to the problem above, but an alternative for others who might land here.

tl;dr

  1. Use Vagrant to create an Ubuntu server.
  2. Sync your Apache confs that you want to convert onto that same server.
  3. Install apache2nginx via source (Main project page provides docs to do this).
  4. Use apache2nginx to convert your confs to be nginx compliant.

avelis avatar May 13 '14 01:05 avelis

Tried on a Majaro system and got a core dump. What does ubuntu have that is missing in manjaro?

rays avatar Jan 22 '18 21:01 rays

also getting segfault on ubuntu

gaby64 avatar Oct 15 '18 20:10 gaby64

It indeed segfaults:

#0 0x00007fa44ab51676 in strlen () from /lib/x86_64-linux-gnu/libc.so.6 #1 0x000055c4c2575a27 in apr_pstrdup (a=a@entry=0x55c4c4272128, s=0xffffffffc42728e8 <error: Cannot access memory at address 0xffffffffc42728e8>) at strings/apr_strings.c:77 #2 0x000055c4c257a1e8 in apr_get_basedir (resolved_dir=0x7ffcf5f27ee0, filename=, p=0x55c4c4272128) at file_io/unix/filepath.c:349 #3 0x000055c4c24d1f5d in main (argc=, argv=) at main.c:304

ghost avatar Dec 03 '18 12:12 ghost

I have a fork that works, updated apr and included Reeds mods

https://github.com/gaby64/apache2nginx

gaby64 avatar Dec 06 '18 15:12 gaby64

I have a fork that works, updated apr and included Reeds mods

@gaby64 even using your repo, I kept getting libtool generated with CRLF issues (^M). Running a recursive dos2unix -f got me a fixed libtool, and consequently a proper configure stage.

However, the end result is a compiled and working binary. Thanks!

virgilwashere avatar Jan 17 '19 00:01 virgilwashere

I have a fork that works, updated apr and included Reeds mods

@gaby64 even using your repo, I kept getting libtool generated with CRLF issues (^M). Running a recursive dos2unix -f got me a fixed libtool, and consequently a proper configure stage.

However, the end result is a compiled and working binary. Thanks!

that might be an issue with your git config, I cloned my repo an had no issue on Ubuntu 18.10

running file -- * shows no file with crlf endings

gaby64 avatar Jan 17 '19 13:01 gaby64

This is Sooo broken.

(gdb) run -f 2.conf Starting program: apache2nginx -f 2.conf [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault. __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:93 93 ../sysdeps/x86_64/multiarch/strlen-avx2.S: No such file or directory. (gdb) bt #0 __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:93 #1 0x0000555555634a97 in apr_pstrdup (a=a@entry=0x5555556b1378, s=0x556b1b38 <error: Cannot access memory at address 0x556b1b38>) at strings/apr_strings.c:77 #2 0x0000555555639097 in apr_get_basedir (resolved_dir=0x7fffffffe0a0, filename=, p=0x5555556b1378) at file_io/unix/filepath.c:349 #3 0x000055555558f417 in main (argc=, argv=) at main.c:304

Seegras avatar Jan 23 '19 10:01 Seegras

Was wishing this would work, tried everything that was commented here, was able to compile and run on ubuntu, but also got Seg Fault. Might need to write my own in java, stay tuned.

dorbsz avatar Mar 26 '19 01:03 dorbsz

I have a fork that works, updated apr and included Reeds mods

https://github.com/gaby64/apache2nginx

Hi gaby64 -- How can I build your solution? The READ.ME file on your fork is identical to the original -- so the the same files will be compiled.

Thank you

steelliberty avatar Nov 03 '19 16:11 steelliberty

download source files from my fork ./configure make && make install

gaby64 avatar Nov 03 '19 18:11 gaby64

download source files from my fork ./configure make && make install

Thank you for the help .. making progress -- I am now getting the error message

bin/bash /tmp/apache2nginx/srclib/apr/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I/tmp/apache2nginx/srclib/apr-util/include -I/tmp/apache2nginx/srclib/apr-util/include/private -I/tmp/apache2nginx/srclib/apr/include -o xml/apr_xml.lo -c xml/apr_xml.c && touch xml/apr_xml.lo xml/apr_xml.c:35:10: fatal error: expat.h: No such file or directory #include <expat.h> ^~~~~~~~~ compilation terminated.

steelliberty avatar Nov 03 '19 19:11 steelliberty

run buildconf

gaby64 avatar Nov 03 '19 20:11 gaby64

run buildconf

Okay .. I had to install libtool and buildconf ran without errors .. then I did ./configure make && make install

resulting in this error

/bin/bash /tmp/apache2nginx/srclib/apr/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I/tmp/apache2nginx/srclib/apr-util/include -I/tmp/apache2nginx/srclib/apr-util/include/private -I/tmp/apache2nginx/srclib/apr/include -o xml/apr_xml.lo -c xml/apr_xml.c && touch xml/apr_xml.lo xml/apr_xml.c:35:10: fatal error: expat.h: No such file or directory #include <expat.h> ^~~~~~~~~ compilation terminated. /tmp/apache2nginx/srclib/apr-util/build/rules.mk:206: recipe for target 'xml/apr_xml.lo' failed make[3]: *** [xml/apr_xml.lo] Error 1 make[3]: Leaving directory '/tmp/apache2nginx/srclib/apr-util' /tmp/apache2nginx/srclib/apr-util/build/rules.mk:118: recipe for target 'all-recursive' failed make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory '/tmp/apache2nginx/srclib/apr-util' /tmp/apache2nginx/build/rules.mk:72: recipe for target 'all-recursive' failed make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory '/tmp/apache2nginx/srclib' /tmp/apache2nginx/build/rules.mk:72: recipe for target 'all-recursive' failed make: *** [all-recursive] Error 1

steelliberty avatar Nov 03 '19 22:11 steelliberty

install expat lib or package for your distro

please do the research, I only intended to provide patched code that worked for me, not compile support. it may not even work anymore, I could check tomorrow.

gaby64 avatar Nov 03 '19 22:11 gaby64

I got it running ... the config files of the latest apache2 server is largely unconvertable, numerous messages in the new conf file . Worse yet the .htaccess files in word press site can be enormous which presents a new conversion issue.

I am sorry for the intrusion and thank you for your help.

I am going to start from scratch --

On Sun, Nov 3, 2019 at 5:45 PM gaby64 [email protected] wrote:

install expat lib or package for your distro

please do the research, I only intended to provide patched code that worked for me, not compile support. it may not even work anymore, I could check tomorrow.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lide-reed/apache2nginx/issues/3?email_source=notifications&email_token=ABHAO5V54IUS7NLHCSQSS7LQR5A6HA5CNFSM4AO56IRKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEC564HY#issuecomment-549187103, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHAO5VJP3QOVLRHSPEGKDLQR5A6HANCNFSM4AO56IRA .

steelliberty avatar Nov 04 '19 12:11 steelliberty