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


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

Submitter:  None
Submitted:  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:  * Closed Release:  * dev
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment (Rich Markup)

( Jump to the original submission )

Wed 05 Oct 2022 12:36:54 PM UTC, comment #8: 

This report hasn't seen any requested info from the original reporter since many years. A lot has changed with respect to building Octave with hidden visibility since then. (There are still known issues with this at least on some platforms though.)

Closing report. If actionable (more specific) information is provided, new reports can be opened.

Markus Mützel <mmuetzel>
Group Member
Sat 01 Oct 2022 07:47:56 PM UTC, comment #7: 

Checking on old bug reports. I am unable to replicate this behavior. Is it still a problem? Does it trigger only if Octave itself was compiled with fvisibility settings?

Arun Giridhar <arungiridhar>
Group Member
Wed 24 Feb 2021 02:49:17 PM UTC, comment #6: 

Is this resolved after the changes for patch #8919?

Markus Mützel <mmuetzel>
Group 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>
Group 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>
Group 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>
Group 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>
Group 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>
Group 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 arungiridhar (Posted a comment)
  • -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)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only project members can vote.





    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-10-05 mmuetzel Open/ClosedOpen Closed
    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.11