bugGNU Octave - Bugs: bug #34301, Can't compile oct files using gcc...


bug #34301: Can't compile oct files using gcc -fvisibility=hidden option

Submitted by:  None
Submitted on:  Thu 15 Sep 2011 09:19:46 PM UTC  
Category:  Configuration and Build System Severity:  1 - Wish
Priority:  3 - Low Item Group:  Feature Request
Status:  Need Info Assigned to:  None
Originator Name:  Andrew Ross Originator Email:  -email is unavailable-
Open/Closed:  Open Release:  dev
Operating System:  GNU/Linux

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


( Jump to the original submission)

Wed 24 Feb 2021 02:49:17 PM UTC, comment #6: 

Is this resolved after the changes for patch #8919?

Markus M├╝tzel <mmuetzel>
Project Member
Sat 14 Feb 2015 05:28:16 PM UTC, comment #5: 

Yes, I've just done so. Looks like this bug is waiting for some more information from the requester.

Mike Miller <mtmiller>
Project Administrator
Sat 14 Feb 2015 01:49:43 PM UTC, comment #4: 

@Mike: The priority on this is marked low.  Should I make it WON'T FIX for the 4.0 release list (http://wiki.octave.org/Bug_Fix_List_-_4.0_Release#Bugs_marked_Configuration_and_Build_System)

Rik <rik5>
Project Administrator
Thu 27 Mar 2014 11:56:09 PM UTC, comment #3: 

This might be useful information for someone interested in working on this problem. The following warnings appear when compiling the array classes under liboctave:

.../Array-i.cc:44:113: warning: type attributes ignored after type is already defined [-Wattributes]

These might be related to the link errors I get when trying to link the octave-cli and octave-gui executables at the end of the build.

Mike Miller <mtmiller>
Project Administrator
Thu 27 Mar 2014 11:43:30 PM UTC, comment #2: 

Still unable to compile Octave itself with -fvisibility=hidden, fixed the patch to the following:

diff --git a/oct-conf-post.in.h b/oct-conf-post.in.h
--- a/oct-conf-post.in.h
+++ b/oct-conf-post.in.h
@@ -121,6 +121,14 @@
#if defined (_MSC_VER)
#define OCTAVE_EXPORT __declspec(dllexport)
#define OCTAVE_IMPORT __declspec(dllimport)
+#elif defined (__GNUC__)
+#if (__GNUC__ >= 4)
+#define OCTAVE_EXPORT __attribute__ ((visibility ("default")))
+#define OCTAVE_IMPORT __attribute__ ((visibility ("default")))
/* All other compilers, at least for now. */

With a default build of Octave, there is no change, everything works as it used to. So I just want to understand better what this change is actually supposed to help with, is Octave supposed to be able to be built with hidden symbols, or is it only for the benefit of external packages that are linking against the Octave libraries (that still expose the full set of library symbols in their dynamic symbol table)?

Mike Miller <mtmiller>
Project Administrator
Thu 27 Mar 2014 04:41:23 AM UTC, comment #1: 

This suggested change has no noticable effect on compiling Octave with gcc with a default configure run.

Was the suggestion in the report that Octave itself should be able to be built with the -fvisibility=hidden gcc option, or was that meant to suggest that third-party projects could compile with that option and still link properly with the Octave libraries? The gcc wiki page seems to imply that the shared library itself should be built with this option.

If that's correct, then that does not currently work for me.
Trying to build Octave with -fvisibility=hidden results in many link errors when the octave-cli and octave-gui executables are built. Let me know if I'm doing something wrong.

Attached patch is the change I am building with.

(file #31054)

Mike Miller <mtmiller>
Project Administrator
Thu 15 Sep 2011 09:19:46 PM UTC, original submission:  

The OCTAVE_EXPORT macro defined in oct-dlldefs.h is empty on gcc. Defining it for gcc using

#define OCTAVE_EXPORT _attribute_ ((visibility ("default")))

will allow oct code to be compiled using the gcc -fvisibility=hidden option, which by default does not export any symbols. See http://gcc.gnu.org/wiki/Visibility for a brief overview of why this is a good idea.

This bug report originates from work on the octave bindings for plplot using swig. The relevant thread showing the discussion and our temporary workaround is





(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #31054:  visibility.diff added by mtmiller (549B - text/x-patch)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mtmiller (Updated the item)
  • -email is unavailable- added by None (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-03-27 mtmiller Priority5 - Normal => 3 - Low
    2014-03-27 mtmiller Attached File- => Added visibility.diff, #31054
        Severity3 - Normal => 1 - Wish
        StatusNone => Need Info
        Release3.2.4 => dev

    Back to the top

    Powered by Savane 3.6