Bug 196770 - www/chromium does not run if built with DEBUG option
Summary: www/chromium does not run if built with DEBUG option
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-chromium (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-15 17:18 UTC by Rodolpho Eckhardt
Modified: 2018-08-18 15:48 UTC (History)
6 users (show)

See Also:
bugzilla: maintainer-feedback? (chromium)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rodolpho Eckhardt 2015-01-15 17:18:39 UTC
If www/chromium is built with the DEBUG option, the result is an executable which does not work:

$ chrome
/usr/local/bin/chrome: /usr/local/share/chromium/chrome: Exec format error

$ file /usr/local/share/chromium/chrome
/usr/local/share/chromium/chrome: data

$ hd /usr/local/share/chromium/chrome
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*


I found some previous references to this issue, but the solution was just to avoid building with the debug option:

http://freebsd.1045724.n5.nabble.com/chromium-37-up-for-testing-and-polishing-td5941131i20.html#a5943220
http://permalink.gmane.org/gmane.os.freebsd.devel.ports/120227

Thanks!
Comment 1 Bugzilla Automation freebsd_committer freebsd_triage 2015-01-15 17:18:39 UTC
Auto-assigned to maintainer chromium@FreeBSD.org
Comment 2 Ed Maste freebsd_committer freebsd_triage 2015-06-14 03:34:17 UTC
I wasn't able to reproduce this on stable/10, Chromium 43.0.2357.81.
Comment 3 Tony Narlock 2015-06-17 05:54:21 UTC
This is a serious issue. bug #200601 is blocked by this.

AFAIK, chrome settings is broken and not being able to get out a debug build prevents us from maintaining chromium, period.

If anyone here  has more information to provide, put it here.
Comment 4 Tony Narlock 2015-06-19 13:53:49 UTC
https://reviews.freebsd.org/D2726
http://svnweb.freebsd.org/ports?view=revision&revision=389756 - Here is the revision that allows DEBUG again

The old revisions claimed there was an "empty binary".

Was that confirmed, or inferred by the "Exec format error" message?  Googling that  suggests a file that may be empty, however, the binary I have produced is in the hundreds of megabytes.

Ed Maste: I'm on 10.1 release.  Would having the latest 10/stable make a difference perhaps?
Comment 5 Ed Maste freebsd_committer freebsd_triage 2015-06-19 14:12:06 UTC
(In reply to Tony Narlock from comment #4)

> The old revisions claimed there was an "empty binary".
>
> Was that confirmed,

Well, the initial report shows all 0s for hd /usr/local/share/chromium/chrome. I wouldn't call that an "empty binary," but others might?

In any case, I'm interested in reports of either reproducing a megabytes-of-zeroes binary, or of building a debug chrome binary that fails to run (with kern.maxtsiz increased).

I can't reproduce either case, and have added the backtrace that I obtained to bug #200601. I haven't had any time to look at it, though.
Comment 6 Tony Narlock 2015-07-24 18:02:36 UTC
(In reply to Ed Maste from comment #5)
Forgive me, but https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=200617 is lost on me. I'm not experienced enough at this stage to understand what's going on there.

This seems to be the error I'm having.  Does this issue has the fix / workaround I could use?

I'm using 10.1 RELEASE. I could upgrade to stable.
Comment 7 pete 2015-07-24 18:24:34 UTC
(In reply to Tony Narlock from comment #6)
Hey there - this may be helpful for you.  This is the method I currently use to generate a chromium build with debug symbols useable by gdb.  n.b. - enabling DEBUG in make config does not work (as I think you already know).  The following method should work though:

> uname -ar
FreeBSD pop.rubicorp.com 10.1-RELEASE-p10 FreeBSD 10.1-RELEASE-p10 #0: Wed May 13 06:54:13 UTC 2015     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

> cd /usr/ports/www/chromium
> sudo make WITH_DEBUG=yes STRIP=

I let this chug along for a day or so on my 8 core box, then I can run chromium via gdb like so:
> work/stage/usr/local/share/chromium/chrome-wrapper --gdb

I do not do the "make install" step as I still need to have a non-debug version on my system.
Comment 8 Tony Narlock 2015-07-24 23:20:21 UTC
(In reply to pete from comment #7)
Thank you for the prompt reply!

$ uname -ar
FreeBSD z600 10.1-RELEASE-p14 FreeBSD 10.1-RELEASE-p14 #14: Tue Jul 14 14:26:13 CDT 2015     root@z600:/usr/obj/usr/src/sys/MYKERNEL  amd64

Is there anything special in your /etc/make.conf? Here is mine:

WITH_MODULES = kernel zfs opensolaris geom_eli crypto geom_mirror snd_driver snd_ich snd_hea aio coretemp tmpfs aesni if_urtwn linux ums uhid linprocfs

.if (!empty(.CURDIR:M/usr/src*) || !empty(.CURDIR:M/usr/obj*))
.if !defined(NOCCACHE) && exists(%%PREFIX%%/%%CCLINKDIR%%/world/cc)
CC:=${CC:C,^cc,%%PREFIX%%/%%CCLINKDIR%%/world/cc,1}
CXX:=${CXX:C,^c\+\+,%%PREFIX%%/%%CCLINKDIR%%/world/c++,1}
CPP:=${CXX:C,^c\+\+,%%PREFIX%%/%%CCLINKDIR%%/world/cpp,1}
.endif
.endif

DEVELOPER=yes


Here is what I get:

===>  Staging for chromium-43.0.2357.134                                                                                                                                                                                                                                                                                                                                   
===>   chromium-43.0.2357.134 depends on file: /usr/local/lib/alsa-lib/libasound_module_pcm_oss.so - found                                                                                                                                                                                                                                                                 
===>   chromium-43.0.2357.134 depends on package: droid-fonts-ttf>0 - found                                                                                                                                                                                                                                                                                                
===>   chromium-43.0.2357.134 depends on executable: xdg-open - found                                                                                                                                                                                                                                                                                                      
===>   chromium-43.0.2357.134 depends on executable: update-desktop-database - found                                                                                                                                                                                                                                                                                       
===>   chromium-43.0.2357.134 depends on file: /usr/local/libdata/pkgconfig/x11.pc - found                                                                                                                                                                                                                                                                                 
===>   chromium-43.0.2357.134 depends on file: /usr/local/libdata/pkgconfig/xproto.pc - found                                                                                                                                                                                                                                                                              
===>   chromium-43.0.2357.134 depends on file: /usr/local/libdata/pkgconfig/xscrnsaver.pc - found                                                                                                                                                                                                                                                                          
===>   chromium-43.0.2357.134 depends on file: /usr/local/libdata/pkgconfig/xtst.pc - found                                                                                                                                                                                                                                                                                
===>   chromium-43.0.2357.134 depends on executable: gtk-update-icon-cache - found                                                                                                                                                                                                                                                                                         
===>   Generating temporary packing list                                                                                                                                                                                                                                                                                                                                   
install  -m 444 /usr/ports/www/chromium/work/chromium-43.0.2357.134/out/Release/chrome.1 /usr/ports/www/chromium/work/stage/usr/local/man/man1                                                                                                                                                                                                                             
install  -m 0644 /usr/ports/www/chromium/work/chromium-43.0.2357.134/chrome/app/theme/chromium/product_logo_22.png  /usr/ports/www/chromium/work/stage/usr/local/share/icons/hicolor/22x22/apps/chrome.png                                                                                                                                                                 
install  -m 0644 /usr/ports/www/chromium/work/chromium-43.0.2357.134/chrome/app/theme/chromium/product_logo_24.png  /usr/ports/www/chromium/work/stage/usr/local/share/icons/hicolor/24x24/apps/chrome.png                                                                                                                                                                 
install  -m 0644 /usr/ports/www/chromium/work/chromium-43.0.2357.134/chrome/app/theme/chromium/product_logo_48.png  /usr/ports/www/chromium/work/stage/usr/local/share/icons/hicolor/48x48/apps/chrome.png                                                                                                                                                                 
install  -m 0644 /usr/ports/www/chromium/work/chromium-43.0.2357.134/chrome/app/theme/chromium/product_logo_64.png  /usr/ports/www/chromium/work/stage/usr/local/share/icons/hicolor/64x64/apps/chrome.png                                                                                                                                                                 
install  -m 0644 /usr/ports/www/chromium/work/chromium-43.0.2357.134/chrome/app/theme/chromium/product_logo_128.png  /usr/ports/www/chromium/work/stage/usr/local/share/icons/hicolor/128x128/apps/chrome.png                                                                                                                                                              
install  -m 0644 /usr/ports/www/chromium/work/chromium-43.0.2357.134/chrome/app/theme/chromium/product_logo_256.png  /usr/ports/www/chromium/work/stage/usr/local/share/icons/hicolor/256x256/apps/chrome.png                                                                                                                                                              
install  -m 555 /usr/ports/www/chromium/work/chromium-43.0.2357.134/chrome/tools/build/linux/chrome-wrapper  /usr/ports/www/chromium/work/stage/usr/local/share/chromium                                                                                                                                                                                                   
install  -m 0644 /usr/ports/www/chromium/work/chromium-43.0.2357.134/out/Release/chrome_100_percent.pak  /usr/ports/www/chromium/work/stage/usr/local/share/chromium                                                                                                                                                                                                       
install  -m 0644 /usr/ports/www/chromium/work/chromium-43.0.2357.134/out/Release/content_resources.pak  /usr/ports/www/chromium/work/stage/usr/local/share/chromium                                                                                                                                                                                                        
install  -m 0644 /usr/ports/www/chromium/work/chromium-43.0.2357.134/out/Release/keyboard_resources.pak  /usr/ports/www/chromium/work/stage/usr/local/share/chromium                                                                                                                                                                                                       
install  -m 0644 /usr/ports/www/chromium/work/chromium-43.0.2357.134/out/Release/resources.pak  /usr/ports/www/chromium/work/stage/usr/local/share/chromium                                                                                                                                                                                                                
install   -m 555 /usr/ports/www/chromium/work/chromium-43.0.2357.134/out/Release/chrome  /usr/ports/www/chromium/work/stage/usr/local/share/chromium                                                                                                                                                                                                                       
install   -m 444 /usr/ports/www/chromium/work/chromium-43.0.2357.134/out/Release/libffmpegsumo.so  /usr/ports/www/chromium/work/stage/usr/local/share/chromium                                                                                                                                                                                                             
cd /usr/ports/www/chromium/work/chromium-43.0.2357.134/out/Release &&  /bin/sh -c '(/usr/bin/find -d $0 $2 | /usr/bin/cpio -dumpl $1 >/dev/null  2>&1) &&  /usr/bin/find -d $0 $2 -type d -exec chmod 755 $1/{} \; &&  /usr/bin/find -d $0 $2 -type f -exec chmod 444 $1/{} \;' -- "locales resources" /usr/ports/www/chromium/work/stage/usr/local/share/chromium         
install  -m 0644 /usr/ports/www/chromium/work/chromium-browser.desktop  /usr/ports/www/chromium/work/stage/usr/local/share/applications                                                                                                                                                                                                                                    
install  -m 555 /usr/ports/www/chromium/work/chrome /usr/ports/www/chromium/work/stage/usr/local/bin                                                                                                                                                                                                                                                                       
install   -m 555 /usr/ports/www/chromium/work/chromium-43.0.2357.134/out/Release/mksnapshot  /usr/ports/www/chromium/work/stage/usr/local/share/chromium/mksnapshot                                                                                                                                                                                                        
====> Compressing man pages (compress-man)                                                                                                                                                                                                                                                                                                                                 
====> Running Q/A tests (stage-qa)                                                                                                                                                                                                                                                                                                                                         
# work/stage/usr/local/share/chromium/chrome-wrapper --gdb
GNU gdb 6.1.1 [FreeBSD]                                                                                                                                                                                                                                                                                                                                                    
Copyright 2004 Free Software Foundation, Inc.                                                                                                                                                                                                                                                                                                                              
GDB is free software, covered by the GNU General Public License, and you are                                                                                                                                                                                                                                                                                               
welcome to change it and/or distribute copies of it under certain conditions.                                                                                                                                                                                                                                                                                              
Type "show copying" to see the conditions.                                                                                                                                                                                                                                                                                                                                 
There is absolutely no warranty for GDB.  Type "show warranty" for details.                                                                                                                                                                                                                                                                                                
This GDB was configured as "amd64-marcel-freebsd"...                                                                                                                                                                                                                                                                                                                       
                                                                                                                                                                                                                                                                                                                                                                           
(gdb)                                                                                                                                                                                                                                                                                                                                                                      
(gdb) run                                                                                                                                                                                                                                                                                                                                                                  
Starting program: /usr/ports/www/chromium/work/stage/usr/local/share/chromium/chrome                                                                                                                                                                                                                                                                                       
[New LWP 101555]                                                                                                                                                                                                                                                                                                                                                           
Error while reading shared library symbols:                                                                                                                                                                                                                                                                                                                                
Dwarf Error: wrong version in compilation unit header (is 4, should be 2) [in module /usr/local/lib/gcc49/libgcc_s.so.1]
[27103:373318656:0724/181145:ERROR:browser_main_loop.cc(223)] Gtk: cannot open display: 

Program exited with code 01.
(gdb) run
Starting program: /usr/ports/www/chromium/work/stage/usr/local/share/chromium/chrome 
[New LWP 101163]
Error while reading shared library symbols:
Dwarf Error: wrong version in compilation unit header (is 4, should be 2) [in module /usr/local/lib/gcc49/libgcc_s.so.1]
[27143:373318656:0724/181312:ERROR:browser_main_loop.cc(223)] Gtk: cannot open display: 

Program exited with code 01.

$ pkg info gcc49
gcc49-4.9.4.s20150715
Name           : gcc49
Version        : 4.9.4.s20150715
Installed on   : Sat Jul 18 23:01:35 CDT 2015
Origin         : lang/gcc49
Architecture   : freebsd:10:x86:64
Prefix         : /usr/local
Categories     : lang java
Licenses       : GPLv3RLE and GPLv3
Maintainer     : gerald@FreeBSD.org
WWW            : http://gcc.gnu.org/
Comment        : GNU Compiler Collection 4.9
Options        :
        BOOTSTRAP      : on
        JAVA           : on
Shared Libs required:
        libmpfr.so.4
        libmpc.so.3
        libgmp.so.10
Shared Libs provided:
        libstdc++.so.6
        libssp.so.0
        libquadmath.so.0
        libobjc.so.4
        liblto_plugin.so.0
        libjvm.so
        libjavamath.so
        libitm.so.1
        libgomp.so.1
        libgij.so.15
        libgfortran.so.3
        libgcj.so.15
        libgcj-tools.so.15
        libgcc_s.so.1
        libcilkrts.so.5
        libatomic.so.1
Annotations    :
        cpe            : cpe:2.3:a:gnu:gcc:4.9.4:::::freebsd10:x64
        repo_type      : binary
        repository     : FreeBSD
Flat size      : 372MiB
Comment 9 Tony Narlock 2015-07-25 02:03:34 UTC
(In reply to pete from comment #7)
As a follow up from:

[27143:373318656:0724/181312:ERROR:browser_main_loop.cc(223)] Gtk: cannot open display: 


The issue was trying to run:

> work/stage/usr/local/share/chromium/chrome-wrapper --gdb

While in root.

I am able to run chromium w/ debug symbols now through a normal user! Excellent! Thank you!
Comment 10 Tony Narlock 2015-07-25 02:12:28 UTC
I should add - I am running chromium in GDB, but I still get this repeatedly while chromium is open:

Dwarf Error: wrong version in compilation unit header (is 4, should be 2) [in module /usr/local/lib/gcc49/libgcc_s.so.1]
Comment 11 Ed Maste freebsd_committer freebsd_triage 2015-07-30 19:29:15 UTC
> Forgive me, but https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=200617 is
> lost on me. I'm not experienced enough at this stage to understand what's going
> on there.

Sorry about that - the issue I encountered in PR 200617 is that building the Chromium port with the DEBUG option resulted in a binary with a .text segment (i.e., the program's code) larger than the default maximum set by the kernel. That is, by default the kernel refuses to load a binary containing over 128MB of code by default, and the DEBUG build of Chromium is too large. I raised PR 200617 because there's no useful user-facing error message for this case -- just something like "abort".

You can increase kern.maxtsiz and try running the DEBUG Chromium.
Comment 12 Ed Maste freebsd_committer freebsd_triage 2015-07-30 19:30:23 UTC
> I should add - I am running chromium in GDB, but I still get this repeatedly
> while chromium is open:

Is this with the base system gdb (/usr/bin/gdb)? If so, try the gdb port instead.
Comment 13 Arto Pekkanen 2016-06-04 22:17:45 UTC
(In reply to Ed Maste from comment #11)

Just FYI, I've been debugging Chromium to produce core dumps succesfully. However, I never even tried running the debug version of chromium.

Instead what I did:
- installed www/chromium from packages
- separately built the www/chromium port with make build (without installing the port)
- located the debug binary (a 4 GB file) in the port working directory
- gdb -s <path-to-debug-binary>  /usr/local/share/chromium/chrome

Like this the gdb loads debug symbols from the debug binary, but runs the actual chrome binary. Works fine.

Although I have to say this is an ugly workaround.

Would it be possible to strip the debug symbols from the resulting binary, store them in a separate file?
Comment 14 Walter Schwarzenfeld 2018-01-13 20:15:25 UTC
Is this still relevant?
Comment 15 Carlos J. Puga Medina freebsd_committer freebsd_triage 2018-08-18 15:46:34 UTC
Chromium builds with the DEBUG option enabled. Tested with chromium 68.

Please, reopen the PR in case that you have issues.
Comment 16 Carlos J. Puga Medina freebsd_committer freebsd_triage 2018-08-18 15:48:14 UTC
(In reply to Carlos J. Puga Medina from comment #15)

I forgot to mention that it also works fine.